HTML: Video, Audio, Iframe & Embedding YouTube 🎬🎵
1️⃣ Video Tag 🎥
- Use
<video> to embed videos.
-
Common attributes:
controls, width,
height, autoplay, loop
<video src="sample.mp4" controls width="320" height="240">Your browser does not support the video tag.</video>
2️⃣ Audio Tag 🎵
- Use
<audio> to embed audio files.
-
Common attributes:
controls, autoplay,
loop
<audio src="sample.mp3" controls>Your browser does not support the audio tag.</audio>
3️⃣ Embedding YouTube Videos 📺
- Use
<iframe> with the YouTube embed URL.
-
Find the embed code by clicking "Share" on a YouTube video, then
"Embed".
<iframe width="560" height="315" src="https://www.youtube.com/embed/dQw4w9WgXcQ" title="YouTube video" frameborder="0" allowfullscreen></iframe>