Javascript examples for DOM HTML Element:Video
The videoTracks property returns a VideoTrackList object.
The VideoTrackList object represents the available video tracks for the video.
Each available video track is represented by an VideoTrack Object.
Type | Description |
---|---|
VideoTrackList Object | Represents the available video tracks for the video. |
VideoTrack Object | Represents a video track. |
VideoTrackList Object:
The first available VideoTrack object is index 0
VideoTrack Object Properties:
The following code shows how to get the number of available video 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"> Your browser does not support the video tag. </video>//from w w w.j a v a2s .c o m <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() { var x = document.getElementById("myVideo").videoTracks.length; document.getElementById("demo").innerHTML = x; } </script> </body> </html>