YouTip LogoYouTip

Prop Video Currentsrc

HTML DOM Video currentSrc Property

HTML DOM Video currentSrc Property

-- Learning is not just about technology, but also about dreams!

JavaScript Reference Manual

Overview

JavaScript Objects

JavaScript Array Object JavaScript Boolean Object JavaScript Date Object JavaScript Math Object JavaScript Number Object JavaScript String Object JavaScript RegExp Object JavaScript Global Properties/Functions JavaScript Operators JavaScript Error

Browser Objects

Window Object Navigator Object Screen Object History Object Location Object Storage Object

DOM Objects

HTML DOM Document Object HTML DOM Element Object HTML DOM Attribute Object HTML DOM Event Object HTML DOM Console Object CSSStyleDeclaration Object DOM HTMLCollection

HTML Objects

<a> <area> <audio> <base> <blockquote> <body> <button> <canvas> <col> <colgroup> <datalist> <del> <details> <dialog> <embed> <fieldset> <form> <iframe> <frameset> <img> <ins> <input> - button <input> - checkbox <input> - color <input> - date <input> - datetime <input> - datetime-local <input> - email <input> - file <input> - hidden <input> - image <input> - month <input> - number <input> - range <input> - password <input> - radio <input> - reset <input> - search <input> - submit <input> - text <input> - time <input> - url <input> - week <keygen> <link> <label> <legend> <li> <map> <menu> <menuItem> <meta> <meter> <object> <ol> <optgroup> <option> <param> <progress> <q> <script> <select> <source> <style> <table> <td> <th> <tr> <textarea> <title> <time> <track> <video>

HTML DOM Track Object

HTML DOM Video currentTime Property

Video currentSrc Property

Image 8: Video Object Reference Manual Video Object

Example

Get the URL of the current video:

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

x output result 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 URL of the current video.

If no audio/video is set, it returns an empty string.

Note: This property is read-only.

Tip: Use the src property to set the URL of the video file.


Browser Support

Image 9: Internet Explorer Image 10: Firefox Image 11: Opera Image 12: Google Chrome Image 13: Safari

The currentSrc property is supported by all major browsers.

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, returning the full URL including the protocol part (e.g., http://). If the video is not set, it returns an empty string.

Image 14: Video Object Reference Manual Video Object

HTML DOM Track Object

HTML DOM Video currentTime Property

← Prop Video CurrenttimeProp Video Currentsrc β†’