Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Challenge: Embed Audio and Video in HTML | Working with Media and Tables
Ultimate HTML

Challenge: Embed Audio and Video in HTML

Swipe to show menu

Goal

Create an engaging multimedia experience for the website visitors by incorporating both audio and video content.

Task

Take the website to the next level by immersing users in a captivating multimedia experience. Your task is to:

For the audio: embed an audio file that provides a soothing atmosphere for users to relax. Use the following link for the audio:

https://codefinity-content-media.s3.eu-west-1.amazonaws.com/code-1/ultimate-html/media+and+tables/just-relax-audio.mp3

For the video: integrate a video that lets users enjoy the beauty of nature creatures. Use the following link for the video:

https://codefinity-content-media.s3.eu-west-1.amazonaws.com/code-1/ultimate-html/media+and+tables/tiger-video.mp4

Add playback controls like play and pause.
Add file types.

index.html

index.html

index.css

index.css

Hint
expand arrow
  1. Use the <audio> tag to specify an audio element;
  2. Use the <video> tag to specify a video element;
  3. Use the controls attribute to allow users to manage audio or video playback;
  4. Use the src attribute to specify the file location. Ensure the links are copied accurately from the task;
  5. Use type="audio/mp3" to specify the correct file type for the audio;
  6. Use type="video/mp4" to specify the correct file type for the video.
Solution
expand arrow
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <link rel="stylesheet" href="index.css" />
  </head>
  <body>
    <header>
      <h1>Welcome to Multimedia</h1>
      <p>Enjoy the audio and video content below!</p>
    </header>

    <section>
      <div>
        <!-- Audio file -->
        <audio controls>
          <source
            src="https://codefinity-content-media.s3.eu-west-1.amazonaws.com/code-1/ultimate-html/media+and+tables/just-relax-audio.mp3"
            type="audio/mp3"
          />
        </audio>
      </div>
    </section>

    <section>
      <div>
        <!-- Video file -->
        <video controls>
          <source
            src="https://codefinity-content-media.s3.eu-west-1.amazonaws.com/code-1/ultimate-html/media+and+tables/tiger-video.mp4"
            type="video/mp4"
          />
        </video>
      </div>
    </section>
  </body>
</html>
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 4. Chapter 7

Ask AI

expand

Ask AI

ChatGPT

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

Section 4. Chapter 7
some-alt