About This Accessibility Rule
When a <video> or <audio> element plays sound automatically, it competes with assistive technology output. Screen reader users rely on hearing their screen reader’s spoken output to navigate and interact with web content. If background audio starts playing as soon as they land on a page, it can drown out the screen reader, making it difficult or impossible to find and operate the very control needed to stop the unwanted sound. This creates a frustrating catch-22: the user needs to hear their screen reader to find the stop button, but the auto-playing audio prevents them from hearing the screen reader.
People with cognitive disabilities can also be significantly affected, as unexpected audio can be disorienting, distracting, and make it harder to process page content.
Related WCAG Success Criteria
This rule maps to WCAG Success Criterion 1.4.2: Audio Control (Level A), which requires that if any audio on a web page plays automatically for more than three seconds, either a mechanism is available to pause or stop the audio, or a mechanism is available to control audio volume independently from the overall system volume level. This is a Level A requirement, meaning it is considered a minimum baseline for accessibility across WCAG 2.0, 2.1, and 2.2.
How to Fix the Problem
Use one of the following approaches:
-
Don’t autoplay audio (strongly preferred). Let the user initiate playback themselves. This is the best approach because it gives users full control and avoids any interference with assistive technology.
-
Keep auto-playing audio under three seconds. If the audio stops within three seconds and does not loop, it is unlikely to significantly disrupt screen reader usage.
-
Provide an accessible control mechanism. If audio must autoplay for more than three seconds, include a clearly visible, keyboard-accessible control near the top of the page that allows users to pause, stop, or mute the audio. The control must be reachable before the user needs to navigate through a lot of content.
Important Considerations
-
The
controlsattribute on<audio>and<video>elements satisfies the requirement for a control mechanism, as it provides built-in browser controls for play, pause, and volume. -
A short audio clip that uses the
loopattribute will effectively play indefinitely, so it fails this rule even if the source file is under three seconds. - Custom controls must be keyboard accessible and properly labeled for screen readers.
Examples
Failing: Autoplay with no controls
This <audio> element autoplays and provides no way for the user to stop or mute it:
<audio autoplay src="background-music.mp3">
</audio>
Failing: Short audio that loops indefinitely
Even though the audio file is under three seconds, the loop attribute causes it to repeat forever:
<audio autoplay loop src="chime.mp3">
</audio>
Failing: Video with autoplay and no controls
<video autoplay src="promo.mp4">
</video>
Passing: Autoplay with built-in controls
Adding the controls attribute gives users the ability to pause, stop, and adjust volume:
<audio autoplay controls src="background-music.mp3">
</audio>
<video autoplay controls src="promo.mp4">
</video>
Passing: No autoplay — user initiates playback
The best approach is to let the user decide when to start playback:
<audio controls src="background-music.mp3">
</audio>
Passing: Autoplay with short duration and no loop
If the audio is under three seconds and does not loop, it is acceptable:
<video autoplay src="short-intro.mp4">
</video>
Passing: Autoplay with a custom accessible mute button
If you cannot use the native controls attribute, provide a custom control that is keyboard accessible and labeled:
<audio id="bg-audio" autoplay src="background-music.mp3">
</audio>
<button type="button" onclick="document.getElementById('bg-audio').pause()">
Pause background audio
</button>
How the Rule Works
The axe-core rule no-autoplay-audio evaluates <audio> and <video> elements and checks whether they autoplay audio for more than three seconds without a control mechanism. Specifically:
- If the element has no source, the result is incomplete (duration cannot be determined).
- If the element can autoplay and has no controls mechanism, it fails.
- If the element plays under three seconds but loops, it fails (because the effective duration is infinite).
- If the element can autoplay but has a controls mechanism, it passes.
- If the element can autoplay and the duration is under three seconds (without looping), it passes.
Learn more:
Help us improve our guides
Detect accessibility issues automatically
Rocket Validator scans thousands of pages with Axe Core and the W3C Validator, finding accessibility issues across your entire site.