Title: [209715] trunk
Revision
209715
Author
[email protected]
Date
2016-12-12 10:42:32 -0800 (Mon, 12 Dec 2016)

Log Message

Autoplay isn't working in iPhone MediaDocuments
https://bugs.webkit.org/show_bug.cgi?id=165710
<rdar://problems/29606761>

Reviewed by Darin Adler.
Source/WebCore:

Our silent video autoplay detection disabled autoplay
of videos in MediaDocuments.

Test: media/ios/autoplay-only-in-main-document.html

* html/MediaElementSession.cpp:
(WebCore::MediaElementSession::playbackPermitted):
Return true if we're in a top-level media document.

LayoutTests:

* media/ios/autoplay-only-in-main-document.html: Make sure that
an iframe pointing to media is not autoplayed.
* TestExpectations:
* platform/ios-simulator/TestExpectations:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (209714 => 209715)


--- trunk/LayoutTests/ChangeLog	2016-12-12 18:18:02 UTC (rev 209714)
+++ trunk/LayoutTests/ChangeLog	2016-12-12 18:42:32 UTC (rev 209715)
@@ -1,3 +1,16 @@
+2016-12-09  Dean Jackson  <[email protected]>
+
+        Autoplay isn't working in iPhone MediaDocuments
+        https://bugs.webkit.org/show_bug.cgi?id=165710
+        <rdar://problems/29606761>
+
+        Reviewed by Darin Adler.
+        
+        * media/ios/autoplay-only-in-main-document.html: Make sure that
+        an iframe pointing to media is not autoplayed.
+        * TestExpectations:
+        * platform/ios-simulator/TestExpectations:
+
 2016-12-12  Ryan Haddad  <[email protected]>
 
         Marking http/tests/security/contentSecurityPolicy/block-all-mixed-content/insecure-iframe-in-main-frame.html as flaky on ios-simulator.

Modified: trunk/LayoutTests/TestExpectations (209714 => 209715)


--- trunk/LayoutTests/TestExpectations	2016-12-12 18:18:02 UTC (rev 209714)
+++ trunk/LayoutTests/TestExpectations	2016-12-12 18:42:32 UTC (rev 209715)
@@ -26,6 +26,7 @@
 scrollingcoordinator/ios [ Skip ]
 fast/content-observation [ Skip ]
 media/mac [ Skip ]
+media/ios [ Skip ]
 media/controls/ipad [ Skip ]
 fast/text-autosizing [ Skip ]
 

Added: trunk/LayoutTests/media/ios/autoplay-only-in-main-document-expected.txt (0 => 209715)


--- trunk/LayoutTests/media/ios/autoplay-only-in-main-document-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/media/ios/autoplay-only-in-main-document-expected.txt	2016-12-12 18:42:32 UTC (rev 209715)
@@ -0,0 +1,2 @@
+
+PASS: Video did not autoplay
Property changes on: trunk/LayoutTests/media/ios/autoplay-only-in-main-document-expected.txt
___________________________________________________________________

Added: svn:eol-style

+native \ No newline at end of property

Added: svn:keywords

+Date Revision \ No newline at end of property

Added: svn:mime-type

+text/plain \ No newline at end of property

Added: trunk/LayoutTests/media/ios/autoplay-only-in-main-document.html (0 => 209715)


--- trunk/LayoutTests/media/ios/autoplay-only-in-main-document.html	                        (rev 0)
+++ trunk/LayoutTests/media/ios/autoplay-only-in-main-document.html	2016-12-12 18:42:32 UTC (rev 209715)
@@ -0,0 +1,40 @@
+<meta name="viewport" content="width=device-width">
+<style>
+iframe {
+    width: 300px;
+    height: 200px;
+}
+</style>
+<script>
+if (window.testRunner) {
+    internals.settings.setVideoPlaybackRequiresUserGesture(true);
+    testRunner.waitUntilDone();
+    testRunner.dumpAsText();
+}
+
+var iframe;
+
+function testVideo() {
+    var doc = iframe.contentDocument;
+    var video = doc.querySelector("video");
+
+    var result = document.createElement("p");
+    if (video.paused && !video.ended)
+        result.textContent = "PASS: Video did not autoplay";
+    else
+        result.textContent = "FAIL: Video was autoplaying";
+    
+    document.body.appendChild(result);
+
+    if (window.testRunner)
+        testRunner.notifyDone();
+}
+
+window.addEventListener("load", function () {
+    iframe = document.querySelector("iframe");
+    iframe.addEventListener("load", testVideo, false);
+    iframe.src = ""
+}, false);
+
+</script>
+<iframe></iframe>
Property changes on: trunk/LayoutTests/media/ios/autoplay-only-in-main-document.html
___________________________________________________________________

Added: svn:eol-style

+native \ No newline at end of property

Added: svn:keywords

+Date Revision \ No newline at end of property

Added: svn:mime-type

+text/html \ No newline at end of property

Modified: trunk/LayoutTests/platform/ios-simulator/TestExpectations (209714 => 209715)


--- trunk/LayoutTests/platform/ios-simulator/TestExpectations	2016-12-12 18:18:02 UTC (rev 209714)
+++ trunk/LayoutTests/platform/ios-simulator/TestExpectations	2016-12-12 18:42:32 UTC (rev 209715)
@@ -10,6 +10,7 @@
 displaylists [ Pass ]
 http/tests/quicklook [ Pass ]
 media/controls/ipad [ Pass ]
+media/ios [ Pass ]
 
 fast/text-autosizing/ios [ Pass ]
 fast/zooming/ios [ Pass ]

Modified: trunk/Source/WebCore/ChangeLog (209714 => 209715)


--- trunk/Source/WebCore/ChangeLog	2016-12-12 18:18:02 UTC (rev 209714)
+++ trunk/Source/WebCore/ChangeLog	2016-12-12 18:42:32 UTC (rev 209715)
@@ -1,3 +1,20 @@
+2016-12-09  Dean Jackson  <[email protected]>
+
+        Autoplay isn't working in iPhone MediaDocuments
+        https://bugs.webkit.org/show_bug.cgi?id=165710
+        <rdar://problems/29606761>
+
+        Reviewed by Darin Adler.
+
+        Our silent video autoplay detection disabled autoplay
+        of videos in MediaDocuments.
+
+        Test: media/ios/autoplay-only-in-main-document.html
+
+        * html/MediaElementSession.cpp:
+        (WebCore::MediaElementSession::playbackPermitted):
+        Return true if we're in a top-level media document.
+
 2016-12-12  Zan Dobersek  <[email protected]>
 
         Unreviewed. Fixing build breakage in GStreamer's WebKitCommonEncryptionDecryptorGStreamer.

Modified: trunk/Source/WebCore/html/MediaElementSession.cpp (209714 => 209715)


--- trunk/Source/WebCore/html/MediaElementSession.cpp	2016-12-12 18:18:02 UTC (rev 209714)
+++ trunk/Source/WebCore/html/MediaElementSession.cpp	2016-12-12 18:42:32 UTC (rev 209715)
@@ -150,6 +150,9 @@
 
 bool MediaElementSession::playbackPermitted(const HTMLMediaElement& element) const
 {
+    if (element.document().isMediaDocument() && !element.document().ownerElement())
+        return true;
+
     if (pageExplicitlyAllowsElementToAutoplayInline(element))
         return true;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to