Metodo HTML Audio/Video DOM addTextTrack()

❮ Riferimento DOM audio/video HTML

Esempio

Aggiungi una nuova traccia di testo al video:

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

Definizione e utilizzo

Il metodo addTextTrack() crea e restituisce un nuovo oggetto TextTrack.

Il nuovo oggetto TextTrack viene aggiunto all'elenco delle tracce di testo per l'elemento audio/video.


Supporto browser

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

Sintassi

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

Valori dei parametri

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

Dettagli tecnici

Valore di ritorno: Un oggetto TextTrack, che rappresenta la nuova traccia di testo

❮ Riferimento DOM audio/video HTML