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

Side by Side Diff: LayoutTests/media/video-preload.html

Issue 313173008: Allow load if play() is immediately called when preload == 'none' (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 6 years, 6 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 | LayoutTests/media/video-preload-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE HTML> 1 <!DOCTYPE HTML>
2 2
3 <html> 3 <html>
4 <head> 4 <head>
5 <script src=media-file.js></script> 5 <script src=media-file.js></script>
6 <script src=video-test.js></script> 6 <script src=video-test.js></script>
7 7
8 <script> 8 <script>
9 var timer = null; 9 var timer = null;
10 var movieInfo = 10 var movieInfo =
11 { 11 {
12 current : -1, 12 current : -1,
13 movies : 13 movies :
14 [ 14 [
15 { 15 {
16 // should not buffer, 'preload' is 'none' 16 // should not buffer, 'preload' is 'none'
17 preload : "none", 17 preload : "none",
18 shouldBuffer : false, 18 shouldBuffer : false,
19 autoPlay : false, 19 autoPlay : false,
20 description : "until 'play()' is called", 20 playInsteadOfLoad : false,
21 description : "until 'play()' is called",
22 },
23 {
24 // should buffer, because load() is called.
25 preload : "none",
26 shouldBuffer : true,
27 autoPlay : false,
28 playInsteadOfLoad : false,
29 description : "because 'load()' is called",
30 },
31 {
32 // should buffer, because play() is called.
33 preload : "none",
34 shouldBuffer : true,
35 autoPlay : false,
36 playInsteadOfLoad : true,
37 description : "because 'play()' is called",
21 }, 38 },
22 { 39 {
23 preload : "metadata", 40 preload : "metadata",
24 shouldBuffer : true, 41 shouldBuffer : true,
25 autoPlay : false, 42 autoPlay : false,
26 description : "", 43 playInsteadOfLoad : false,
44 description : "",
27 }, 45 },
28 { 46 {
29 preload : "auto", 47 preload : "auto",
30 shouldBuffer : true, 48 shouldBuffer : true,
31 autoPlay : false, 49 autoPlay : false,
32 description : "", 50 playInsteadOfLoad : false,
51 description : "",
33 }, 52 },
34 { 53 {
35 // should buffer because 'autoplay' is set 54 // should buffer because 'autoplay' is set
36 preload : "none", 55 preload : "none",
37 shouldBuffer : true, 56 shouldBuffer : true,
38 autoPlay : true, 57 autoPlay : true,
39 description : " because of 'autoplay'", 58 playInsteadOfLoad : false,
59 description : " because of 'autoplay'",
40 }, 60 },
41 ] 61 ]
42 }; 62 };
43 var timer = null; 63 var timer = null;
44 64
45 function checkLoad() 65 function checkLoad()
46 { 66 {
47 var movie = movieInfo.movies[movieInfo.current]; 67 var movie = movieInfo.movies[movieInfo.current];
48 68
49 logResult(true, "did not buffer automatically"); 69 logResult(true, "did not buffer automatically");
50 70
51 // start playback, which should force data to load 71 // start playback, which should force data to load
52 movie.shouldBuffer = true; 72 movie.shouldBuffer = true;
53 run("video.play()"); 73 run("video.play()");
54 } 74 }
55 75
56 function loadedmetadata() 76 function loadedmetadata()
57 { 77 {
58 var movie = movieInfo.movies[movieInfo.current]; 78 var movie = movieInfo.movies[movieInfo.current];
59 79
60 clearTimeout(timer); 80 clearTimeout(timer);
(...skipping 24 matching lines...) Expand all
85 var url = findMediaFile("video", "content/test"); 105 var url = findMediaFile("video", "content/test");
86 var desc = "Will load with <em>'preload=" + movie.preload + "'</ em>" 106 var desc = "Will load with <em>'preload=" + movie.preload + "'</ em>"
87 + ", <b>should" + (movie.shouldBuffer ? "" : " not") + " </b> buffer automatically " 107 + ", <b>should" + (movie.shouldBuffer ? "" : " not") + " </b> buffer automatically "
88 + movie.description; 108 + movie.description;
89 consoleWrite(desc); 109 consoleWrite(desc);
90 110
91 setupAttribute('preload', movie.preload); 111 setupAttribute('preload', movie.preload);
92 setupAttribute('autoplay', movie.autoPlay); 112 setupAttribute('autoplay', movie.autoPlay);
93 113
94 video.src = url; 114 video.src = url;
95 if (movieInfo.current > 0) 115 if (movieInfo.current > 0) {
96 video.load(); 116 if (movie.playInsteadOfLoad) {
117 run("video.play()");
118 } else {
119 run("video.load()");
120 }
121 }
97 if (!movie.shouldBuffer) 122 if (!movie.shouldBuffer)
98 timer = setTimeout(checkLoad, 200); 123 timer = setTimeout(checkLoad, 200);
99 } 124 }
100 125
101 function start() 126 function start()
102 { 127 {
103 findMediaElement(); 128 findMediaElement();
104 129
105 waitForEvent("error"); 130 waitForEvent("error");
106 waitForEvent("loadstart"); 131 waitForEvent("loadstart");
107 waitForEvent("play"); 132 waitForEvent("play");
108 waitForEvent('loadedmetadata', loadedmetadata); 133 waitForEvent('loadedmetadata', loadedmetadata);
109 134
110 openNextMovie(); 135 openNextMovie();
111 } 136 }
112 137
113 </script> 138 </script>
114 </head> 139 </head>
115 140
116 <body onload="start()"> 141 <body onload="start()">
117 <p>Test to see if media loads automatically when 'preload' is specified. </p> 142 <p>Test to see if media loads automatically when 'preload' is specified. </p>
118 <video controls ></video> 143 <video controls ></video>
119 </body> 144 </body>
120 </html> 145 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/media/video-preload-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698