ข้อมูลอ้างอิง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 เสียง/วิดีโอ DOM textTracksคุณสมบัติ

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

ตัวอย่าง

รับจำนวนแทร็กข้อความที่มี:

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

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