SpongeBOB
Well-Known Coder
Hi everyone,
I have followed the guidance of this URL : https://developer.mozilla.org/en-US/docs/Web/HTML/Element/track to add a track (aka subtitle/captions) on a video.
but it's not working here the code of my page:
Quite simple page, so wen I click the button "mode" I see "showing" meaning that the track should appear..
The TTS file come from developer.mozilla.org... Friday.vtt
Weird as on https://developer.mozilla.org/en-US/docs/Web/HTML/Element/track it work ! what the difference ?
Thanks.
I have followed the guidance of this URL : https://developer.mozilla.org/en-US/docs/Web/HTML/Element/track to add a track (aka subtitle/captions) on a video.
but it's not working here the code of my page:
HTML:
<!doctype html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<title>test video</title>
<body>
<video id="mylittlevdo" controls >
<source src="test.mp4" type="video/mp4"> <!-- place and rename as test.mp4 an mp4 video in the same folder -->
<track kind="subtitles" src="test.vtt" srclang="en" id="sub1" default />Your browser does not support the video tag.</video><br>
<script>
var vid = document.getElementById("mylittlevdo");
function myFunction() {
alert(vid.textTracks[0].mode);
}
</script>
<br>
<button onclick="myFunction()" type="button">mode</button><br>
</body>
</html>
Quite simple page, so wen I click the button "mode" I see "showing" meaning that the track should appear..
The TTS file come from developer.mozilla.org... Friday.vtt
Weird as on https://developer.mozilla.org/en-US/docs/Web/HTML/Element/track it work ! what the difference ?
Thanks.
Last edited: