Video srcProperty
Example
Change the URL of the video:
document.getElementById("myVideo").src = "mov_bbb.ogg";
Try it Yourself »
Definition and Usage
The src attribute sets or returns the value of the src attribute of the video.
The src attribute describes the location (URL) of the video file.
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the src attribute, but not all browsers support the specified file formats.
Note:Internet Explorer 8 and earlier IE versions do not support the <video> element.
Syntax
Return the src attribute:
videoObject.src
Set the src attribute:
videoObject.src=URL
Attribute Values
| Value | Description |
|---|---|
| URL |
Specifies the URL of the video source. Possible values:
|
Technical Details
| Return Value: | A string representing the URL of the video file. Returns the full URL, including the protocol part (such as http://) |
|---|
More Examples
Example
Get the URL of the video:
var x = document.getElementById("myVideo").src;
xThe output result is:
https://www.example.com/jsref/movie.ogg
Try it Yourself »
Related Pages
HTML Reference Manual:HTML <video> src Attribute
Video Object Other Extensions