From the course: Learning Web Audio and Video

Unlock the full course today

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

Specify multiple audio sources

Specify multiple audio sources

From the course: Learning Web Audio and Video

Start my 1-month free trial

Specify multiple audio sources

- [Instructor] The source attribute allows us to specify a single audio file source. But nesting multiple source elements within our audio element allows us to specify primary and secondary sources. Let's go ahead and actually remove the src or source attribute here, I'm going to use Command or Control + X to simply cut this out 'cause we can repurpose it for the different source texts we're going to create. Within the audio element itself, we're going to nest additional elements. And these are of type source. So just type in source and we're going to paste in, using Control or Command + V, the source src attribute here. Initially, the primary source is going to point to this mp3 file. Now you've got some additional attributes you can use for the source, such as the type. This helps inform the browser in terms of exactly what codec is being used and what container. So if we set type equal to audio in this case and mpeg for MPEG, this is going to let the web browser know that this a…

Contents