From the course: Learning Web Audio and Video

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Specify an audio source

Specify an audio source

From the course: Learning Web Audio and Video

Start my 1-month free trial

Specify an audio source

- [Instructor] The source attribute allows us to specify the source file for our audio playback. This is the audio content that will play using the HTML audio element. The first thing we're going to have to do is have a look inside of our media folder within the project because right now we only have an MP4 video file. If we have a look inside of our exercise files within the media folder, we can see audio.mp3. This is an audio file that we can use in our project, we'll just copy and paste that or even just drag it into the media folder inside of Visual Studio Code. It now exists inside our MP4, inside the media folder, and again, if it opens up inside of Code in a tab, we can close that tab. With that file within our media folder, we can now set a source or SRC attribute on the audio element. And we can set it equal to media/audio.mp3. Let's go ahead and test this out inside of the browser. All right, we can already see that we have a duration here populated. Some of it's been…

Contents