HTML source tag is used to show media resources in web pages. The audio tag and video tag are the media resources which we can show inside a web page.


This is the example to show audio using source tag.

Output


You must also read

This is the example to show video using source tag.

Output


You must also read

List of allowed HTML Audio/Video Formats

Sr. No. HTML Audio/Video availble formats for source tag Description
1 mp3 Used to include mp3 extension files.
2 ogg Used to include ogg extension files.
3 wav Used to include wav extension files.
4 mp4 Used to include mp4 extension files.
5 webm Used to include webm extension files.

List of HTML source tag attributes

Sr. No. attribute options Description
1 src Used to include location of media resources. The value for this attribute is the url of the media video/audio files.
2 type Used to specify the type of the media files whether it is video or audio extension files. video/mp4, audio/mp3 etc are the values for this attribute.
3 autoplay Used to specify the boolean value to start and play the sources. The value for this are true and false.

Resources and References

1. W3C Specification.
2. HTML living standard
3. W3C project using Github

Leave a Reply

Your email address will not be published. Required fields are marked *