HTML-Audio/Video-DOM -videoTracks- Eigenschaft

❮ HTML-Audio/Video-DOM-Referenz

Beispiel

Rufen Sie die Anzahl der verfügbaren Videospuren ab:

var vid = document.getElementById("myVideo");
alert(vid.videoTracks.length);

Definition und Verwendung

Die videoTracks-Eigenschaft gibt ein VideoTrackList-Objekt zurück.

Das VideoTrackList-Objekt stellt die verfügbaren Videospuren für das Video dar.

Jede verfügbare Videospur wird durch ein VideoTrack-Objekt repräsentiert.


Browser-Unterstützung

Property
videoTracks Not supported Not supported Not supported Not supported Not supported

Syntax

video.videoTracks

Rückgabewert

Type Description
VideoTrackList Object Represents the available video tracks for the video.

VideoTrackList Object:

  • videoTracks.length - get the number of video tracks available in the video
  • videoTracks.getTrackById(id) - get VideoTrack object by id
  • videoTracks[index] - get VideoTrack object by index
  • videoTracks.selectedIndex - get the index of the current VideoTrack object

Note: The first available VideoTrack object is index 0

VideoTrack Object Represents a video track.

VideoTrack Object Properties:

  • id - get the id of the video track
  • kind - get the type of the video track (can be: "alternative", "captions", "main", "sign", "subtitles", "commentary", or "" (empty string)) 
  • label - get the label of the video track
  • language - get the language of the video track
  • selected - get or set if the track is active (true|false)

❮ HTML-Audio/Video-DOM-Referenz