How do you handle <track>, if video doesn't have any audio at all?

Viewed 29

I bumped into the following a11y error, when I am using <video>:

A11y: <video> elements must have a <track kind="captions">

But the video I have there doesn't have any audio. I am using that as a gif alternative, as it is much smaller in size. As the <track> is used for describing the audio, how should I handle this warning?

1 Answers

You can ignore the error. Make sure there's a description of the video for the visually impaired, however.

That's what the W3 does in one of its "passed" examples:

This video element, which has no audio, has a text transcript available on the same page. Thus, it passes rule Video Element Visual-Only Content Has Transcript.

<html lang="en">
<video controls>
  <source src="/test-assets/rabbit-video/silent.mp4" type="video/mp4"></source>
  <source src="/test-assets/rabbit-video/silent.webm" type="video/webm"></source>
</video>
<p>The above video shows a giant fat rabbit climbing out of a hole in the ground.
He stretches, yawns, and then starts walking.
Then he stops to scratch his bottom.</p>
</html>
Related