mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-30 11:37:16 +02:00
This allows audio elements in headless mode to advance their ready states past HAVE_CURRENT_DATA.
31 lines
911 B
HTML
31 lines
911 B
HTML
<!DOCTYPE html>
|
|
<script src="../include.js"></script>
|
|
<audio id="audio"></audio>
|
|
<script>
|
|
asyncTest(done => {
|
|
const audio = document.getElementById("audio");
|
|
|
|
function logEvent(name) {
|
|
let entry = `${name}: readyState=${audio.readyState}`;
|
|
if (name === "durationchange")
|
|
entry += ` duration=${audio.duration}`;
|
|
println(entry);
|
|
}
|
|
|
|
for (const name of [
|
|
"loadstart", "durationchange", "loadedmetadata",
|
|
"loadeddata", "canplay", "canplaythrough",
|
|
"seeking", "seeked",
|
|
]) {
|
|
audio.addEventListener(name, () => logEvent(name));
|
|
}
|
|
|
|
audio.src = "../../../Assets/test-webm-audio.ogg";
|
|
|
|
audio.addEventListener("canplay", () => {
|
|
audio.currentTime = 5;
|
|
audio.addEventListener("seeked", () => done());
|
|
});
|
|
});
|
|
</script>
|