Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /infrastructure/assumptions/allowed-to-play.html - WPT Dashboard Interop Dashboard
<!doctype html>
<title><audio and <video> autoplay</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/media.js"></script>
<video></video>
<script>
async_test(t => {
const a = new Audio(getAudioURI("/media/sound_5"));
a.play();
assert_false(a.paused);
a.onplaying = t.step_func_done();
}, "<audio> autoplay");
async_test(t => {
const v = document.querySelector("video");
v.src = getVideoURI("/media/movie_5");
v.play();
assert_false(v.paused);
v.onplaying = t.step_func_done();
}, "<video> autoplay");
</script>