HTML YouTube Videos
The simplest method to show videos on a website using HTML is by embedding YouTube videos.
Struggling with Video Formats?
Changing the format of videos can be hard and takes a lot of time.
A simpler option is to allow YouTube to show the videos on your website.
YouTube Video Id
When you save or play a video on YouTube, it will show an identifier (such as tgbNymZ7vqY).
You may utilize this identification (id) to reference your video within the HTML code.
Playing a YouTube Video in HTML
To showcase your video on a webpage, follow these steps:
- Upload the video to YouTube
- Remember the video ID.
- Create an
<iframe>
element on your webpage. - Set the
src
attribute to the web address of the video. - Employ the
width
andheight
attributes to define the size of the player. - Include additional details in the web address (refer to the information below).
YouTube Autoplay + Mute
You can make your video play automatically when someone opens the page by including autoplay=1
in the YouTube URL. Yet, starting a video automatically can be bothersome for your website visitors!
Insert mute=1
right after autoplay=1
to make your video begin playing on its own, but with the sound turned off.
YouTube Playlist
A comma separated list of videos to play (in addition to the original URL).
YouTube Loop
Include loop=1
to make your video play repeatedly without stopping.
Setting 0 (default): The video plays just once.
Value 1: The video will repeat continuously.
YouTube Controls
Add controls=0
to not display controls in the
video player.
Value 0: Player controls does not display.
Value 1 (default): Player controls display.