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

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

예시

사용 가능한 텍스트 트랙의 수를 가져옵니다.

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

정의 및 사용

textTracks 속성은 TextTrackList 객체를 반환합니다.

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

사용 가능한 각 텍스트 트랙은 TextTrack 개체로 표시됩니다.


브라우저 지원

표의 숫자는 속성을 완전히 지원하는 첫 번째 브라우저 버전을 지정합니다.

Property
textTracks Yes 10.0 33.0 6.0 Yes

통사론

audio|video.textTracks

반환 값

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

TextioTrackList Object:

  • length - get the number of text tracks available in the audio/video
  • [index] - get TextTrack object by index

Note: The first available TextTrack object is index 0

TextTrack Object Represents an text track.

TextTrack Object Properties:

  • kind - get the type of the text track (can be: "subtitles", "caption", "descriptions", "chapters", or "metadata")
  • label - get the label of the text track
  • language - get the language of the text track
  • mode - get or set if the track is active ("disabled"|"hidden"|"showing")
  • cues - get a list of cues as a TextTrackCueList object
  • activeCues - get the currently active text track cues as a TextTrackCueList object
  • addCue(cue) - add a cue to the list of cues
  • removeCue(cue) - remove a cue from the list of cues

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