diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /dom/media/mediasource/test/test_LoadedDataFired_mp4.html | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/media/mediasource/test/test_LoadedDataFired_mp4.html')
-rw-r--r-- | dom/media/mediasource/test/test_LoadedDataFired_mp4.html | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/dom/media/mediasource/test/test_LoadedDataFired_mp4.html b/dom/media/mediasource/test/test_LoadedDataFired_mp4.html new file mode 100644 index 0000000000..476303d4fd --- /dev/null +++ b/dom/media/mediasource/test/test_LoadedDataFired_mp4.html @@ -0,0 +1,57 @@ +<!DOCTYPE HTML> +<html> +<head> + <title>MSE: Check that playback only starts once we have data at time = 0</title> + <script 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(async (ms, el) => { + el.controls = true; + el.addEventListener("loadeddata", () => { + ok(el.buffered.length, "data is buffered"); + is(el.buffered.start(0), 0, "must fire loadeddata when data has been loaded"); + is(el.currentTime, 0, "must fire loadeddata at start"); + }); + el.addEventListener("playing", () => { + ok(el.buffered.length, "data is buffered"); + is(el.buffered.start(0), 0, "must fire playing when data has been loaded"); + ok(el.currentTime >= 0, "must have started playback"); + }); + await once(ms, "sourceopen"); + ok(true, "Receive a sourceopen event"); + const videosb = ms.addSourceBuffer("video/mp4"); + is(el.readyState, el.HAVE_NOTHING, "readyState is HAVE_NOTHING"); + let p = once(el, "loadedmetadata"); + await fetchAndLoad(videosb, "bipbop/bipbop_video", ["init"], ".mp4"); + await p; + videosb.appendWindowStart = 2; + videosb.appendWindowEnd = 4; + is(el.readyState, el.HAVE_METADATA, "readyState is HAVE_METADATA"); + // Load [2.4, 3.968344). 2.4 as it's the first keyframe after 2s and + // 3.968344 as the last frame ends after 4s. + await fetchAndLoad(videosb, "bipbop/bipbop_video", range(1, 8), ".m4s"); + is(el.readyState, el.HAVE_METADATA, "readyState is HAVE_METADATA"); + // test that appendWindowEnd did its job. + ok(el.buffered.start(0) >= 2, "no data can be found prior appendWindowStart"); + ok(el.buffered.end(el.buffered.length - 1) <= 4, "no data can be found beyond appendWindowEnd"); + el.play(); + await once(el, "play"); + videosb.appendWindowStart = 0; + p = once(el, "playing"); + await fetchAndLoad(videosb, "bipbop/bipbop_video", range(1, 8), ".m4s"); + await p; + ok(true, "playing"); + SimpleTest.finish(); +}); + +</script> +</pre> +</body> +</html> |