Title: [258682] trunk/Source
Revision
258682
Author
[email protected]
Date
2020-03-18 22:23:14 -0700 (Wed, 18 Mar 2020)

Log Message

The value of [AVPlayerViewController isPictureInPicturePossible] is NO in the first attempt to enter PiP
https://bugs.webkit.org/show_bug.cgi?id=204979

Reviewed by Jer Noble.

A follow-up patch to fix build failures.
Source/WebCore:

This patch also removes a meaningless line in the dealloc of WebAVPlayerViewController.

* platform/ios/VideoFullscreenInterfaceAVKit.mm:
(-[WebAVPlayerViewController initWithFullscreenInterface:]):
(-[WebAVPlayerViewController dealloc]):
(VideoFullscreenInterfaceAVKit::doEnterFullscreen):

Source/WebCore/PAL:

* pal/spi/cocoa/AVKitSPI.h:

Source/WTF:

* wtf/PlatformHave.h:

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (258681 => 258682)


--- trunk/Source/WTF/ChangeLog	2020-03-19 05:18:29 UTC (rev 258681)
+++ trunk/Source/WTF/ChangeLog	2020-03-19 05:23:14 UTC (rev 258682)
@@ -1,3 +1,14 @@
+2020-03-18  Peng Liu  <[email protected]>
+
+        The value of [AVPlayerViewController isPictureInPicturePossible] is NO in the first attempt to enter PiP
+        https://bugs.webkit.org/show_bug.cgi?id=204979
+
+        Reviewed by Jer Noble.
+
+        A follow-up patch to fix build failures.
+
+        * wtf/PlatformHave.h:
+
 2020-03-18  Myles C. Maxfield  <[email protected]>
 
         REGRESSION(r254389): Cordova throws an exception because it expects a hyphen inside navigator.locale

Modified: trunk/Source/WTF/wtf/PlatformHave.h (258681 => 258682)


--- trunk/Source/WTF/wtf/PlatformHave.h	2020-03-19 05:18:29 UTC (rev 258681)
+++ trunk/Source/WTF/wtf/PlatformHave.h	2020-03-19 05:23:14 UTC (rev 258682)
@@ -614,3 +614,7 @@
 #if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101600) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 140000)
 #define HAVE_SYSTEM_FEATURE_FLAGS 1
 #endif
+
+#if (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 130000)
+#define HAVE_AVOBSERVATIONCONTROLLER 1
+#endif

Modified: trunk/Source/WebCore/ChangeLog (258681 => 258682)


--- trunk/Source/WebCore/ChangeLog	2020-03-19 05:18:29 UTC (rev 258681)
+++ trunk/Source/WebCore/ChangeLog	2020-03-19 05:23:14 UTC (rev 258682)
@@ -1,3 +1,18 @@
+2020-03-18  Peng Liu  <[email protected]>
+
+        The value of [AVPlayerViewController isPictureInPicturePossible] is NO in the first attempt to enter PiP
+        https://bugs.webkit.org/show_bug.cgi?id=204979
+
+        Reviewed by Jer Noble.
+
+        A follow-up patch to fix build failures.
+        This patch also removes a meaningless line in the dealloc of WebAVPlayerViewController.
+
+        * platform/ios/VideoFullscreenInterfaceAVKit.mm:
+        (-[WebAVPlayerViewController initWithFullscreenInterface:]):
+        (-[WebAVPlayerViewController dealloc]):
+        (VideoFullscreenInterfaceAVKit::doEnterFullscreen):
+
 2020-03-18  Andres Gonzalez  <[email protected]>
 
         Use helper function retainPtr(T*) instead of creating one.

Modified: trunk/Source/WebCore/PAL/ChangeLog (258681 => 258682)


--- trunk/Source/WebCore/PAL/ChangeLog	2020-03-19 05:18:29 UTC (rev 258681)
+++ trunk/Source/WebCore/PAL/ChangeLog	2020-03-19 05:23:14 UTC (rev 258682)
@@ -1,3 +1,14 @@
+2020-03-18  Peng Liu  <[email protected]>
+
+        The value of [AVPlayerViewController isPictureInPicturePossible] is NO in the first attempt to enter PiP
+        https://bugs.webkit.org/show_bug.cgi?id=204979
+
+        Reviewed by Jer Noble.
+
+        A follow-up patch to fix build failures.
+
+        * pal/spi/cocoa/AVKitSPI.h:
+
 2020-03-18  Alex Christensen  <[email protected]>
 
         Add HTTP3 as an experimental feature

Modified: trunk/Source/WebCore/PAL/pal/spi/cocoa/AVKitSPI.h (258681 => 258682)


--- trunk/Source/WebCore/PAL/pal/spi/cocoa/AVKitSPI.h	2020-03-19 05:18:29 UTC (rev 258681)
+++ trunk/Source/WebCore/PAL/pal/spi/cocoa/AVKitSPI.h	2020-03-19 05:23:14 UTC (rev 258682)
@@ -27,7 +27,6 @@
 #import <wtf/SoftLinking.h>
 
 #if USE(APPLE_INTERNAL_SDK)
-#import <AVKit/AVObservationController.h>
 #import <AVKit/AVPlayerController.h>
 #else
 #if PLATFORM(IOS_FAMILY)
@@ -55,6 +54,20 @@
 @end
 #endif // USE(APPLE_INTERNAL_SDK)
 
+#if HAVE(HAVE_AVOBSERVATIONCONTROLLER)
+#if USE(APPLE_INTERNAL_SDK)
+#import <AVKit/AVObservationController.h>
+#else
+@class AVKeyValueChange;
+
+@interface AVObservationController<Owner> : NSObject
+- (instancetype)initWithOwner:(Owner)owner NS_DESIGNATED_INITIALIZER;
+- (id)startObserving:(id)object keyPath:(NSString *)keyPath includeInitialValue:(BOOL)shouldIncludeInitialValue observationHandler:(void (^)(Owner owner, id observed, AVKeyValueChange *change))observationHandler;
+- (void)stopAllObservation;
+@end
+#endif
+#endif // HAVE(HAVE_AVOBSERVATIONCONTROLLER)
+
 #if PLATFORM(IOS_FAMILY)
 #import <AVKit/AVKit.h>
 #import <QuartzCore/QuartzCore.h>
@@ -130,14 +143,6 @@
 
 NS_ASSUME_NONNULL_BEGIN
 
-@class AVKeyValueChange;
-
-@interface AVObservationController<Owner> : NSObject
-- (instancetype)initWithOwner:(Owner)owner NS_DESIGNATED_INITIALIZER;
-- (id)startObserving:(id)object keyPath:(NSString *)keyPath includeInitialValue:(BOOL)shouldIncludeInitialValue observationHandler:(void (^)(Owner owner, id observed, AVKeyValueChange *change))observationHandler;
-- (void)stopAllObservation;
-@end
-
 @interface AVBackgroundView : UIView
 @property (nonatomic) BOOL automaticallyDrawsRoundedCorners;
 typedef NS_ENUM(NSInteger, AVBackgroundViewMaterialStyle) {

Modified: trunk/Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.mm (258681 => 258682)


--- trunk/Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.mm	2020-03-19 05:18:29 UTC (rev 258681)
+++ trunk/Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.mm	2020-03-19 05:23:14 UTC (rev 258682)
@@ -59,7 +59,9 @@
 #import <pal/ios/UIKitSoftLink.h>
 
 SOFTLINK_AVKIT_FRAMEWORK()
+#if HAVE(HAVE_AVOBSERVATIONCONTROLLER)
 SOFT_LINK_CLASS_OPTIONAL(AVKit, AVObservationController)
+#endif
 SOFT_LINK_CLASS_OPTIONAL(AVKit, AVPictureInPictureController)
 SOFT_LINK_CLASS_OPTIONAL(AVKit, AVPlayerViewController)
 SOFT_LINK_CLASS_OPTIONAL(AVKit, __AVPlayerLayerView)
@@ -546,8 +548,10 @@
     VideoFullscreenInterfaceAVKit *_fullscreenInterface;
     RetainPtr<UIViewController> _presentingViewController;
     RetainPtr<AVPlayerViewController> _avPlayerViewController;
+#if HAVE(HAVE_AVOBSERVATIONCONTROLLER)
     RetainPtr<NSTimer> _startPictureInPictureTimer;
     RetainPtr<AVObservationController> _avPlayerViewControllerObservationController;
+#endif
     id<AVPlayerViewControllerDelegate_WebKitOnly> _delegate;
 }
 
@@ -559,7 +563,9 @@
     _fullscreenInterface = interface;
     _avPlayerViewController = adoptNS([allocAVPlayerViewControllerInstance() initWithPlayerLayerView:interface->playerLayerView()]);
     _avPlayerViewController.get().modalPresentationStyle = UIModalPresentationOverFullScreen;
+#if HAVE(HAVE_AVOBSERVATIONCONTROLLER)
     _avPlayerViewControllerObservationController = adoptNS([allocAVObservationControllerInstance() initWithOwner:_avPlayerViewController.get()]);
+#endif
 #if PLATFORM(WATCHOS)
     _avPlayerViewController.get().delegate = self;
 #endif
@@ -567,6 +573,7 @@
     return self;
 }
 
+#if HAVE(HAVE_AVOBSERVATIONCONTROLLER)
 - (void)dealloc
 {
     [_startPictureInPictureTimer invalidate];
@@ -574,9 +581,9 @@
     [_avPlayerViewControllerObservationController stopAllObservation];
     _avPlayerViewControllerObservationController = nil;
 
-    _fullscreenInterface = nullptr;
     [super dealloc];
 }
+#endif
 
 - (BOOL)playerViewControllerShouldHandleDoneButtonTap:(AVPlayerViewController *)playerViewController
 {
@@ -632,6 +639,7 @@
 #define MY_NO_RETURN
 #endif
 
+#if HAVE(HAVE_AVOBSERVATIONCONTROLLER)
 static const NSTimeInterval startPictureInPictureTimeInterval = 0.5;
 
 - (void)tryToStartPictureInPicture MY_NO_RETURN
@@ -655,6 +663,7 @@
         }
     }];
 }
+#endif
 
 - (void)startPictureInPicture MY_NO_RETURN
 {
@@ -1380,7 +1389,11 @@
         if ([m_playerViewController isPictureInPicturePossible])
             [m_playerViewController startPictureInPicture];
         else
+#if HAVE(HAVE_AVOBSERVATIONCONTROLLER)
             [m_playerViewController tryToStartPictureInPicture];
+#else
+            failedToStartPictureInPicture();
+#endif
 
         return;
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to