<

Embedded Audio in HTML5

Posted on
6,183 Points
183 Views
Last Modified:
Published
Experience Level: Beginner
4:00
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5.

Video Steps

1. Ensure your DOCTYPE declaration is set to HTML5:

The declaration should display
<!DOCTYPE html>

Open in new window

HTML5 is supported by the most recent versions of all major browsers.

2. Begin your audio tag and define the source of the audio file

The source should reference your audio file's URL inside the single quotation (similar to the <img> tag's src). Complete the tag using a closing audio tag.
<audio src="Audio.mp3">
</audio>

Open in new window

3. Include the player controls if desired

Controls are helpful since they allow visitors to pause and adjust volume on your player. Type "controls" within your opening audio tag after your source file to include them.

4. Add additional properties you'd like the player to have

To loop the audio on the page, type "loop" after the source within the opening tag.
To have the audio autoplay as soon as the page loads, type "autoplay" after the source within the opening tag.

5. Include a message for visitors whose browsers do not support HTML 5.

The message (or image) you use is inserted between the <audio> and </audio> tags
0
0 Comments

Suggested Videos

Title Views Activity
Corner Ribbon Effect in CSS 368
Embedded Videos in HTML5 84
Introduction to jQuery (Part 1) 846
Flexible Layouts 74
There's never been a better time to become a computer scientist. Employment growth in the field is expected to reach 22% overall by 2020, and if you want to get in on the action, it’s a good idea to think about at least minoring in computer science …
Small business owners are often overwhelmed with the amount of information they need to know to create a successful marketing campaign. One area that can be incredibly confusing is SEO, or search engine optimization. My quick start guide offers tips…

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month