HTML <source> src Attribute
Definition and Usage
src
The attribute specifies the URL of the media file to be played.
When <source> is used <audio> and <video> This attribute is required when
Example
This is an audio player with two audio source files. The browser should choose the file it supports (if any):
<audio controls> <source src="song.ogg" type="audio/ogg"> <source src="song.mp3" type="audio/mpeg"> Your browser does not support the audio element. </audio>
Syntax
<source src="URL">
Attribute Value
Value | Description |
---|---|
URL |
Specifies the URL of the media file. Possible values:
|
Browser Support
The numbers in the table indicate the first browser version to fully support this attribute.
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
4.0 | 9.0 | 3.5 | 4.0 | 10.5 |