Title: [290997] trunk/Source/WebCore
- Revision
- 290997
- Author
- [email protected]
- Date
- 2022-03-08 09:29:11 -0800 (Tue, 08 Mar 2022)
Log Message
[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:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (290996 => 290997)
--- trunk/Source/WebCore/ChangeLog 2022-03-08 17:15:30 UTC (rev 290996)
+++ trunk/Source/WebCore/ChangeLog 2022-03-08 17:29:11 UTC (rev 290997)
@@ -1,3 +1,21 @@
+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-03-08 Alex Christensen <[email protected]>
WebSocket.send() should synchronously update bufferedAmount
Modified: trunk/Source/WebCore/PAL/ChangeLog (290996 => 290997)
--- trunk/Source/WebCore/PAL/ChangeLog 2022-03-08 17:15:30 UTC (rev 290996)
+++ trunk/Source/WebCore/PAL/ChangeLog 2022-03-08 17:29:11 UTC (rev 290997)
@@ -1,3 +1,12 @@
+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-07 Jean-Yves Avenard <[email protected]>
MediaTime::invalidTime() conversion to CMTime incorrectly creates a valid time.
Modified: trunk/Source/WebCore/PAL/pal/spi/cocoa/AVKitSPI.h (290996 => 290997)
--- trunk/Source/WebCore/PAL/pal/spi/cocoa/AVKitSPI.h 2022-03-08 17:15:30 UTC (rev 290996)
+++ trunk/Source/WebCore/PAL/pal/spi/cocoa/AVKitSPI.h 2022-03-08 17:29:11 UTC (rev 290997)
@@ -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: trunk/Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.h (290996 => 290997)
--- trunk/Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.h 2022-03-08 17:15:30 UTC (rev 290996)
+++ trunk/Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.h 2022-03-08 17:29:11 UTC (rev 290997)
@@ -78,7 +78,7 @@
WEBCORE_EXPORT void hasVideoChanged(bool) final;
WEBCORE_EXPORT void videoDimensionsChanged(const FloatSize&) final;
WEBCORE_EXPORT void modelDestroyed() final;
- void setPlayerIdentifier(std::optional<MediaPlayerIdentifier> identifier) final { m_playerIdentifier = identifier; }
+ WEBCORE_EXPORT void setPlayerIdentifier(std::optional<MediaPlayerIdentifier>) final;
// PlaybackSessionModelClient
WEBCORE_EXPORT void externalPlaybackChanged(bool enabled, PlaybackSessionModel::ExternalPlaybackTargetType, const String& localizedDeviceName) final;
Modified: trunk/Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.mm (290996 => 290997)
--- trunk/Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.mm 2022-03-08 17:15:30 UTC (rev 290996)
+++ trunk/Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.mm 2022-03-08 17:29:11 UTC (rev 290997)
@@ -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)
@@ -1050,6 +1064,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