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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src="../../../media-resources/media-file.js"></script>
3 <body></body>
4 <script>
5 window.internals.settings.setCrossOriginMediaPlaybackRequiresUserGesture(true);
6 window.internals.runtimeFlags.autoplayMutedVideosEnabled = true;
7
8 {
9 var video = document.createElement('video');
10 video.id = 'video';
11 video.src = findMediaFile('video', 'test');
12 video.autoplay = true;
13 video.loop = true;
14 document.body.appendChild(video);
15 }
16
17 {
18 var video = document.createElement('video');
19 video.id = 'video-muted';
20 video.src = findMediaFile('video', 'test');
21 video.muted = true;
22 video.autoplay = true;
23 video.loop = true;
24 document.body.appendChild(video);
25 }
26
27 var video = document.querySelector("#video");
28 var videoMuted = document.querySelector("#video-muted");
29
30 video.addEventListener('canplay', _ => {
31 console.log('video canplay');
32 window.parent.postMessage({
33 msg: 'canplay',
34 videoId: video.id,
35 isPaused: video.paused,
36 readyState: video.readyState
37 }, "*");
38 });
39
40 videoMuted.addEventListener('play', _ => {
41 console.log('videoMuted play');
42 console.log(videoMuted.id);
43 window.parent.postMessage({
44 msg: 'play',
45 videoId: videoMuted.id,
46 }, "*");
47 });
48
49 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698