HTML 오디오/비디오 DOM audioTracks 속성

❮ HTML 오디오/비디오 DOM 참조

예시

사용 가능한 오디오 트랙 수 가져오기:

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

정의 및 사용

audioTracks 속성은 AudioTrackList 개체를 반환합니다.

AudioTrackList 객체는 오디오/비디오에 사용 가능한 오디오 트랙을 나타냅니다.

사용 가능한 각 오디오 트랙은 AudioTrack 개체로 표시됩니다.


브라우저 지원

Property
audioTracks Not supported 11 Not supported Not supported Not supported

통사론

audio|video.audioTracks

반환 값

Type Description
AudioTrackList Object Represents the available audio tracks for the audio/video.

AudioTrackList Object:

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

Note: The first available AudioTrack object is index 0

AudioTrack Object Represents an audio track.

AudioTrack Object Properties:

  • id - get the id of the audio track
  • kind - get the type of the audio track (can be: "alternative", "description", "main", "translation", "commentary", or "" (empty string)) 
  • label - get the label of the audio track
  • language - get the language of the audio track
  • enabled - get or set if the track is active (true|false)

❮ HTML 오디오/비디오 DOM 참조