-
Notifications
You must be signed in to change notification settings - Fork 2
About `autoplay`
Start playback automatically with the autoplay
attribute:
<audio autoplay src="chapter.mp3">
However, autoplay will be denied if the browser determines the page does not have permission. The browser usually determines this by whether the user interacted with the page first or not.
In our case, the user can be going from chapter to chapter and the playback should be continuous. So after they start playback on one page, the desired behavior is that playback continues automatically as the pages advance, without requiring the user to first interact with the page.
- Server permissions policy, autoplay specified on element: incandescent-naiad
- With no permissions policy, autoplay specified on element: unique pie
- No permissions policy, set autoplay with scripting: grand raindrop
- Automatically load the next page: splendid mooncake
In the case of using a permissions policy, this _headers file was used:
/*
Permissions-Policy: autoplay=*
However, the permissions policy was found to make no difference.
What made a difference was going into each browser's settings and specifically enabling autoplay for each site. After that, every browser tested (Chrome 128, Firefox 129, and Safari 17.6) works with all the examples given here. It is also worth noting that permissions are granted by the browsers on the root domain level, not per-resource.