Multimedia
Video
<video width="50%" controls>
<source src="video.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
We can also add the autoplay
and muted
attributes to this tag. The former causes the video to play immediately after it loads, while the latter mutes the video. The controls
attribute displays the play button, the scroll bar, etc.
Audio
<audio style="width: 80%;" controls>
<source src="audio.mp3" type="audio/mp3">
Your browser does not support the audio element.
</audio>
This tag supports the same attributes as the <video>
tag.
Iframe
An iframe is a frame inside which we can embed any web page except the ones that block this functionality.
YouTube videos
To add an iframe of a YouTube video, go to the video, click "Share," and then select "Embed." From there, you can adjust parameters, such as the video start time, or simply click "Copy" to get the entire iframe code.
<iframe width="560" height="315" src="https://www.youtube.com/embed/fBE8WfiTrpc?si=SuLOOfi8InXKlqju" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen=""></iframe>
HTML files
<iframe width="80%" height="315" src="index.html" title="Homepage" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe>