Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

HTML | DOM Audio src Property

  • Last Updated : 30 Nov, 2019

The DOM Audio src property is used to set or return the value of the src attribute of audio. The src attribute is generally used to specify the location (URL) of the audio file.


  • Return the src property:
  • Set the src property:
    audioObject.src = URL

Property Values:

  • URL: It is used to specify the URL of the video file.

Return Value: The Audio src property returns a string, which represents the URL of the Audio file. The src property returns the entire URL, including the protocol.


<!DOCTYPE html>
        <h1 style="color:green">GeeksforGeeks</h1>
        <h2>HTML DOM Audio src Property</h2>
        <button onclick="my_Audio()" type="button">
            Change Audio
        <audio id="myAudio" controls autoplay>
            <source id="mp4_src" src=
            <source id="ogg_src" src=
            function my_Audio() {
                document.getElementById("ogg_src").src = 
                document.getElementById("mp4_src").src =


Supported Browser: The browser supported by HTML DOM Audio src Property are listed below:

  • Google Chrome
  • Internet Explorer
  • Edge
  • Firefox
  • Apple Safari

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!