Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Embedding Audio for Rich Media | Working with Media and Tables
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
Ultimate HTML

bookEmbedding Audio for Rich Media

You can utilize the <audio> element to include audio files on a web page. Let's consider an example:

index.html

index.html

copy

In this example:

  • <audio> element contains a <source> element, which specifies the URL and file type of the audio file. Commonly supported formats are MP3 and OGG;
  • controls attribute displays standard playback controls such as play, pause, and volume;
  • If the user's browser doesn't support the audio element, a fallback message will be displayed.

Additional attributes commonly used with the HTML audio element include:

  • autoplay: starts playing the audio file as soon as the page loads;
  • loop: causes the audio file to loop continuously;
  • muted: mutes the audio by default;
  • volume: specifies the default volume level for the audio file, ranging from 0.0 (silent) to 1.0 (full volume).

Here's an example demonstrating the usage of all these attributes:

index.html

index.html

copy
question mark

Which of the following statements about the <audio> element in HTML is true?

Select the correct answer

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 4. ChapterΒ 5

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

Suggested prompts:

Can you show me the complete example with all these attributes?

What other attributes can I use with the `<audio>` element?

Can you explain how browser support works for different audio formats?

bookEmbedding Audio for Rich Media

Swipe to show menu

You can utilize the <audio> element to include audio files on a web page. Let's consider an example:

index.html

index.html

copy

In this example:

  • <audio> element contains a <source> element, which specifies the URL and file type of the audio file. Commonly supported formats are MP3 and OGG;
  • controls attribute displays standard playback controls such as play, pause, and volume;
  • If the user's browser doesn't support the audio element, a fallback message will be displayed.

Additional attributes commonly used with the HTML audio element include:

  • autoplay: starts playing the audio file as soon as the page loads;
  • loop: causes the audio file to loop continuously;
  • muted: mutes the audio by default;
  • volume: specifies the default volume level for the audio file, ranging from 0.0 (silent) to 1.0 (full volume).

Here's an example demonstrating the usage of all these attributes:

index.html

index.html

copy
question mark

Which of the following statements about the <audio> element in HTML is true?

Select the correct answer

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 4. ChapterΒ 5
some-alt