Changeset 231924 in webkit


Ignore:
Timestamp:
May 17, 2018 3:16:22 PM (6 years ago)
Author:
commit-queue@webkit.org
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 <jeremyj@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.

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r231923 r231924  
     12018-05-17  Jeremy Jones  <jeremyj@apple.com>
     2
     3        Fullscreen to PiP results in exit fullscreen call failure
     4        https://bugs.webkit.org/show_bug.cgi?id=185699
     5        rdar://problem/40310291
     6
     7        Reviewed by Eric Carlson.
     8
     9        No new tests because no behavior change.
     10
     11        Prevent multiple exit fullscreen calls when transitioning from fullscreen to picture-in-picture.
     12
     13        * platform/ios/VideoFullscreenInterfaceAVKit.mm:
     14        (-[WebAVPlayerViewControllerDelegate playerViewControllerShouldAutomaticallyDismissAtPictureInPictureStart:]):
     15        Implement this to prevent AVKit from automatically initiating exit fullscreen on pip.
     16       
     17        (VideoFullscreenInterfaceAVKit::didStartPictureInPicture):
     18        Set the return to fullscreen flag here, since this is where exit fullscreen happens.
     19
     20        (VideoFullscreenInterfaceAVKit::shouldExitFullscreenWithReason):
     21        Don't exit fullscreen here since it is already initiated in didStartPictureInPicture.
     22
    1232018-05-17  Ryan Haddad  <ryanhaddad@apple.com>
    224
  • trunk/Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.mm

    r230845 r231924  
    154154}
    155155
     156- (BOOL)playerViewControllerShouldAutomaticallyDismissAtPictureInPictureStart:(AVPlayerViewController *)playerViewController
     157{
     158    UNUSED_PARAM(playerViewController);
     159    return NO;
     160}
     161
    156162static VideoFullscreenInterfaceAVKit::ExitFullScreenReason convertToExitFullScreenReason(AVPlayerViewControllerExitFullScreenReason reason)
    157163{
     
    14431449
    14441450    if (m_currentMode.hasFullscreen()) {
    1445         if (![m_playerViewController pictureInPictureWasStartedWhenEnteringBackground]) {
    1446             [[m_playerViewController view] layoutIfNeeded];
    1447             [m_playerViewController exitFullScreenAnimated:YES completionHandler:[protectedThis = makeRefPtr(this), this] (BOOL success, NSError *error) {
    1448                 exitFullscreenHandler(success, error);
    1449             }];
    1450         }
     1451        m_shouldReturnToFullscreenWhenStoppingPiP = YES;
     1452        [[m_playerViewController view] layoutIfNeeded];
     1453        [m_playerViewController exitFullScreenAnimated:YES completionHandler:[protectedThis = makeRefPtr(this), this] (BOOL success, NSError *error) {
     1454            exitFullscreenHandler(success, error);
     1455        }];
    14511456    } else {
    14521457        [m_window setHidden:YES];
     
    15461551        return true;
    15471552
    1548     if (reason == ExitFullScreenReason::PictureInPictureStarted) {
    1549         m_shouldReturnToFullscreenWhenStoppingPiP = m_currentMode.hasMode(HTMLMediaElementEnums::VideoFullscreenModeStandard);
    1550         dispatch_async(dispatch_get_main_queue(), [protectedThis = makeRefPtr(this), this] () mutable {
    1551             [m_playerViewController exitFullScreenAnimated:NO completionHandler:[protectedThis = WTFMove(protectedThis), this] (BOOL success, NSError *error) {
    1552                 exitFullscreenHandler(success, error);
    1553             }];
    1554         });
     1553    if (reason == ExitFullScreenReason::PictureInPictureStarted)
    15551554        return false;
    1556     }
    15571555
    15581556    if (playbackSessionModel() && (reason == ExitFullScreenReason::DoneButtonTapped || reason == ExitFullScreenReason::RemoteControlStopEventReceived))
Note: See TracChangeset for help on using the changeset viewer.