How to autoplay YouTube
Autoplay YouTube videos
What if you need to embed certain video from YouTube in your website, and make it autoplay after the webpage with the video appears? Then you need to copy the embedded code of the video, add a special line to this code, and then place it in your website. It may sound difficult, but it isn’t. Actually, here is what you need to do:
- Open YouTube;
- Find a video;
- Copy the embedded code;
- Change the code by adding "?autoplay=1" after the link to the video;
- Place this code onto your website to make it autoplay.
Let’s make YouTube videos autoplay
Copy the embedded code
Go to the YouTube website and find any video you want to use. Under the video, click on the button "Share" (arrow 1). In the appeared window click on "Embed" (arrow 2). You will see the necessary code for this video (arrow 3). Copy this line and paste it onto the website. The video will not play automatically at the moment. Remember the area 4, we will get to it later.
Change the code to make YouTube video autoplay
Here is the code that you need to embed to your website:
You need to change the code slightly in order to play the video automatically after the webpage with this code is downloaded.
So add the code "?autoplay=" without quotation marks, and give it the value 1. Place this code between the URL of the video and the quotation marks in the code. Now it should look like that:
Simply add this line to the code on your website and save it. This is how the source code with the embedded video looks on your website.
Other settings for YouTube video autoplay
Do you recall the line "Show more" in the first screenshot (area 4)? If you click on that button, you will see some more options for this embedded code. You are able to change the dimensions for the video, hide or show the controls for the player and hide or show the video title and player actions, etc. Change the necessary settings, than copy the embedded code, which will be altered once you choose different options here.
This is how to autoplay YouTube. Now try to do that by yourself!
PS: find some more information on the official Developers website from Google. Below you will see the autoplay of the YouTube video.