How to embed youtube videos as playlist

user1034774 picture user1034774 · Apr 20, 2013 · Viewed 63.7k times · Source

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.

Answer

Shan Eapen Koshy picture Shan Eapen Koshy · May 24, 2015

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>

enter image description here