Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(130)

Unified Diff: third_party/WebKit/LayoutTests/http/tests/media/resources/autoplay-crossorigin-iframe.html

Issue 2496593002: Adding an experimental flag to block autoplay with sound in cross-origin iframes (Closed)
Patch Set: nits Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/http/tests/media/resources/autoplay-crossorigin-iframe.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/resources/autoplay-crossorigin-iframe.html b/third_party/WebKit/LayoutTests/http/tests/media/resources/autoplay-crossorigin-iframe.html
new file mode 100644
index 0000000000000000000000000000000000000000..1cae503623cc367b6f7fa46ff5a9baa810745c75
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/media/resources/autoplay-crossorigin-iframe.html
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+<script src="../../../media-resources/media-file.js"></script>
+<body></body>
+<script>
+window.internals.settings.setCrossOriginMediaPlaybackRequiresUserGesture(true);
+window.internals.runtimeFlags.autoplayMutedVideosEnabled = true;
+
+{
+ var video = document.createElement('video');
+ video.id = 'video';
+ video.src = findMediaFile('video', 'test');
+ video.autoplay = true;
+ video.loop = true;
+ document.body.appendChild(video);
+}
+
+{
+ var video = document.createElement('video');
+ video.id = 'video-muted';
+ video.src = findMediaFile('video', 'test');
+ video.muted = true;
+ video.autoplay = true;
+ video.loop = true;
+ document.body.appendChild(video);
+}
+
+var video = document.querySelector("#video");
+var videoMuted = document.querySelector("#video-muted");
+
+video.addEventListener('canplay', _ => {
+ console.log('video canplay');
+ window.parent.postMessage({
+ msg: 'canplay',
+ videoId: video.id,
+ isPaused: video.paused,
+ readyState: video.readyState
+ }, "*");
+});
+
+videoMuted.addEventListener('play', _ => {
+ console.log('videoMuted play');
+ console.log(videoMuted.id);
+ window.parent.postMessage({
+ msg: 'play',
+ videoId: videoMuted.id,
+ }, "*");
+});
+
+</script>

Powered by Google App Engine
This is Rietveld 408576698