act-rules / act-rules.github.io

Accessibility conformance testing rules for HTML
https://act-rules.github.io/
Other
136 stars 68 forks source link

autoplay rule [x0paj4] failed examples don't autoplay in major browsers #2030

Closed carlosapaduarte closed 6 months ago

carlosapaduarte commented 1 year ago

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:

Jym77 commented 1 year 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).

carlosapaduarte commented 1 year ago

I'll check support for audio autoplay and for scripted auto-play and report back here

carlosapaduarte commented 1 year ago

I've run the tests. Results are the same for audio and video elements with audio content.

Autoplay

Scripted autoplay

Jym77 commented 1 year ago

MDN usage note on play():

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: The play() 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: