English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
A propriedade currentSrc contém o caminho absoluto da URL da fonte de mídia selecionada. Por exemplo, quando o programa escolhe diferentes arquivos de mídia com base na resolução da tela do usuário, essa propriedade é usada. Obviamente, ela é apenas leitura. Quando o valor de networkState for EMPTY, o valor dessa propriedade é uma string vazia (empty string).
HTML Audio/Video DOM Reference Manual
Obter a URL atual do vídeo:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Áudio HTML/Uso da propriedade currentSrc do vídeo-Tutorial Básico(oldtoolbag.com)</<title> </<head> <body> <button onclick="getVid()" type="button">Obter a URL atual do vídeo: </button> <br> <video id="video1" controls="controls"> <source src="movie.mp4" type="video/mp4"> <source src="movie.ogg" type="video/ogg"> Seu navegador não suporta HTML5 video tag. </video> <script> myVid=document.getElementById("video1"); function getVid() { alert(myVid.currentSrc); } </script> </body> </html>Test to see ‹/›
The currentSrc property returns the current audio/The URL of the video.
If no audio is set/If a video is not set
Note: This property is read-only.
Tip: Use the src attribute to set the URL of the video file.
IEFirefoxOperaChromeSafari
All major browsers support the currentSrc property.
Note:Internet Explorer 8 and earlier versions do not support this property.
audio|video.currentSrc
Return value: | String value representing the audio/The current URL of the video. |
---|