ข้อมูลอ้างอิงHTML

HTML โดยตัวอักษร HTML ตามหมวดหมู่ รองรับ HTML Browser แอตทริบิวต์ HTML HTML Global Attributes เหตุการณ์ HTML HTML สี HTML Canvas HTML เสียง/วิดีโอ ชุดอักขระ HTML HTML Doctypes การเข้ารหัส URL HTML รหัสภาษา HTML รหัสประเทศ HTML ข้อความ HTTP วิธี HTTP ตัวแปลง PX เป็น EM แป้นพิมพ์ลัด


HTML Audio/Video DOM videoTracksคุณสมบัติ

❮ การอ้างอิง DOM เสียง/วิดีโอ HTML

ตัวอย่าง

รับจำนวนแทร็กวิดีโอที่มี:

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

ความหมายและการใช้งาน

คุณสมบัติ videoTracks ส่งกลับวัตถุ VideoTrackList

ออบเจ็กต์ VideoTrackList แสดงถึงแทร็กวิดีโอที่มีให้สำหรับวิดีโอ

แทร็กวิดีโอที่มีอยู่แต่ละรายการจะแสดงด้วยออบเจ็กต์ VideoTrack


รองรับเบราว์เซอร์

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

ไวยากรณ์

video.videoTracks

คืนมูลค่า

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)

❮ การอ้างอิง DOM เสียง/วิดีโอ HTML