Title: [293077] branches/safari-613-branch/Source/WebCore
Revision
293077
Author
[email protected]
Date
2022-04-19 22:38:54 -0700 (Tue, 19 Apr 2022)

Log Message

Cherry-pick r290997. rdar://problem/79950080

    [iOS] Flash media controls when a fullscreen video resets its source
    https://bugs.webkit.org/show_bug.cgi?id=237493

    Reviewed by Jer Noble.

    Source/WebCore:

    Some pages reset the fullscreen video's source when a user rotates the device.
    The screen will become black for a while, and users might think the player is broken.
    With this patch, the player will show the media controls for 1 second when the source
    is changed, so that users will know the player is working.

    * platform/ios/VideoFullscreenInterfaceAVKit.h:
    * platform/ios/VideoFullscreenInterfaceAVKit.mm:
    `_presentingViewController` is only used for watchOS.
    (-[WebAVPlayerViewController flashPlaybackControlsWithDuration:]):
    (VideoFullscreenInterfaceAVKit::setPlayerIdentifier):

    Source/WebCore/PAL:

    * pal/spi/cocoa/AVKitSPI.h:

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@290997 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-613-branch/Source/WebCore/ChangeLog (293076 => 293077)


--- branches/safari-613-branch/Source/WebCore/ChangeLog	2022-04-20 05:38:50 UTC (rev 293076)
+++ branches/safari-613-branch/Source/WebCore/ChangeLog	2022-04-20 05:38:54 UTC (rev 293077)
@@ -1,5 +1,51 @@
 2022-04-19  Alan Coon  <[email protected]>
 
+        Cherry-pick r290997. rdar://problem/79950080
+
+    [iOS] Flash media controls when a fullscreen video resets its source
+    https://bugs.webkit.org/show_bug.cgi?id=237493
+    
+    Reviewed by Jer Noble.
+    
+    Source/WebCore:
+    
+    Some pages reset the fullscreen video's source when a user rotates the device.
+    The screen will become black for a while, and users might think the player is broken.
+    With this patch, the player will show the media controls for 1 second when the source
+    is changed, so that users will know the player is working.
+    
+    * platform/ios/VideoFullscreenInterfaceAVKit.h:
+    * platform/ios/VideoFullscreenInterfaceAVKit.mm:
+    `_presentingViewController` is only used for watchOS.
+    (-[WebAVPlayerViewController flashPlaybackControlsWithDuration:]):
+    (VideoFullscreenInterfaceAVKit::setPlayerIdentifier):
+    
+    Source/WebCore/PAL:
+    
+    * pal/spi/cocoa/AVKitSPI.h:
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@290997 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-03-08  Peng Liu  <[email protected]>
+
+            [iOS] Flash media controls when a fullscreen video resets its source
+            https://bugs.webkit.org/show_bug.cgi?id=237493
+
+            Reviewed by Jer Noble.
+
+            Some pages reset the fullscreen video's source when a user rotates the device.
+            The screen will become black for a while, and users might think the player is broken.
+            With this patch, the player will show the media controls for 1 second when the source
+            is changed, so that users will know the player is working.
+
+            * platform/ios/VideoFullscreenInterfaceAVKit.h:
+            * platform/ios/VideoFullscreenInterfaceAVKit.mm:
+            `_presentingViewController` is only used for watchOS.
+            (-[WebAVPlayerViewController flashPlaybackControlsWithDuration:]):
+            (VideoFullscreenInterfaceAVKit::setPlayerIdentifier):
+
+2022-04-19  Alan Coon  <[email protected]>
+
         Cherry-pick r289531. rdar://problem/88023949
 
     Introduce SignedPtrTraits which enables Ref pointers to be protected with PtrTags.

Modified: branches/safari-613-branch/Source/WebCore/PAL/ChangeLog (293076 => 293077)


--- branches/safari-613-branch/Source/WebCore/PAL/ChangeLog	2022-04-20 05:38:50 UTC (rev 293076)
+++ branches/safari-613-branch/Source/WebCore/PAL/ChangeLog	2022-04-20 05:38:54 UTC (rev 293077)
@@ -1,3 +1,40 @@
+2022-04-19  Alan Coon  <[email protected]>
+
+        Cherry-pick r290997. rdar://problem/79950080
+
+    [iOS] Flash media controls when a fullscreen video resets its source
+    https://bugs.webkit.org/show_bug.cgi?id=237493
+    
+    Reviewed by Jer Noble.
+    
+    Source/WebCore:
+    
+    Some pages reset the fullscreen video's source when a user rotates the device.
+    The screen will become black for a while, and users might think the player is broken.
+    With this patch, the player will show the media controls for 1 second when the source
+    is changed, so that users will know the player is working.
+    
+    * platform/ios/VideoFullscreenInterfaceAVKit.h:
+    * platform/ios/VideoFullscreenInterfaceAVKit.mm:
+    `_presentingViewController` is only used for watchOS.
+    (-[WebAVPlayerViewController flashPlaybackControlsWithDuration:]):
+    (VideoFullscreenInterfaceAVKit::setPlayerIdentifier):
+    
+    Source/WebCore/PAL:
+    
+    * pal/spi/cocoa/AVKitSPI.h:
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@290997 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-03-08  Peng Liu  <[email protected]>
+
+            [iOS] Flash media controls when a fullscreen video resets its source
+            https://bugs.webkit.org/show_bug.cgi?id=237493
+
+            Reviewed by Jer Noble.
+
+            * pal/spi/cocoa/AVKitSPI.h:
+
 2022-03-22  Alex Christensen  <[email protected]>
 
         Fix build on safari-613-branch

Modified: branches/safari-613-branch/Source/WebCore/PAL/pal/spi/cocoa/AVKitSPI.h (293076 => 293077)


--- branches/safari-613-branch/Source/WebCore/PAL/pal/spi/cocoa/AVKitSPI.h	2022-04-20 05:38:50 UTC (rev 293076)
+++ branches/safari-613-branch/Source/WebCore/PAL/pal/spi/cocoa/AVKitSPI.h	2022-04-20 05:38:54 UTC (rev 293077)
@@ -205,6 +205,8 @@
 - (void)startPictureInPicture;
 - (void)stopPictureInPicture;
 
+- (void)flashPlaybackControlsWithDuration:(NSTimeInterval)duration;
+
 @property (nonatomic, strong, nullable) AVPlayerController *playerController;
 @property (nonatomic, readonly, getter=isPictureInPictureActive) BOOL pictureInPictureActive;
 @property (nonatomic, readonly) BOOL pictureInPictureWasStartedWhenEnteringBackground;

Modified: branches/safari-613-branch/Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.h (293076 => 293077)


--- branches/safari-613-branch/Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.h	2022-04-20 05:38:50 UTC (rev 293076)
+++ branches/safari-613-branch/Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.h	2022-04-20 05:38:54 UTC (rev 293077)
@@ -76,6 +76,7 @@
     WEBCORE_EXPORT void hasVideoChanged(bool) final;
     WEBCORE_EXPORT void videoDimensionsChanged(const FloatSize&) final;
     WEBCORE_EXPORT void modelDestroyed() final;
+    WEBCORE_EXPORT void setPlayerIdentifier(std::optional<MediaPlayerIdentifier>) final;
 
     // PlaybackSessionModelClient
     WEBCORE_EXPORT void externalPlaybackChanged(bool enabled, PlaybackSessionModel::ExternalPlaybackTargetType, const String& localizedDeviceName) final;

Modified: branches/safari-613-branch/Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.mm (293076 => 293077)


--- branches/safari-613-branch/Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.mm	2022-04-20 05:38:50 UTC (rev 293076)
+++ branches/safari-613-branch/Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.mm	2022-04-20 05:38:54 UTC (rev 293077)
@@ -56,6 +56,10 @@
 #import <pal/cocoa/AVFoundationSoftLink.h>
 #import <pal/ios/UIKitSoftLink.h>
 
+#if !PLATFORM(WATCHOS)
+static const NSTimeInterval playbackControlsVisibleDurationAfterResettingVideoSource = 1.0;
+#endif
+
 SOFTLINK_AVKIT_FRAMEWORK()
 #if HAVE(AVOBSERVATIONCONTROLLER)
 SOFT_LINK_CLASS_OPTIONAL(AVKit, AVObservationController)
@@ -575,7 +579,9 @@
 
 @implementation WebAVPlayerViewController {
     VideoFullscreenInterfaceAVKit *_fullscreenInterface;
+#if PLATFORM(WATCHOS)
     RetainPtr<UIViewController> _presentingViewController;
+#endif
     RetainPtr<AVPlayerViewController> _avPlayerViewController;
 #if HAVE(AVOBSERVATIONCONTROLLER)
     RetainPtr<NSTimer> _startPictureInPictureTimer;
@@ -753,6 +759,14 @@
     return _avPlayerViewController.get().view;
 }
 
+#if !PLATFORM(WATCHOS)
+- (void)flashPlaybackControlsWithDuration:(NSTimeInterval)duration
+{
+    if ([_avPlayerViewController respondsToSelector:@selector(flashPlaybackControlsWithDuration:)])
+        [_avPlayerViewController flashPlaybackControlsWithDuration:duration];
+}
+#endif
+
 - (BOOL)showsPlaybackControls
 {
 #if PLATFORM(WATCHOS)
@@ -1045,6 +1059,16 @@
     invalidate();
 }
 
+void VideoFullscreenInterfaceAVKit::setPlayerIdentifier(std::optional<MediaPlayerIdentifier> identifier)
+{
+#if !PLATFORM(WATCHOS)
+    if (!identifier)
+        [m_playerViewController flashPlaybackControlsWithDuration:playbackControlsVisibleDurationAfterResettingVideoSource];
+#endif
+
+    m_playerIdentifier = identifier;
+}
+
 void VideoFullscreenInterfaceAVKit::requestHideAndExitFullscreen()
 {
     if (m_currentMode.hasPictureInPicture())
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to