Video src Property
Example
Change the URL of a video:
document.getElementById("myVideo").src = "mov_bbb.ogg";
Try it Yourself »
Definition and Usage
The src property sets or returns the value of the src attribute of a video.
The src attribute specifies the location (URL) of the video file.
Browser Support
The src property is supported in all major browsers. However, the file format defined may not be supported in all browsers.
Note: Internet Explorer 8 and earlier versions, do not support the <video> element.
Syntax
Return the src property:
videoObject.src
Set the src property:
videoObject.src=URL
Property Values
Value | Description |
---|---|
URL |
Specifies the URL of the video file. Possible values:
|
Technical Details
Return Value: | A String, representing the URL of the video file. Returns the entire URL, including the protocol (like http://) |
---|
More Examples
Example
Get the URL of a video:
var x = document.getElementById("myVideo").src;
The result of x will be:
http://www.w3schools.com/jsref/movie.ogg
Try it Yourself »
Related Pages
HTML reference: HTML <video> src attribute
Video Object