Title: [265719] branches/safari-610.1-branch/Source/WebCore
Revision
265719
Author
[email protected]
Date
2020-08-14 17:16:52 -0700 (Fri, 14 Aug 2020)

Log Message

Cherry-pick r265690. rdar://problem/67100613

    The PiP button on the fullscreen youtube player disappears after starting a new video in a playlist
    https://bugs.webkit.org/show_bug.cgi?id=215488

    Reviewed by Eric Carlson.

    When a fullscreen video player (e.g., YouTube.com) completes the current video and starts
    the next one in a playlist, it may reuse the video element, so m_mediaElement of the
    PlaybackSessionModelMediaElement instance won't change. However, the video element
    will exit video fullscreen standby and then enter video fullscreen standby. Those
    transitions are invisible to users. But the corresponding PlaybackSessionModelContext
    instance will be destroyed and a new instance will be created.

    By default, the member variable m_pictureInPictureSupported of the PlaybackSessionModelContext
    instance is "false". After a new video starts to play, the function
    PlaybackSessionModelMediaElement::setMediaElement() won't ask the PlaybackSessionManager
    to send a PlaybackSessionManagerProxy::PictureInPictureSupportedChanged message
    (because we don't change m_mediaElement) to notify the PlaybackSessionModelContext
    instance in the UI process that m_pictureInPictureSupported should be "true". Therefore,
    the PlaybackSessionModelContext instance will tell the WKFullScreenViewController instance
    that picture-in-picture is not supported, which in turn will hide the picture-in-picture button.

    With this patch, PlaybackSessionModelMediaElement::setMediaElement() will ask the
    PlaybackSessionManager instance to send an IPC message if m_mediaElement is not nullptr
    even we don't change the media element. So that the PlaybackSessionModelContext instance
    in the UI process will always have a consistent state as the PlaybackSessionModelMediaElement
    instance in the Web process.

    * platform/cocoa/PlaybackSessionModelMediaElement.mm:
    (WebCore::PlaybackSessionModelMediaElement::setMediaElement):

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

Modified Paths

Diff

Modified: branches/safari-610.1-branch/Source/WebCore/ChangeLog (265718 => 265719)


--- branches/safari-610.1-branch/Source/WebCore/ChangeLog	2020-08-15 00:16:50 UTC (rev 265718)
+++ branches/safari-610.1-branch/Source/WebCore/ChangeLog	2020-08-15 00:16:52 UTC (rev 265719)
@@ -1,5 +1,74 @@
 2020-08-14  Alan Coon  <[email protected]>
 
+        Cherry-pick r265690. rdar://problem/67100613
+
+    The PiP button on the fullscreen youtube player disappears after starting a new video in a playlist
+    https://bugs.webkit.org/show_bug.cgi?id=215488
+    
+    Reviewed by Eric Carlson.
+    
+    When a fullscreen video player (e.g., YouTube.com) completes the current video and starts
+    the next one in a playlist, it may reuse the video element, so m_mediaElement of the
+    PlaybackSessionModelMediaElement instance won't change. However, the video element
+    will exit video fullscreen standby and then enter video fullscreen standby. Those
+    transitions are invisible to users. But the corresponding PlaybackSessionModelContext
+    instance will be destroyed and a new instance will be created.
+    
+    By default, the member variable m_pictureInPictureSupported of the PlaybackSessionModelContext
+    instance is "false". After a new video starts to play, the function
+    PlaybackSessionModelMediaElement::setMediaElement() won't ask the PlaybackSessionManager
+    to send a PlaybackSessionManagerProxy::PictureInPictureSupportedChanged message
+    (because we don't change m_mediaElement) to notify the PlaybackSessionModelContext
+    instance in the UI process that m_pictureInPictureSupported should be "true". Therefore,
+    the PlaybackSessionModelContext instance will tell the WKFullScreenViewController instance
+    that picture-in-picture is not supported, which in turn will hide the picture-in-picture button.
+    
+    With this patch, PlaybackSessionModelMediaElement::setMediaElement() will ask the
+    PlaybackSessionManager instance to send an IPC message if m_mediaElement is not nullptr
+    even we don't change the media element. So that the PlaybackSessionModelContext instance
+    in the UI process will always have a consistent state as the PlaybackSessionModelMediaElement
+    instance in the Web process.
+    
+    * platform/cocoa/PlaybackSessionModelMediaElement.mm:
+    (WebCore::PlaybackSessionModelMediaElement::setMediaElement):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@265690 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-08-14  Peng Liu  <[email protected]>
+
+            The PiP button on the fullscreen youtube player disappears after starting a new video in a playlist
+            https://bugs.webkit.org/show_bug.cgi?id=215488
+
+            Reviewed by Eric Carlson.
+
+            When a fullscreen video player (e.g., YouTube.com) completes the current video and starts
+            the next one in a playlist, it may reuse the video element, so m_mediaElement of the
+            PlaybackSessionModelMediaElement instance won't change. However, the video element
+            will exit video fullscreen standby and then enter video fullscreen standby. Those
+            transitions are invisible to users. But the corresponding PlaybackSessionModelContext
+            instance will be destroyed and a new instance will be created.
+
+            By default, the member variable m_pictureInPictureSupported of the PlaybackSessionModelContext
+            instance is "false". After a new video starts to play, the function
+            PlaybackSessionModelMediaElement::setMediaElement() won't ask the PlaybackSessionManager
+            to send a PlaybackSessionManagerProxy::PictureInPictureSupportedChanged message
+            (because we don't change m_mediaElement) to notify the PlaybackSessionModelContext
+            instance in the UI process that m_pictureInPictureSupported should be "true". Therefore,
+            the PlaybackSessionModelContext instance will tell the WKFullScreenViewController instance
+            that picture-in-picture is not supported, which in turn will hide the picture-in-picture button.
+
+            With this patch, PlaybackSessionModelMediaElement::setMediaElement() will ask the
+            PlaybackSessionManager instance to send an IPC message if m_mediaElement is not nullptr
+            even we don't change the media element. So that the PlaybackSessionModelContext instance
+            in the UI process will always have a consistent state as the PlaybackSessionModelMediaElement
+            instance in the Web process.
+
+            * platform/cocoa/PlaybackSessionModelMediaElement.mm:
+            (WebCore::PlaybackSessionModelMediaElement::setMediaElement):
+
+2020-08-14  Alan Coon  <[email protected]>
+
         Cherry-pick r265623. rdar://problem/67100650
 
     REGRESSION (r260684): Messages YouTube inline video: after Multitasking away and Back, Audio is heard but icon indicates "muted"

Modified: branches/safari-610.1-branch/Source/WebCore/platform/cocoa/PlaybackSessionModelMediaElement.mm (265718 => 265719)


--- branches/safari-610.1-branch/Source/WebCore/platform/cocoa/PlaybackSessionModelMediaElement.mm	2020-08-15 00:16:50 UTC (rev 265718)
+++ branches/safari-610.1-branch/Source/WebCore/platform/cocoa/PlaybackSessionModelMediaElement.mm	2020-08-15 00:16:52 UTC (rev 265719)
@@ -64,8 +64,13 @@
 
 void PlaybackSessionModelMediaElement::setMediaElement(HTMLMediaElement* mediaElement)
 {
-    if (m_mediaElement == mediaElement)
+    if (m_mediaElement == mediaElement) {
+        if (m_mediaElement) {
+            for (auto client : m_clients)
+                client->isPictureInPictureSupportedChanged(isPictureInPictureSupported());
+        }
         return;
+    }
 
     auto& events = eventNames();
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to