Closed carlosapaduarte closed 6 months ago
While building the Alfa semi-automated implementation, I had mixed result with that… Sometimes the media did autoplay (often when opening the example from the rule page), sometimes it didn't (often when entering the URL directly). I was also going to open such an issue, but more attempts show that stuff did autoplay sometimes 😖 And I'm not sure when exactly (this may also depend on devtools being open or not, on headset being connected or not, … 🙃 ) Tried both with Chrome and Firefox (on Windows 10).
I'll check support for audio autoplay and for scripted auto-play and report back here
I've run the tests. Results are the same for audio
and video
elements with audio content.
Although the term "autoplay" is usually thought of as referring to pages that immediately begin playing media upon being loaded, web browsers' autoplay policies also apply to any script-initiated playback of media, including calls to
play()
. (…) Note: Theplay()
method may cause the user to be asked to grant permission to play the media, resulting in a possible delay before the returned promise is resolved. Be sure your code doesn't expect an immediate response.
And the MDN Autoplay guide states:
As a general rule, you can assume that media will be allowed to autoplay only if at least one of the following is true:
- The audio is muted or its volume is set to 0
- The user has interacted with the site (by clicking, tapping, pressing keys, etc.)
- If the site has been allowlisted; this may happen either automatically if the browser determines that the user engages with media frequently, or manually through preferences or other user interface features
- If the autoplay Permissions Policy is used to grant autoplay support to an and its document.
So it does feel like modern UA are more or less solving the problem 🤔
Decision: move 1.4.2 as a secondary requirement since autoplay
is possibly a WCAG failure, but not always.
https://github.com/act-rules/act-rules.github.io/pull/1655#discussion_r1098674794 raises the issue about the failed example not working in Chromium browsers. A quick test reveals that the same happens in Firefox and Safari.
The way I see it, we have two choices: