<

Go Premium for a chance to win a PS4. Enter to Win

x

Embedded Audio in HTML5

Posted on
6,058 Points
58 Views
Last Modified:
Experience Level: Beginner
4:02
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
Comment
0 Comments

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Join & Write a Comment

Suggested Videos

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month