Avoid Media Autoplay
ID |
html.media_autoplay |
Severity |
info |
Remediation Complexity |
low |
Remediation Risk |
low |
Remediation Effort |
low |
Resource |
Code Smell |
Language |
Html |
Tags |
accessibility, code_smell |
Rationale
Media that starts playing on its own can be disorienting: it competes with screen-reader output, surprises the user with unexpected sound, and consumes bandwidth before the user has decided they want the content. Letting the user start playback explicitly is friendlier and meets the WCAG audio-control expectation.
<video autoplay></video> <!-- FLAW — starts on its own -->
<video controls></video> <!-- OK — user starts playback -->
Remediation
Remove the autoplay attribute and let the user start playback, for example by exposing the
native controls. If autoplay is unavoidable, also provide a visible, accessible way to pause or
mute the media.