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_AudioChange_mp4.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_AudioChange_mp4.html')
-rw-r--r-- | dom/media/mediasource/test/test_AudioChange_mp4.html | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/dom/media/mediasource/test/test_AudioChange_mp4.html b/dom/media/mediasource/test/test_AudioChange_mp4.html new file mode 100644 index 000000000..95f48cadf --- /dev/null +++ b/dom/media/mediasource/test/test_AudioChange_mp4.html @@ -0,0 +1,72 @@ +<!DOCTYPE HTML> +<html> +<head> + <title>MSE: basic functionality</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(); + +// This test checks loading a stereo segment, followed by a 5.1 segment plays without error. + +runWithMSE(function(ms, el) { + el.controls = true; + once(ms, 'sourceopen').then(function() { + // Log events for debugging. + var events = ["suspend", "play", "canplay", "canplaythrough", "loadstart", "loadedmetadata", + "loadeddata", "playing", "ended", "error", "stalled", "emptied", "abort", + "waiting", "pause", "durationchange", "seeking", "seeked"]; + function logEvent(e) { + var v = e.target; + info("got " + e.type + " event"); + } + events.forEach(function(e) { + el.addEventListener(e, logEvent, false); + }); + + ok(true, "Receive a sourceopen event"); + var audiosb = ms.addSourceBuffer("audio/mp4"); + el.addEventListener("error", function(e) { + ok(false, "should not fire '" + e.type + "' event"); + SimpleTest.finish(); + }); + is(el.readyState, el.HAVE_NOTHING, "readyState is HAVE_NOTHING"); + fetchAndLoad(audiosb, 'aac20-48000-64000-', ['init'], '.mp4') + .then(once.bind(null, el, 'loadedmetadata')) + .then(function() { + ok(true, "got loadedmetadata event"); + var promises = []; + promises.push(once(el, 'loadeddata')); + promises.push(once(el, 'canplay')); + promises.push(fetchAndLoad(audiosb, 'aac20-48000-64000-', ['1'], '.m4s')); + return Promise.all(promises); + }) + .then(function() { + ok(true, "got canplay event"); + el.play(); + return fetchAndLoad(audiosb, 'aac51-48000-128000-', ['init'], '.mp4'); + }) + .then(fetchAndLoad.bind(null, audiosb, 'aac51-48000-128000-', ['2'], '.m4s')) + .then(function() { + var promises = []; + ms.endOfStream(); + promises.push(once(el, 'ended')); + promises.push(once(audiosb, 'updateend')); + return Promise.all(promises); + }) + .then(function() { + ok(el.currentTime >= 6, "played to the end"); + SimpleTest.finish(); + }) + }); +}); + +</script> +</pre> +</body> +</html> |