English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The videoTracks property is a read-only property of HTMLMediaElement, it is a VideoTrackList list, which contains the video tracks of the corresponding media element, and the video track is a VideoTrack type object.
HTML Audio/Video DOM Reference Manual
Get the number of available video tracks:
!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>HTML Audio/Usage of video videoTracks attribute-Basic Tutorial(oldtoolbag.com)</<title> </<head> <body> <button onclick="getVideoTracks()" type="button">Get the number of available video tracks</button> <br> <video id="video1" controls="controls"> <source src="movie.mp4" type="video/mp4"> <source src="movie.ogg" type="video/ogg"> Your browser does not support HTML5 video tag. </video> <script> myVid=document.getElementById("video1"); function getVideoTracks() { alert(myVid.videoTracks.length); } </script> </body> </html>Test and see ‹/›
The videoTracks property returns a VideoTrackList object.
The VideoTrackList object represents the available video tracks of the video.
Each available video track is represented by a VideoTrack object.
IEFirefoxOperaChromeSafari
The videoTracks property is not supported by all mainstream browsers.
video.videoTracks
Type | Description |
---|---|
VideoTrackList object | Represents the available video tracks of the video. VideoTrackList object:
Note:The index of the first available VideoTrack object index is 0. |
VideoTrack object | Represents a video track. Properties of VideoTrack object:
|