diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /dom/media/mediasource/test/test_WaitingOnMissingData.html | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/media/mediasource/test/test_WaitingOnMissingData.html')
-rw-r--r-- | dom/media/mediasource/test/test_WaitingOnMissingData.html | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/dom/media/mediasource/test/test_WaitingOnMissingData.html b/dom/media/mediasource/test/test_WaitingOnMissingData.html new file mode 100644 index 000000000..a67441045 --- /dev/null +++ b/dom/media/mediasource/test/test_WaitingOnMissingData.html @@ -0,0 +1,63 @@ +<!DOCTYPE html> +<html><head> +<meta http-equiv="content-type" content="text/html; charset=windows-1252"> + <title>MSE: |waiting| event when source data is missing</title> + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> + <script type="text/javascript" src="mediasource.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> +</head> +<body> +<pre id="test"><script class="testbody" type="text/javascript"> + +SimpleTest.waitForExplicitFinish(); + +runWithMSE(function(ms, el) { + once(ms, 'sourceopen').then(function() { + ok(true, "Receive a sourceopen event"); + var sb = ms.addSourceBuffer("video/webm"); + fetchWithXHR("seek.webm", function(arrayBuffer) { + sb.addEventListener('error', (e) => { ok(false, "Got Error: " + e); SimpleTest.finish(); }); + loadSegment.bind(null, sb, new Uint8Array(arrayBuffer, 0, 318))() + .then(loadSegment.bind(null, sb, new Uint8Array(arrayBuffer, 318, 25223-318))) + .then(loadSegment.bind(null, sb, new Uint8Array(arrayBuffer, 25223, 46712-25223))) + /* Note - Missing |46712, 67833 - 46712| segment here */ + .then(loadSegment.bind(null, sb, new Uint8Array(arrayBuffer, 67833, 88966 - 67833))) + .then(loadSegment.bind(null, sb, new Uint8Array(arrayBuffer, 88966))) + .then(function() { + // HTMLMediaElement fires 'waiting' if somebody invokes |play()| before the MDSM + // has notified it of available data. Make sure that we get 'playing' before + // we starting waiting for 'waiting'. + info("Invoking play()"); + var p = once(el, 'playing'); + el.play(); + return p; + }).then(function() { + ok(true, "Video playing. It should play for a bit, then fire 'waiting'"); + var p = once(el, 'waiting'); + el.play(); + return p; + }).then(function() { + // currentTime is based on the current video frame, so if the audio ends just before + // the next video frame, currentTime can be up to 1 frame's worth earlier than + // min(audioEnd, videoEnd). + // 0.0465 is the length of the last audio frame. + ok(el.currentTime >= (sb.buffered.end(0) - 0.0465), + "Got a waiting event at " + el.currentTime); + info("Loading more data"); + var p = once(el, 'ended'); + loadSegment(sb, new Uint8Array(arrayBuffer, 46712, 67833 - 46712)).then(() => ms.endOfStream()); + return p; + }).then(function() { + // These fuzz factors are bigger than they should be. We should investigate + // and fix them in bug 1137574. + isfuzzy(el.duration, 4.001, 0.1, "Video has correct duration: " + el.duration); + isfuzzy(el.currentTime, el.duration, 0.1, "Video has correct currentTime."); + SimpleTest.finish(); + }); + }); + }); +}); +</script> +</pre> +</body> +</html> |