test_EndedEvent.html (871B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <title>MSE: basic functionality</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"> 11 <script class="testbody" type="text/javascript"> 12 13 SimpleTest.waitForExplicitFinish(); 14 15 runWithMSE(async (ms, el) => { 16 await once(ms, "sourceopen"); 17 const sb = ms.addSourceBuffer("video/webm"); 18 sb.appendBuffer(new Uint8Array(await fetchWithXHR("seek.webm"))); 19 sb.addEventListener("updateend", () => ms.endOfStream()); 20 21 // Test "ended" is fired when seeking to the end of the media 22 // once the duration is known. 23 ms.onsourceended = () => el.currentTime = el.duration; 24 await once(el, "ended"); 25 SimpleTest.finish(); 26 }); 27 28 </script> 29 </pre> 30 </body> 31 </html>