Title: [241054] branches/safari-607-branch
Revision
241054
Author
alanc...@apple.com
Date
2019-02-06 14:16:12 -0800 (Wed, 06 Feb 2019)

Log Message

Cherry-pick r240537. rdar://problem/47774500

    <video> elements not in the DOM should be allowed to AirPlay
    https://bugs.webkit.org/show_bug.cgi?id=193837
    Source/WebCore:

    <rdar://42559491>

    Reviewed by Eric Carlson.

    Test: media/airplay-allows-buffering.html

    Some websites will switch between <video> elements backed by MSE to one backed by
    a media file in order to implement an AirPlay control. But when a <video> element is
    removed from the DOM and paused, further buffering is blocked. For some ports (namely
    Cocoa ones), this keeps AirPlay from engaging. Relax this buffering restriction for
    elements who have been asked to play wirelessly, but whose wireless playback has not
    started yet.

    * html/MediaElementSession.cpp:
    (WebCore::MediaElementSession::dataBufferingPermitted const):
    (WebCore::MediaElementSession::setShouldPlayToPlaybackTarget):

    LayoutTests:

    Reviewed by Eric Carlson.

    * media/airplay-allows-buffering-expected.txt: Added.
    * media/airplay-allows-buffering.html: Added.
    * platform/ios/TestExpectations:

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

Modified Paths

Added Paths

Diff

Modified: branches/safari-607-branch/LayoutTests/ChangeLog (241053 => 241054)


--- branches/safari-607-branch/LayoutTests/ChangeLog	2019-02-06 22:16:09 UTC (rev 241053)
+++ branches/safari-607-branch/LayoutTests/ChangeLog	2019-02-06 22:16:12 UTC (rev 241054)
@@ -1,3 +1,50 @@
+2019-02-05  Alan Coon  <alanc...@apple.com>
+
+        Cherry-pick r240537. rdar://problem/47774500
+
+    <video> elements not in the DOM should be allowed to AirPlay
+    https://bugs.webkit.org/show_bug.cgi?id=193837
+    Source/WebCore:
+    
+    <rdar://42559491>
+    
+    Reviewed by Eric Carlson.
+    
+    Test: media/airplay-allows-buffering.html
+    
+    Some websites will switch between <video> elements backed by MSE to one backed by
+    a media file in order to implement an AirPlay control. But when a <video> element is
+    removed from the DOM and paused, further buffering is blocked. For some ports (namely
+    Cocoa ones), this keeps AirPlay from engaging. Relax this buffering restriction for
+    elements who have been asked to play wirelessly, but whose wireless playback has not
+    started yet.
+    
+    * html/MediaElementSession.cpp:
+    (WebCore::MediaElementSession::dataBufferingPermitted const):
+    (WebCore::MediaElementSession::setShouldPlayToPlaybackTarget):
+    
+    LayoutTests:
+    
+    Reviewed by Eric Carlson.
+    
+    * media/airplay-allows-buffering-expected.txt: Added.
+    * media/airplay-allows-buffering.html: Added.
+    * platform/ios/TestExpectations:
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240537 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-01-25  Jer Noble  <jer.no...@apple.com>
+
+            <video> elements not in the DOM should be allowed to AirPlay
+            https://bugs.webkit.org/show_bug.cgi?id=193837
+
+            Reviewed by Eric Carlson.
+
+            * media/airplay-allows-buffering-expected.txt: Added.
+            * media/airplay-allows-buffering.html: Added.
+            * platform/ios/TestExpectations:
+
 2019-01-28  Babak Shafiei  <bshaf...@apple.com>
 
         Cherry-pick r240532. rdar://problem/47586874

Added: branches/safari-607-branch/LayoutTests/media/airplay-allows-buffering-expected.txt (0 => 241054)


--- branches/safari-607-branch/LayoutTests/media/airplay-allows-buffering-expected.txt	                        (rev 0)
+++ branches/safari-607-branch/LayoutTests/media/airplay-allows-buffering-expected.txt	2019-02-06 22:16:12 UTC (rev 241054)
@@ -0,0 +1,13 @@
+EVENT(load)
+RUN(internals.setMockMediaPlaybackTargetPickerEnabled(true))
+RUN(video.src = "" 'content/test'))
+EVENT(loadedmetadata)
+RUN(video.parentNode.removeChild(video))
+EXPECTED (internals.elementShouldBufferData(video) == 'false') OK
+RUN(video.webkitShowPlaybackTargetPicker())
+RUN(internals.setMockMediaPlaybackTargetPickerState('Sleepy TV', 'DeviceAvailable'))
+EVENT(webkitcurrentplaybacktargetiswirelesschanged)
+EXPECTED (video.webkitCurrentPlaybackTargetIsWireless == 'true') OK
+EXPECTED (internals.elementShouldBufferData(video) == 'true') OK
+END OF TEST
+

Added: branches/safari-607-branch/LayoutTests/media/airplay-allows-buffering.html (0 => 241054)


--- branches/safari-607-branch/LayoutTests/media/airplay-allows-buffering.html	                        (rev 0)
+++ branches/safari-607-branch/LayoutTests/media/airplay-allows-buffering.html	2019-02-06 22:16:12 UTC (rev 241054)
@@ -0,0 +1,37 @@
+<!DOCTYPE html><!-- webkit-test-runner [ enableModernMediaControls=false ] -->
+<html>
+<head>
+    <title>airplay-allows-buffering</title>
+    <script src=""
+    <script src=""
+    <script>
+
+    waitFor(window, 'load').then(async event => { 
+        findMediaElement();
+
+        run('internals.setMockMediaPlaybackTargetPickerEnabled(true)');
+
+        run(`video.src = "" 'content/test')`);
+        await waitFor(video, 'loadedmetadata');
+
+        run(`video.parentNode.removeChild(video)`);
+        await testExpectedEventually('internals.elementShouldBufferData(video)', false);
+
+        run(`video.webkitShowPlaybackTargetPicker()`);
+        await sleepFor(100);
+
+        run(`internals.setMockMediaPlaybackTargetPickerState('Sleepy TV', 'DeviceAvailable')`);
+        await waitFor(video, 'webkitcurrentplaybacktargetiswirelesschanged');
+        testExpected('video.webkitCurrentPlaybackTargetIsWireless', true);
+
+        await testExpectedEventually('internals.elementShouldBufferData(video)', true);
+
+        endTest();
+    });
+
+    </script>
+</head>
+<body>
+    <video controls preload='metadata'></video>
+</body>
+</html>

Modified: branches/safari-607-branch/LayoutTests/platform/ios/TestExpectations (241053 => 241054)


--- branches/safari-607-branch/LayoutTests/platform/ios/TestExpectations	2019-02-06 22:16:09 UTC (rev 241053)
+++ branches/safari-607-branch/LayoutTests/platform/ios/TestExpectations	2019-02-06 22:16:12 UTC (rev 241054)
@@ -2473,6 +2473,7 @@
 platform/ios/media/video-interruption-suspendunderlock.html [ Skip ]
 
 media/accessibility-closed-captions-has-aria-owns.html
+media/airplay-allows-buffering.html
 media/airplay-autoplay.html
 media/airplay-target-availability.html
 media/audio-delete-while-slider-thumb-clicked.html

Modified: branches/safari-607-branch/Source/WebCore/ChangeLog (241053 => 241054)


--- branches/safari-607-branch/Source/WebCore/ChangeLog	2019-02-06 22:16:09 UTC (rev 241053)
+++ branches/safari-607-branch/Source/WebCore/ChangeLog	2019-02-06 22:16:12 UTC (rev 241054)
@@ -1,5 +1,62 @@
 2019-02-05  Alan Coon  <alanc...@apple.com>
 
+        Cherry-pick r240537. rdar://problem/47774500
+
+    <video> elements not in the DOM should be allowed to AirPlay
+    https://bugs.webkit.org/show_bug.cgi?id=193837
+    Source/WebCore:
+    
+    <rdar://42559491>
+    
+    Reviewed by Eric Carlson.
+    
+    Test: media/airplay-allows-buffering.html
+    
+    Some websites will switch between <video> elements backed by MSE to one backed by
+    a media file in order to implement an AirPlay control. But when a <video> element is
+    removed from the DOM and paused, further buffering is blocked. For some ports (namely
+    Cocoa ones), this keeps AirPlay from engaging. Relax this buffering restriction for
+    elements who have been asked to play wirelessly, but whose wireless playback has not
+    started yet.
+    
+    * html/MediaElementSession.cpp:
+    (WebCore::MediaElementSession::dataBufferingPermitted const):
+    (WebCore::MediaElementSession::setShouldPlayToPlaybackTarget):
+    
+    LayoutTests:
+    
+    Reviewed by Eric Carlson.
+    
+    * media/airplay-allows-buffering-expected.txt: Added.
+    * media/airplay-allows-buffering.html: Added.
+    * platform/ios/TestExpectations:
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240537 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-01-25  Jer Noble  <jer.no...@apple.com>
+
+            <video> elements not in the DOM should be allowed to AirPlay
+            https://bugs.webkit.org/show_bug.cgi?id=193837
+            <rdar://42559491>
+
+            Reviewed by Eric Carlson.
+
+            Test: media/airplay-allows-buffering.html
+
+            Some websites will switch between <video> elements backed by MSE to one backed by
+            a media file in order to implement an AirPlay control. But when a <video> element is
+            removed from the DOM and paused, further buffering is blocked. For some ports (namely
+            Cocoa ones), this keeps AirPlay from engaging. Relax this buffering restriction for
+            elements who have been asked to play wirelessly, but whose wireless playback has not
+            started yet.
+
+            * html/MediaElementSession.cpp:
+            (WebCore::MediaElementSession::dataBufferingPermitted const):
+            (WebCore::MediaElementSession::setShouldPlayToPlaybackTarget):
+
+2019-02-05  Alan Coon  <alanc...@apple.com>
+
         Cherry-pick r239881. rdar://problem/47776480
 
     [iOS] Precision drop state thrashes when dragging near the top edge of an editable element

Modified: branches/safari-607-branch/Source/WebCore/html/MediaElementSession.cpp (241053 => 241054)


--- branches/safari-607-branch/Source/WebCore/html/MediaElementSession.cpp	2019-02-06 22:16:09 UTC (rev 241053)
+++ branches/safari-607-branch/Source/WebCore/html/MediaElementSession.cpp	2019-02-06 22:16:12 UTC (rev 241054)
@@ -377,6 +377,11 @@
     if (shouldOverrideBackgroundLoadingRestriction())
         return true;
 
+#if ENABLE(WIRELESS_PLAYBACK_TARGET)
+    if (m_shouldPlayToPlaybackTarget)
+        return true;
+#endif
+
     if (m_elementIsHiddenUntilVisibleInViewport || m_elementIsHiddenBecauseItWasRemovedFromDOM || m_element.elementIsHidden())
         return false;
 
@@ -675,6 +680,7 @@
 {
     INFO_LOG(LOGIDENTIFIER, shouldPlay);
     m_shouldPlayToPlaybackTarget = shouldPlay;
+    updateClientDataBuffering();
     client().setShouldPlayToPlaybackTarget(shouldPlay);
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to