Latest web development tutorials

HTML DOM 오디오 audioTracks 속성

오디오 객체 참조 오디오 객체

가능한 오디오 트랙 수를 얻을 :

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

»시도

정의 및 사용

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

반환 사용할 수 AudioTrackList 객체 오디오 트랙 레일.

각 오디오 트랙 레일은 AudioTrack 개체를 나타냅니다.


브라우저 지원

Internet ExplorerFirefoxOperaGoogle ChromeSafari

모든 주요 브라우저는 audioTracks 속성을 지원하지 않습니다.


문법

audioObject .audioTracks

반환 값

类型 描述
AudioTrackList 对象 表示audio的可用音频轨道。

AudioTrackList 对象:

  • audioTracks.length - 获取可用的音频轨道数
  • audioTracks.getTrackById( id ) - 通过 id 获取AudioTrack 对象
  • audioTracks[ index ] - 通过索引获取 AudioTrack 对象

注意: index ) 0 代表第一个可用的 AudioTrack 对象。

AudioTrack 对象 表示音频轨道。

AudioTrack 对象属性:

  • id - 获取音频轨道的 id
  • kind - 获取音频轨道的类型 (可以是: "alternative", "description", "main", "translation", "commentary", 或"" (空字符串))
  • label - 获取音频轨道的标签
  • language -获取音频轨道的语言
  • enabled - 获取或设置轨道是否激活 (true|false)


오디오 객체 참조 오디오 객체