summaryrefslogtreecommitdiffstats
path: root/dom/media/mediasource/test/test_SeekedEvent_mp4.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /dom/media/mediasource/test/test_SeekedEvent_mp4.html
parentInitial commit. (diff)
downloadfirefox-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_SeekedEvent_mp4.html')
-rw-r--r--dom/media/mediasource/test/test_SeekedEvent_mp4.html48
1 files changed, 48 insertions, 0 deletions
diff --git a/dom/media/mediasource/test/test_SeekedEvent_mp4.html b/dom/media/mediasource/test/test_SeekedEvent_mp4.html
new file mode 100644
index 0000000000..70401f1eb1
--- /dev/null
+++ b/dom/media/mediasource/test/test_SeekedEvent_mp4.html
@@ -0,0 +1,48 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>MSE: Check that seeked event is fired prior loadeddata</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;
+ const events = ["seeked", "loadeddata", "playing"];
+ let eventCount = 0;
+ events.forEach(type => el.addEventListener(type,
+ () => is(events[eventCount++], type, "events must come in order")));
+ 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;
+ el.play();
+ videosb.timestampOffset = 2;
+ is(el.readyState, el.HAVE_METADATA, "readyState is HAVE_METADATA");
+ // Load [2, 3.606).
+ p = once(el, "play");
+ await fetchAndLoad(videosb, "bipbop/bipbop_video", ["1"], ".m4s");
+ await p;
+ await fetchAndLoad(videosb, "bipbop/bipbop_video", ["2"], ".m4s");
+ // TODO: readyState should be at least HAVE_CURRENTDATA, see bug 1367993.
+ ok(el.readyState >= el.HAVE_METADATA, "readyState is HAVE_METADATA");
+ el.currentTime = 2;
+ await Promise.all([once(el, "seeked"), once(el, "playing")]);
+ ok(true, "completed seek");
+ is(eventCount, events.length, "Received expected number of events");
+ SimpleTest.finish();
+});
+
+</script>
+</pre>
+</body>
+</html>