test_BufferedSeekCanPlayThrough.html (1649B)
1 <!DOCTYPE html> 2 <html><head> 3 <meta http-equiv="content-type" content="text/html; charset=windows-1252"> 4 <title>MSE: Don't get stuck buffering for too long when we have frames to show</title> 5 <script src="/tests/SimpleTest/SimpleTest.js"></script> 6 <script type="text/javascript" src="mediasource.js"></script> 7 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 8 </head> 9 <body> 10 <pre id="test"><script class="testbody" type="text/javascript"> 11 12 SimpleTest.waitForExplicitFinish(); 13 14 runWithMSE(async (ms, v) => { 15 logEvents(v); 16 await once(ms, "sourceopen"); 17 ok(true, "Receive a sourceopen event"); 18 ms.addEventListener("sourceopen", () => ok(false, "No more sourceopen")); 19 const sb = ms.addSourceBuffer("video/mp4"); 20 ok(sb, "Create a SourceBuffer"); 21 sb.addEventListener("error", e => { 22 ok(false, "Got Error: " + e); 23 SimpleTest.finish(); 24 }); 25 26 // Load just the beginning of the media, and the end. Verify 27 // that canplaythrough isn't fired, and waiting is fired. 28 await fetchAndLoad(sb, "bipbop/bipbop_video", ["init"], ".mp4"); 29 await fetchAndLoad(sb, "bipbop/bipbop_video", ["1"], ".m4s"); 30 await fetchAndLoad(sb, "bipbop/bipbop_video", ["9"], ".m4s"); 31 // Slighly before the end of the first segment. 32 v.currentTime = v.buffered.end(0) - 0.1; 33 v.onseeked = function() { 34 is(v.readyState, HTMLMediaElement.HAVE_FUTURE_DATA, 35 "readyState is HAVE_FUTURE_DATA after seeking close to a large gap"); 36 SimpleTest.finish(); 37 } 38 v.oncanplaythrough = function() { 39 ok(false, "Should not have received canplaythrough"); 40 SimpleTest.finish(); 41 } 42 }); 43 </script> 44 </pre> 45 </body> 46 </html>