HTML Audio / Video DOM addTextTrack Method () Method

❮ Tham chiếu DOM Audio / Video HTML

Thí dụ

Thêm một đoạn văn bản mới vào video:

var text1 = myVid.addTextTrack("caption");
text1.addCue(new TextTrackCue("Test text", 01.000, 04.000, "", "", "", true));

Định nghĩa và Cách sử dụng

Phương thức addTextTrack () tạo và trả về một đối tượng TextTrack mới.

Đối tượng TextTrack mới được thêm vào danh sách các rãnh văn bản cho phần tử âm thanh / video.


Hỗ trợ trình duyệt

Method
addTextTrack() Not supported Not supported Not supported Not supported Not supported

Cú pháp

audio|video.addTextTrack(kind,label,language)

Giá trị tham số

Value Description
kind Specifies the kind of text track.

Possible values:

  • "subtitles"
  • "caption"
  • "descriptions"
  • "chapters"
  •  "metadata"
label A string specifying the label for the text track. Is used to identify the text track for the users
language A two-letter language code that specifies the language of the text track.
To view all available language codes, go to our Language code reference

Chi tiết kỹ thuật

Giá trị trả lại: Đối tượng TextTrack, đại diện cho đoạn văn bản mới

❮ Tham chiếu DOM Audio / Video HTML