Video currentSrcProperty

Video 对象参考手册Video Object

Example

Get the URL of the current video:

var x = document.getElementById("myVideo").currentSrc;

xThe output is similar to:

https://www.example.com/try/demo_source/mo-tt-11.mp4

Try it Yourself »

Definition and Usage

The currentSrc property returns the current video's URL.

If the audio/video is not set, an empty string is returned.

Note:This property is read-only.

Tip:Use thesrcproperty to set the URL of the video file.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All mainstream browsers support the currentSrc property.

Note:Internet Explorer 8 and earlier IE versions do not support this property.


Syntax

videoObject.currentSrc

Technical Details

Return Value: A string, representing the current URL of the video. Returns the full URL, including the protocol part (e.g., http://). If the video is not set, returns an empty string.


Video 对象参考手册Video Object Other Extensions