| <html> |
| <head> |
| <script src="media-file.js"></script> |
| <script src="video-test.js"></script> |
| <script> |
| var playbackStarted = false; |
| function start() |
| { |
| findMediaElement(); |
| video.src = findMediaFile("video", "content/test"); |
| |
| testExpected("video.preload", "metadata"); |
| waitForEvent('loadedmetadata', onLoadedMetadata); |
| waitForEvent('canplaythrough', onCanPlayThrough); |
| failTestIn(2000); |
| } |
| function onLoadedMetadata() |
| { |
| testExpected("video.readyState", HTMLMediaElement.HAVE_ENOUGH_DATA, "<"); |
| |
| setTimeout(function () { |
| testExpected("video.buffered.length", 0, "=="); |
| playbackStarted = true; |
| run("video.play()"); |
| }, 250); |
| } |
| function onCanPlayThrough() |
| { |
| test("playbackStarted"); |
| testExpected("video.buffered.length", 0, ">"); |
| endTest(); |
| } |
| </script> |
| </head> |
| |
| <body onload="start()"> |
| <video controls preload="metadata"></video> |
| <p>Test that preload="metadata" disables buffering before playback.</p> |
| </body> |
| </html> |