Search.../

src

Sets or gets the file location of the audio file.

Description

Setting the src property changes the audio file to the audio found at the new src value.

Getting the src property returns the location of the audio file.

The audio file can be either from the Media Manager or an external audio file from any web location.

The URL formats supported are:

  • Media Manager: wix:audio://v1/<audio_uri>/<filename>#duration=<duration>
  • Web URL: (http(s)|blob|data)://site.com/audio-file.mp3

Type:

stringRead & Write

Was this helpful?

Get the audio track's location

Copy Code
1let audioSrc = $w("#myAudioPlayer").src;
2// "wix:audio://v1/22cf...185.mp3/Star Spangled Banner on Electric Guitar.#duration=132"
Set the audio track to an audio file uploaded to your site

Copy Code
1$w("#myAudioPlayer").src = "wix:audio://v1/22cf...185.mp3/Star Spangled Banner on Electric Guitar.#duration=132";
Set the audio track to an external audio URL

Copy Code
1$w("#myAudioPlayer").src = "http://lcweb2.loc.gov/natlib/ihas/service/ssbanner/100010509/100010509.mp3";