Tag <track> HTML
Contoh
Video dengan trek subtitle untuk dua bahasa:
<video width="320" height="240" controls>
<source src="forrest_gump.mp4" type="video/mp4">
<source src="forrest_gump.ogg" type="video/ogg">
<track src="fgsubtitles_en.vtt" kind="subtitles" srclang="en" label="English">
<track src="fgsubtitles_no.vtt" kind="subtitles" srclang="no" label="Norwegian">
</video>
Definisi dan Penggunaan
Tag <track>
menentukan trek teks untuk
elemen <audio> atau <video> .
Elemen ini digunakan untuk menentukan subtitle, file teks atau file lain yang berisi teks, yang harus terlihat saat media diputar.
Trek diformat dalam format WebVTT (file .vtt).
Dukungan Peramban
Angka-angka dalam tabel menentukan versi browser pertama yang sepenuhnya mendukung elemen tersebut.
Element | |||||
---|---|---|---|---|---|
<track> | 23.0 | 10.0 | 31.0 | 6.0 | 12.1 |
Atribut Opsional
Attribute | Value | Description |
---|---|---|
default | default | Specifies that the track is to be enabled if the user's preferences do not indicate that another track would be more appropriate |
kind | captions chapters descriptions metadata subtitles |
Specifies the kind of text track |
label | text | Specifies the title of the text track |
src | URL | Required. Specifies the URL of the track file |
srclang | language_code | Specifies the language of the track text data (required if kind="subtitles") |
Atribut Global
Tag <track>
juga mendukung Atribut Global dalam HTML .
Atribut Acara
Tag <track>
juga mendukung Atribut Peristiwa dalam HTML .
Halaman Terkait
Tutorial HTML: Video HTML
Tutorial HTML: Audio HTML
Referensi DOM HTML: Objek Lacak
Pengaturan CSS Default
Tidak ada.