English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Quando adicionamos esses tags de áudio e vídeo à página, percebemos que não há arquivos de áudio na página e os arquivos de vídeo também não podem ser reproduzidos. Por que isso acontece? Isso acontece porque nos falta alguns elementos de mídia. Abaixo está uma lista de alguns elementos de mídia
HTML5 O DOM fornece métodos, propriedades e eventos para elementos <audio> e <video>.
esses métodos, propriedades e eventos permitem que você use JavaScript para manipular elementos <audio> e <video>.
método | Description |
addTextTrack() | Para o áudio/Adicionar uma nova faixa de texto ao vídeo. |
canPlayType() | Detectar se o navegador pode reproduzir o áudio especificado/tipo de vídeo. |
load() | Recarregar o áudio/elemento de vídeo. |
play() | Iniciar a reprodução de áudio/video |
pause() | Pausar a reprodução de áudio atual/video |
propriedade | Description |
audioTracks | Retorna um objeto AudioTrackList que representa as faixas de áudio disponíveis. |
autoplay | Set or return whether to play the audio immediately after loading is complete/video |
buffered | Returns the audio/TimeRanges object representing the buffered part of the video. |
controller | Returns the audio/The MediaController object representing the current media controller of the video. |
controls | Set or return the audio/Whether the video controls are displayed (such as play/(such as pause, etc.). |
crossOrigin | Set or return the audio/The CORS settings of the video. |
currentSrc | Returns the current audio/The URL of the video. |
currentTime | Set or return the audio/The current playback position in the video (in seconds). |
defaultMuted | Set or return the audio/Whether the video is muted by default. |
defaultPlaybackRate | Set or return the audio/The default playback speed of the video. |
duration | Returns the current audio/The length of the video (in seconds). |
ended | Returns the audio/Whether the video playback has ended. |
error | Returns the audio/The MediaError object representing the video error state. |
loop | Set or return the audio/Whether the video should be replayed at the end. |
mediaGroup | Set or return the audio/The group to which the video belongs (used to connect multiple audio/The video element). |
muted | Set or return the audio/Whether the video is muted. |
networkState | Returns the audio/The current network state of the video. |
paused | Set or return the audio/Whether the video is paused. |
playbackRate | Set or return the audio/The playback speed of the video. |
played | Returns the audio/TimeRanges object representing the part of the video that has been played. |
preload | Set or return the audio/Whether the video should be loaded after the page is loaded. |
readyState | Returns the audio/The current ready state of the video. |
seekable | Returns the audio/TimeRanges object representing the addressable parts of the video. |
seeking | Returns whether the user is on the audio/Search within the video. |
src | Set or return the audio/The current source of the video element. |
startDate | Returns the Date object representing the current time offset. |
textTracks | Returns the TextTrackList object representing the available text tracks. |
videoTracks | Returns the VideoTrackList object representing the available video tracks. |
volume | Set or return the audio/The volume of the video. |
Event | Description |
abort | Quando o áudio/Triggered when the loading of the video is aborted. |
canplay | Triggered when the browser can start playing audio./do vídeo é acionado. |
canplaythrough | Triggered when the browser can play without stopping due to buffering. |
durationchange | Quando o áudio/Triggered when the duration of the video has changed. |
emptied | Triggered when the current playlist is empty. |
ended | When the current playlist ends. |
error | /Quando no áudio |
É acionado quando ocorre um erro durante o carregamento do vídeo. | Quando o navegador já carregou o áudio/É acionado quando o frame atual do vídeo é carregado. |
loadedmetadata | Quando o navegador já carregou o áudio/É acionado quando os metadados do vídeo são carregados. |
loadstart | É acionado quando o navegador começa a procurar o áudio/do vídeo é acionado. |
pause | Quando o áudio/É acionado quando o vídeo é pausado. |
play | Quando o áudio/É acionado quando o vídeo começa ou deixa de pausar. |
playing | Quando o áudio/É acionado quando o vídeo está pronto após ter sido pausado ou parado por carregamento. |
progress | É acionado quando o navegador está baixando o áudio/do vídeo é acionado. |
ratechange | Quando o áudio/É acionado quando a velocidade de reprodução do vídeo é alterada. |
seeked | É acionado quando o usuário já se moveu/Saltar para o áudio/É acionado quando uma nova posição no vídeo é alcançada. |
seeking | É acionado quando o usuário começa a mover/Saltar para o áudio/É acionado quando uma nova posição no vídeo é alcançada. |
stalled | É acionado quando o navegador tenta obter dados de mídia, mas os dados não estão disponíveis. |
suspend | É acionado quando o navegador deliberadamente não obtém dados de mídia. |
timeupdate | É acionado quando a posição de reprodução atual é alterada. |
volumechange | É acionado quando o volume é alterado. |
waiting | É acionado quando o vídeo pára devido à necessidade de carregar o próximo frame. |