Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML Audio/Video DOM src Property

HTML Audio/Video DOM src Property

HTML audio/video Tag Reference HTML Audio/Video DOM Reference

Example

Change the source of the video:

myVid=document.getElementById("video1");

myVid.src="movie.ogg";

Try it »


Definition and Usage

The src property sets or returns the current source of the audio/video.


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Internet Explorer 10, Firefox, Opera, Chrome, and Safari support the src property.

**Note:** Internet Explorer 9 and earlier versions do not support the src property.


Syntax

Set the src attribute:

audio|video

.src=

URL

Return the src attribute:

audio|video

.src

Attribute values

Value Description
URL Specifies the URL of the audio/video source.

Possible values:

  • Absolute URL - points to another website (e.g., src="http://www.example.com/movie.ogg")
  • Relative URL - points to a file within the website (e.g., src="movie.ogg")
  • |

    Technical Details

    Return Value: A string value, the current source of the audio/video.

    HTML audio/video Tag Reference HTML Audio/Video DOM Reference