Skip to content

Commit

Permalink
[iOS] Returning to fullscreen to PiP on YouTube breaks subsequent tou…
Browse files Browse the repository at this point in the history
…ch input

https://bugs.webkit.org/show_bug.cgi?id=267674
rdar://119832557

Reviewed by Eric Carlson.

When returning to Element Fullscreen from PiP, the normal "exit picture-in-picture" logic
is interrupted in order to restore the previous element fullscreen. Recent changes have
left the video fullscreen state machine broken, waiting to restore the video to its original
location. The WKFullscreenViewController is left in place, but empty, either atop the WKWebView,
or below it but containing the video layer.

When we receive the preparedToReturnToStandby(), instead of just clearing the PiP fullscreen
mode, continue processing the steps of the "exit picture-in-picture" logic at the point at
which it was interrupted.

* Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.mm:
(VideoFullscreenInterfaceAVKit::preparedToReturnToStandby):
(VideoFullscreenInterfaceAVKit::returnToStandby):

Canonical link: https://commits.webkit.org/273180@main
  • Loading branch information
jernoble committed Jan 18, 2024
1 parent 2fdd086 commit 5556d4c
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1413,7 +1413,7 @@ - (WTFLogChannel*)logChannel
if (!m_returningToStandby)
return;

clearMode(HTMLMediaElementEnums::VideoFullscreenModePictureInPicture, true);
returnToStandby();
}

void VideoFullscreenInterfaceAVKit::finalizeSetup()
Expand Down Expand Up @@ -1586,17 +1586,16 @@ - (WTFLogChannel*)logChannel

void VideoFullscreenInterfaceAVKit::returnToStandby()
{
ALWAYS_LOG_IF_POSSIBLE(LOGIDENTIFIER);
m_returningToStandby = false;

auto model = videoPresentationModel();
if (model)
model->returnVideoView();

[m_window setHidden:YES];
[[m_playerViewController view] setHidden:YES];

if (model)
model->didSetupFullscreen();
// Continue processing exit picture-in-picture now that
// it is safe to do so:
didStopPictureInPicture();
}

NO_RETURN_DUE_TO_ASSERT void VideoFullscreenInterfaceAVKit::watchdogTimerFired()
Expand Down

0 comments on commit 5556d4c

Please sign in to comment.