diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /dom/media/mediasource/test/test_WaitingOnMissingDataEnded_mp4.html | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/media/mediasource/test/test_WaitingOnMissingDataEnded_mp4.html')
-rw-r--r-- | dom/media/mediasource/test/test_WaitingOnMissingDataEnded_mp4.html | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/dom/media/mediasource/test/test_WaitingOnMissingDataEnded_mp4.html b/dom/media/mediasource/test/test_WaitingOnMissingDataEnded_mp4.html new file mode 100644 index 0000000000..8ca61eae7e --- /dev/null +++ b/dom/media/mediasource/test/test_WaitingOnMissingDataEnded_mp4.html @@ -0,0 +1,47 @@ +<!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 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; + await once(ms, "sourceopen"); + ok(true, "Receive a sourceopen event"); + el.addEventListener("ended", () => { + ok(false, "ended should never fire"); + SimpleTest.finish(); + }); + const videosb = ms.addSourceBuffer("video/mp4"); + await fetchAndLoad(videosb, "bipbop/bipbop_video", ["init"], ".mp4"); + await fetchAndLoad(videosb, "bipbop/bipbop_video", range(1, 5), ".m4s"); + await fetchAndLoad(videosb, "bipbop/bipbop_video", range(6, 8), ".m4s"); + is(el.buffered.length, 2, "discontinuous buffered range"); + ms.endOfStream(); + await Promise.all([once(el, "durationchange"), once(ms, "sourceended")]); + // 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()"); + el.play(); + await once(el, "playing"); + ok(true, "Video playing. It should play for a bit, then fire 'waiting'"); + await once(el, "waiting"); + // waiting is fired when we start to play the last frame. + // 0.033334 is the duration of the last frame, + 0.000001 of fuzz. + // the next video frame, currentTime can be up to 1 frame's worth earlier than end of video. + isfuzzy(el.currentTime, videosb.buffered.end(0), 0.033334, "waiting was fired on gap"); + SimpleTest.finish(); +}); + +</script> +</pre> +</body> +</html> |