[Modern Media Controls] Turn media/modern-media-controls/ios-inline-media-controls...
[WebKit-https.git] / LayoutTests / media / video-load-preload-metadata.html
1 <html>
2     <head>
3         <script src="media-file.js"></script>
4         <script src="video-test.js"></script>
5         <script>
6             var playbackStarted = false;
7             function start()
8             {
9                 findMediaElement();
10                 video.src = findMediaFile("video", "content/test");
11
12                 testExpected("video.preload", "metadata");
13                 waitForEvent('loadedmetadata', onLoadedMetadata);
14                 waitForEvent('canplaythrough', onCanPlayThrough);
15                 failTestIn(2000);
16             }
17             function onLoadedMetadata()
18             {
19                 testExpected("video.readyState", HTMLMediaElement.HAVE_ENOUGH_DATA, "<");
20
21                 setTimeout(function () {
22                     testExpected("video.buffered.length", 0, "==");
23                     playbackStarted = true;
24                     run("video.play()");
25                 }, 250);
26             }
27             function onCanPlayThrough()
28             {
29                 test("playbackStarted");
30                 testExpected("video.buffered.length", 0, ">");
31                 endTest();
32             }
33         </script>
34     </head>
35
36     <body onload="start()">
37         <video controls preload="metadata"></video>
38         <p>Test that preload="metadata" disables buffering before playback.</p>
39     </body>
40 </html>