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.css
Hint
- Use the
<audio>tag to specify an audio element; - Use the
<video>tag to specify a video element; - Use the
controlsattribute to allow users to manage audio or video playback; - Use the
srcattribute to specify the file location. Ensure the links are copied accurately from the task; - Use
type="audio/mp3"to specify the correct file type for the audio; - Use
type="video/mp4"to specify the correct file type for the video.
Solution
<!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?
Thanks for your feedback!
Section 4. Chapter 7
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Section 4. Chapter 7