Tag HTML <vídeo>


Exemplo

Reproduzir um vídeo:

<video width="320" height="240" controls>
  <source src="movie.mp4" type="video/mp4">
  <source src="movie.ogg" type="video/ogg">
  Your browser does not support the video tag.
</video>

Definição e uso

A <video>tag é usada para incorporar conteúdo de vídeo em um documento, como um clipe de filme ou outros fluxos de vídeo.

A <video>tag contém uma ou mais <source>tags com diferentes origens de vídeo. O navegador escolherá a primeira fonte que ele suporta.

O texto entre as tags <video>e </video> só será exibido em navegadores que não suportam o elemento <video>.

Existem três formatos de vídeo suportados em HTML: MP4, WebM e OGG.

Browser MP4 WebM Ogg
Edge YES YES YES
Chrome YES YES YES
Firefox YES YES YES
Safari YES YES NO
Opera YES YES YES

Dicas e Notas

Dica: Para arquivos de áudio, observe a tag. <audio>



Suporte ao navegador

Os números na tabela especificam a primeira versão do navegador que suporta totalmente o elemento.

Element
<video> 4.0 9.0 3.5 3.1 11.5

Atributos Opcionais

Attribute Value Description
autoplay autoplay Specifies that the video will start playing as soon as it is ready
controls controls Specifies that video controls should be displayed (such as a play/pause button etc).
height pixels Sets the height of the video player
loop loop Specifies that the video will start over again, every time it is finished
muted muted Specifies that the audio output of the video should be muted
poster URL Specifies an image to be shown while the video is downloading, or until the user hits the play button
preload auto
metadata
none
Specifies if and how the author thinks the video should be loaded when the page loads
src URL Specifies the URL of the video file
width pixels Sets the width of the video player

Atributos Globais

A <video>tag também suporta os Atributos Globais em HTML .


Atributos do evento

A <video>tag também suporta os atributos de evento em HTML .


Páginas relacionadas

Referência HTML DOM: Referência HTML de áudio/vídeo DOM


Configurações padrão de CSS

Nenhum.