Title: [231924] trunk/Source/WebCore
- Revision
- 231924
- Author
- commit-qu...@webkit.org
- Date
- 2018-05-17 15:16:22 -0700 (Thu, 17 May 2018)
Log Message
Fullscreen to PiP results in exit fullscreen call failure
https://bugs.webkit.org/show_bug.cgi?id=185699
rdar://problem/40310291
Patch by Jeremy Jones <jere...@apple.com> on 2018-05-17
Reviewed by Eric Carlson.
No new tests because no behavior change.
Prevent multiple exit fullscreen calls when transitioning from fullscreen to picture-in-picture.
* platform/ios/VideoFullscreenInterfaceAVKit.mm:
(-[WebAVPlayerViewControllerDelegate playerViewControllerShouldAutomaticallyDismissAtPictureInPictureStart:]):
Implement this to prevent AVKit from automatically initiating exit fullscreen on pip.
(VideoFullscreenInterfaceAVKit::didStartPictureInPicture):
Set the return to fullscreen flag here, since this is where exit fullscreen happens.
(VideoFullscreenInterfaceAVKit::shouldExitFullscreenWithReason):
Don't exit fullscreen here since it is already initiated in didStartPictureInPicture.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (231923 => 231924)
--- trunk/Source/WebCore/ChangeLog 2018-05-17 22:15:06 UTC (rev 231923)
+++ trunk/Source/WebCore/ChangeLog 2018-05-17 22:16:22 UTC (rev 231924)
@@ -1,3 +1,25 @@
+2018-05-17 Jeremy Jones <jere...@apple.com>
+
+ Fullscreen to PiP results in exit fullscreen call failure
+ https://bugs.webkit.org/show_bug.cgi?id=185699
+ rdar://problem/40310291
+
+ Reviewed by Eric Carlson.
+
+ No new tests because no behavior change.
+
+ Prevent multiple exit fullscreen calls when transitioning from fullscreen to picture-in-picture.
+
+ * platform/ios/VideoFullscreenInterfaceAVKit.mm:
+ (-[WebAVPlayerViewControllerDelegate playerViewControllerShouldAutomaticallyDismissAtPictureInPictureStart:]):
+ Implement this to prevent AVKit from automatically initiating exit fullscreen on pip.
+
+ (VideoFullscreenInterfaceAVKit::didStartPictureInPicture):
+ Set the return to fullscreen flag here, since this is where exit fullscreen happens.
+
+ (VideoFullscreenInterfaceAVKit::shouldExitFullscreenWithReason):
+ Don't exit fullscreen here since it is already initiated in didStartPictureInPicture.
+
2018-05-17 Ryan Haddad <ryanhad...@apple.com>
Unreviewed, rolling out r231899.
Modified: trunk/Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.mm (231923 => 231924)
--- trunk/Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.mm 2018-05-17 22:15:06 UTC (rev 231923)
+++ trunk/Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.mm 2018-05-17 22:16:22 UTC (rev 231924)
@@ -153,6 +153,12 @@
self.fullscreenInterface->didStopPictureInPicture();
}
+- (BOOL)playerViewControllerShouldAutomaticallyDismissAtPictureInPictureStart:(AVPlayerViewController *)playerViewController
+{
+ UNUSED_PARAM(playerViewController);
+ return NO;
+}
+
static VideoFullscreenInterfaceAVKit::ExitFullScreenReason convertToExitFullScreenReason(AVPlayerViewControllerExitFullScreenReason reason)
{
switch (reason) {
@@ -1442,12 +1448,11 @@
[m_playerViewController setShowsPlaybackControls:YES];
if (m_currentMode.hasFullscreen()) {
- if (![m_playerViewController pictureInPictureWasStartedWhenEnteringBackground]) {
- [[m_playerViewController view] layoutIfNeeded];
- [m_playerViewController exitFullScreenAnimated:YES completionHandler:[protectedThis = makeRefPtr(this), this] (BOOL success, NSError *error) {
- exitFullscreenHandler(success, error);
- }];
- }
+ m_shouldReturnToFullscreenWhenStoppingPiP = YES;
+ [[m_playerViewController view] layoutIfNeeded];
+ [m_playerViewController exitFullScreenAnimated:YES completionHandler:[protectedThis = makeRefPtr(this), this] (BOOL success, NSError *error) {
+ exitFullscreenHandler(success, error);
+ }];
} else {
[m_window setHidden:YES];
[[m_playerViewController view] setHidden:YES];
@@ -1545,15 +1550,8 @@
if (!m_videoFullscreenModel)
return true;
- if (reason == ExitFullScreenReason::PictureInPictureStarted) {
- m_shouldReturnToFullscreenWhenStoppingPiP = m_currentMode.hasMode(HTMLMediaElementEnums::VideoFullscreenModeStandard);
- dispatch_async(dispatch_get_main_queue(), [protectedThis = makeRefPtr(this), this] () mutable {
- [m_playerViewController exitFullScreenAnimated:NO completionHandler:[protectedThis = WTFMove(protectedThis), this] (BOOL success, NSError *error) {
- exitFullscreenHandler(success, error);
- }];
- });
+ if (reason == ExitFullScreenReason::PictureInPictureStarted)
return false;
- }
if (playbackSessionModel() && (reason == ExitFullScreenReason::DoneButtonTapped || reason == ExitFullScreenReason::RemoteControlStopEventReceived))
playbackSessionModel()->pause();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes