Tests: Add a test for media element ready state progression

This commit is contained in:
Zaggy1024
2026-03-20 20:23:08 -05:00
committed by Gregory Bertilson
parent cf3d9c1bae
commit 041213a597
Notes: github-actions[bot] 2026-03-22 04:14:19 +00:00
2 changed files with 31 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
<!DOCTYPE html>
<script src="../include.js"></script>
<video id="video"></video>
<script>
const video = document.getElementById("video");
function logEvent(name) {
let entry = `${name}: readyState=${video.readyState}`;
if (name === "durationchange")
entry += ` duration=${video.duration}`;
println(entry);
}
for (const name of [
"loadstart", "durationchange", "loadedmetadata",
"loadeddata", "canplay", "canplaythrough",
]) {
video.addEventListener(name, () => logEvent(name));
}
asyncTest(done => {
video.addEventListener("canplaythrough", () => done());
video.src = "../../../Assets/test-webm.webm";
});
</script>