Skip to main content

no-autoplay-audio

Ensure that audio or video elements are not played automatically on a webpage for more than three seconds.

Severity: Moderate

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.

Incorrect sample - autoplay
Copy icon Copy snippet

In contrast, the following code snippet does not use the autoplay attribute.

Hence, this code snippet doesn’t break the no-autoplay-audio rule.

Correct sample - no autoplay
Copy icon Copy snippet

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

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

Is this page helping you?

Yes
No

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!

Talk to an Expert
Download Copy