no-autoplay-audio
Ensure that audio or video elements are not played automatically on a webpage for more than three seconds.
Description
When an audio component plays automatically in a webpage, users of screen readers find it difficult to comprehend the screen reader’s output. The no-autoplay-audio
flags any audio or video (which might include audio) component that plays automatically for more than three seconds.
Success criteria
For this accessibility check to pass, your website, ideally, must not use autoplaying audio or video components. If the autoplay feature is unavoidable, the file should stop playing within three seconds. All audio or video components must have an option to pause, control volume, or stop playing the file.
Example
In the following example, the autoplay
attribute is used to make the video play automatically when the website loads. This approach can cause difficulty for users dependent on screen readers to access the contents of the webpage. Hence, this code snippet breaks the no-autoplay-audio
rule.
In contrast, the following code snippet does not use the autoplay
attribute.
Hence, this code snippet doesn’t break the no-autoplay-audio
rule.
How to fix?
You can follow these options to fix issues if this rule gets flagged:
- Remove the
autoplay
attribute. - Stop autoplaying the file in three seconds and include easy options to stop, control audio, and pause the file.
Reference
- WCAG 1.4.2: Audio Control
- W3C - Audio/Video elements that plays automatically
- WCAG - Audio Controlsl
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
Thank you for your valuable feedback!