Javascript examples for DOM HTML Element:Video
The textTracks property returns a TextTrackList object, which represents the available text tracks for the video.
Each available text track is represented by a TextTrack Object.
Type | Description |
---|---|
TextTrackList Object | Represents the available text tracks for the the video. |
TextTrack Object | Represents a text track. |
TextioTrackList Object:
The first available TextTrack object is index 0
TextTrack Object Properties:
The following code shows how to get the number of available text tracks:
<!DOCTYPE html> <html> <body> <video id="myVideo" width="320" height="240" controls> <source src="your.mp4" type="video/mp4"> <source src="your.ogg" type="video/ogg"> <track src="demo_sub.vtt"> Your browser does not support the video tag. </video>/*from ww w.ja va 2s.c o m*/ <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() { var x = document.getElementById("myVideo").textTracks.length; document.getElementById("demo").innerHTML = x; } </script> </body> </html>