So, you are landing on this page means you want to embed your YouTube videos to your webpage but you don’t have any ideas on how to do it.
No worries. I am here to help those like you who have little knowledge and trying to learn online.
Let’s not talk about other things. Let’s go start the process of how can you successfully embed your YouTube video to your webpage.
1) Open your YouTube Video
First of all, play the youtube video you want to embed to your webpage. Right-click on it and select “<>copy embed code“.
Now you have copied the embed code for your webpage. Next, you need to paste this code into your webpage HTML where you want the video to display.
2) Open your Webpage
Now, open your webpage and paste it into the HTML section.
Below is a copy of the YouTube embed code:
<iframe width="1280" height="753" src="https://www.youtube.com/embed/TeETeOVlqsc" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
3) Make autoplay
Now to create your video automatically play after the webpage is loading, then add the below line of code after your YouTube video id.
?autoplay=1
Here, is a full code after you added the above line of code:
<iframe width="1280" height="753" src="https://www.youtube.com/embed/TeETeOVlqsc?autoplay=1" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
Output:
4) Auto loop
Here is the syntax of auto loop YouTube video
http://www.youtube.com/embed/VIDEO_ID?autoplay=1&loop=1&playlist=VIDEO_ID
VIDEO_ID is your YouTube video id.
Here is a full sample of auto loop code:
<iframe width="1280" height="753" src="https://www.youtube.com/embed/TeETeOVlqsc?autoplay=1&loop=1&playlist=TeETeOVlqsc" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe>
Output:
You may be interested in the following topics: