I'm trying to add a text transcription of a spoken audio file with the track tag. The default behavior for the video tag is to display them (works). By default the audio tag seems to lack some sort of 'canvas' (the black area a video tag displays even without video) to display the subtitles automatically. I could use the video tag but it would feel like a ugly workaround. I don't want to break the semantics of my code though.
Is there some kind of CSS to force the display of such area where the subtiles will be displayed?
<audio controls>
<source src="test.ogg" type="audio/ogg">
<source src="test.mp3" type="audio/mpeg">
<track kind="subtitles" label="English subtitles" src="/test.vtt" srclang="en" default></track>
Your browser does not support the audio tag.
</audio>
Thanks you for reading.
kind
attribute to"captions"
. AFAIK"subtitles"
are only for<video>
elements. See here. Also, .vtt files are "Video Text Tracks" and are therefore only for<video>
. – Polite<video>
elements support it. The first rule for the browsers when attempting to render a<track>
with a WebVTTsrc
is as follows: "If the media element is an audio element, or is another playback mechanism with no rendering area, abort these steps." – Polite