HTML Audio/Video DOM src Property
Example
var vid = document.getElementById("myVideo");
function myFunction() {
isSupp = vid.canPlayType("video/mp4");
if (isSupp == "") {
vid.src = "video.mp4";
} else {
vid.src = "video.webm";
}
vid.load();
}
Meaning
The src property sets or returns the current source of the audio/video.
Return a String, representing the URL of the audio/video file.
Returns the entire URL, including the protocol (like http://).
Standard Syntax
Return the src property:
audio|video.src
Set the src property:
audio|video.src="URL"
Advertisement
Property Value
| Type | Description |
|---|---|
| url | Value can be
|