Tag HTML <faixa>
Exemplo
Um vídeo com faixas de legendas para dois idiomas:
<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>
Definição e uso
A <track>
tag especifica faixas de texto para
elementos <audio> ou <video>
.
Este elemento é usado para especificar legendas, arquivos de legendas ou outros arquivos contendo texto, que devem estar visíveis quando a mídia estiver sendo reproduzida.
As faixas são formatadas no formato WebVTT (arquivos .vtt).
Suporte ao navegador
Os números na tabela especificam a primeira versão do navegador que suporta totalmente o elemento.
Element | |||||
---|---|---|---|---|---|
<track> | 23.0 | 10.0 | 31.0 | 6.0 | 12.1 |
Atributos Opcionais
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") |
Atributos Globais
A <track>
tag também suporta os Atributos Globais em HTML .
Atributos do evento
A <track>
tag também suporta os atributos de evento em HTML .
Páginas relacionadas
Tutorial HTML: Vídeo HTML
Tutorial HTML: Áudio HTML
Referência HTML DOM: Rastrear objeto
Configurações padrão de CSS
Nenhum.