From 0e11706c9cf73b368cd06d4ff7fc39d710abaf27 Mon Sep 17 00:00:00 2001 From: Aditya Keerthi Date: Wed, 21 Jun 2023 17:29:26 -0700 Subject: [PATCH] Upstream visionOS-specific AVKit usage https://bugs.webkit.org/show_bug.cgi?id=258371 rdar://111125631 Reviewed by Tim Horton. * Source/WebCore/PAL/pal/spi/cocoa/AVKitSPI.h: * Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.mm: (-[WebAVPlayerViewController initWithFullscreenInterface:]): Canonical link: https://commits.webkit.org/265384@main --- Source/WebCore/PAL/pal/spi/cocoa/AVKitSPI.h | 14 ++++++++++++++ .../platform/ios/VideoFullscreenInterfaceAVKit.mm | 9 +++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/Source/WebCore/PAL/pal/spi/cocoa/AVKitSPI.h b/Source/WebCore/PAL/pal/spi/cocoa/AVKitSPI.h index 4005adfd1603..95fb4169cd32 100644 --- a/Source/WebCore/PAL/pal/spi/cocoa/AVKitSPI.h +++ b/Source/WebCore/PAL/pal/spi/cocoa/AVKitSPI.h @@ -401,3 +401,17 @@ NS_ASSUME_NONNULL_END #endif // HAVE(PIP_CONTROLLER) +#if PLATFORM(VISION) + +// FIXME: rdar://111125392 – import SPI using a header, following rdar://111123290. + +typedef NS_OPTIONS(NSUInteger, AVPlayerViewControllerFullScreenBehaviors) { + AVPlayerViewControllerFullScreenBehaviorHostContentInline = 1 << 3, +}; + +@interface AVPlayerViewController () +@property (nonatomic) BOOL prefersRoomDimming; +@property (nonatomic) AVPlayerViewControllerFullScreenBehaviors fullScreenBehaviors; +@end + +#endif // PLATFORM(VISION) diff --git a/Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.mm b/Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.mm index adeac3081826..830621be1541 100644 --- a/Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.mm +++ b/Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.mm @@ -52,10 +52,6 @@ #import #endif -#if PLATFORM(VISION) -#import -#endif - using namespace WebCore; #import @@ -408,8 +404,9 @@ - (instancetype)initWithFullscreenInterface:(VideoFullscreenInterfaceAVKit *)int _avPlayerViewController.get().delegate = self; #endif -#if ENABLE(FULLSCREEN_WINDOW_EFFECTS) - setupAVPlayerViewControllerForFullscreenWindowEffects(_avPlayerViewController.get()); +#if PLATFORM(VISION) + [_avPlayerViewController setPrefersRoomDimming:NO]; + [_avPlayerViewController setFullScreenBehaviors:AVPlayerViewControllerFullScreenBehaviorHostContentInline]; #endif #if HAVE(PIP_CONTROLLER)