Tag HTML <traccia>
Esempio
Un video con tracce di sottotitoli per due lingue:
<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>
Definizione e utilizzo
Il <track>
tag specifica tracce di testo per
gli elementi <audio> o <video>
.
Questo elemento viene utilizzato per specificare sottotitoli, file di sottotitoli o altri file contenenti testo, che dovrebbero essere visibili durante la riproduzione del supporto.
Le tracce sono formattate in formato WebVTT (file .vtt).
Supporto browser
I numeri nella tabella specificano la prima versione del browser che supporta completamente l'elemento.
Element | |||||
---|---|---|---|---|---|
<track> | 23.0 | 10.0 | 31.0 | 6.0 | 12.1 |
Attributi opzionali
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") |
Attributi globali
Il <track>
tag supporta anche gli attributi globali in HTML .
Attributi dell'evento
Il <track>
tag supporta anche gli attributi dell'evento in HTML .
Pagine correlate
Esercitazione HTML: Video HTML
Esercitazione HTML: Audio HTML
Riferimento HTML DOM: Track Object
Impostazioni CSS predefinite
Nessuno.