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

Side by Side Diff: third_party/WebKit/LayoutTests/media/autoplay-unmute-offscreen.html

Issue 2250393002: Cancel autoplay muted when visible if the video gets unmuted before being visible. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/HTMLMediaElement.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <title>Test that unmuting offscreen video will not allow it to autoplay</title>
3 <script src="../resources/testharness.js"></script>
4 <script src="../resources/testharnessreport.js"></script>
5 <script src="media-file.js"></script>
6 <body>
7 <script>
8 window.internals.settings.setMediaPlaybackRequiresUserGesture(true);
9 window.internals.runtimeFlags.autoplayMutedVideosEnabled = true;
10
11 async_test(function(t) {
12 // Create a video off screen that will be unmuted before moving on screen.
13 {
14 var video = document.createElement('video');
15 video.id = 'offscreen-unmute';
16 video.src = findMediaFile('video', 'content/test');
17 video.muted = true;
18 video.autoplay = true;
19 video.loop = true;
20 video.style.position = 'absolute';
21 video.style.top = '-10000px';
22 document.body.appendChild(video);
23 }
24
25 // Create a video off screen that will not be unmuted before moving on scree n.
26 {
27 var video = document.createElement('video');
28 video.id = 'offscreen-mute';
29 video.src = findMediaFile('video', 'content/test');
30 video.muted = true;
31 video.autoplay = true;
32 video.loop = true;
33 video.style.position = 'absolute';
34 video.style.top = '-10000px';
35 document.body.appendChild(video);
36 }
37
38 var offscreenUnmute = document.querySelector('#offscreen-unmute');
39 var offscreenMute = document.querySelector('#offscreen-mute');
40 var loaded = 0;
41
42 function canPlayTroughHandler() {
43 ++loaded;
44 if (loaded != 2)
45 return;
46
47 assert_greater_than_equal(offscreenUnmute.readyState, HTMLMediaElement.HAV E_ENOUGH_DATA);
48 assert_greater_than_equal(offscreenMute.readyState, HTMLMediaElement.HAVE_ ENOUGH_DATA);
49
50 offscreenUnmute.muted = false;
51 offscreenUnmute.style.top = '0px';
52
53 offscreenMute.style.top = '0px';
54 offscreenMute.addEventListener('playing', t.step_func(_ => {
55 setTimeout(t.step_func_done(_ => {
56 assert_true(offscreenUnmute.paused);
57 assert_false(offscreenMute.paused);
58 }), 0);
59 }));
60 }
61
62 offscreenUnmute.addEventListener('canplaythrough', t.step_func(canPlayTrough Handler));
63 offscreenMute.addEventListener('canplaythrough', t.step_func(canPlayTroughHa ndler));
64 });
65 </script>
66 </body>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/HTMLMediaElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698