How to embed youtube videos as playlist
Solution 1
Actually there are two ways to embed playlists from youtube. In the first method you can directly specify all the videos that you want to play in the embed player.
<iframe width="720" height="405" src="https://www.youtube.com/embed/VIDEO_ID?playlist=VIDEOID_1,VIDEOID_2"frameborder="0" allowfullscreen>
Each video ID must be separated by using comma.
Secondly, you can embed a playlist that is already present in youtube using the playlist ID
<iframe width="720" height="405" src="https://www.youtube.com/embed/?listType=playlist&list=PLAYLIST_ID" frameborder="0" allowfullscreen>
Solution 2
https://developers.google.com/youtube/youtube_player_demo
<iframe id="ytplayer" type="text/html" width="100%" height="405"
src="https://www.youtube.com/embed/?listType=playlist&list=PL590L5WQmH8eYTXiTTjzo4YnK7vkCqZTI"
frameborder="0" allowfullscreen>
Solution 3
You can simply use embedded playlists.
Here is an example of one of my playlists!
<iframe width="560" height="315" src="http://www.youtube.com/embed/videoseries?list=PLZtX_kbNpbDjYSUj-huH5pOKxifUNDi1O" frameborder="0" allowfullscreen></iframe>
In addition you could use the Javascript Player API to create custom behavior.
Solution 4
From the youtube docs
Embed a playlist
- Sign in to your YouTube account on a computer.
- On the left side of the page, select the playlist you want to embed.
- Copy the playlist ID from the URL.
- Modify the embed code for an individual video by doing the following: In the place of the video ID (after "embed/"), substitute "videoseries?list=". Then paste the playlist ID after the "=".
- Paste the code into your blog or website HTML.
Example:
<iframe width="560" height="315" src="https://www.youtube.com/embed/videoseries?list=PLx0sYbCqOb8TBPRdmBHs5Iftvv9TPboYG" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
Admin
Updated on August 11, 2020Comments
-
Admin almost 4 years
I have numerous youtube video clips, and I was wondering if it is possible to embed them on the site as youtube playlist, so that the next video starts playing automatically once the clip finishes. Is there such functionality either with YouTube API or without. If not possible, what would be the best approach. Thanks in advance.
-
Ryan over 6 yearsThanks. I used the 2nd method. And we can also use
&index=0
or&index=3
etc to change which video of the playlist is ready to play. -
drew.. about 5 yearsThis does not answer the question.
-
drew.. about 5 yearsThis does not answer the question asked.
-
drew.. about 5 yearsThis does not answer the question.
-
Chintan Patel about 5 years@drew.. Check this prntscr.com/muejs5 and confirm please.
-
drew.. about 5 yearsThe original poster was asking about creating a list of videos on-the-fly and playing them, not creating and using a playlist, thus my comment. the on-the-fly implementation is stunningly disjoint given the size of youtube.
-
twigmac about 4 yearsThe second method doesn't seem to work anymore. Can anyone confirm?
-
Shan Eapen Koshy about 4 years@twigmac The second method works as well - developers.google.com/youtube/player_parameters#list
-
Mohamed Anis Dahmani over 2 yearsI confirm. The second method still works to this day.
-
rmindzstar over 2 yearsThe second method still works in 2021
-
NameError over 2 yearsThe second method works as of 10 Feb 2022.