Audio audioTracks attribute

Definition and usage

audioTracks The property returns an AudioTrackList object.

The AudioTrackList object represents the available audio tracks of the audio.

Each available audio track is represented by an AudioTrack object.

Example

Getting the number of available audio tracks:

var x = document.getElementById("myAudio").audioTracks.length;

Try it yourself

Syntax

audioObject.audioTracks

Return value

Type Description
AudioTrackList object

Represents the available audio tracks of the audio.

AudioTrackList object:

  • audioTracks.length - Getting the number of available audio tracks
  • audioTracks.getTrackById(id] - Getting the AudioTrack object by id
  • audioTracks[index] - Getting the AudioTrack object by index

Note:The first available AudioTrack object is at index 0

AudioTrack object

Represents the audio track.

AudioTrack object properties:

  • id - Getting the id of the audio track
  • kind - Getting the type of the audio track
  • label - Getting the label of the audio track
  • language - Gibt die Sprache der Spur zurück
  • enabled - Ermöglicht das Abrufen oder Setzen des Status der Spur als aktiv (true|false)

Das Attribut "kind" kann die folgenden Typen sein:

  • "alternative"
  • "description"
  • "main"
  • "translation"
  • "commentary"
  • "" (leere Zeichenkette)

Browserunterstützung

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Nicht unterstützt Nicht unterstützt Nicht unterstützt Nicht unterstützt Nicht unterstützt