javascriptyoutube

How to link to the first video of a YouTube-playlist with ONLY the playlist-id?


Given ONLY the playlist-id, can I create a link that starts playing at the first video?

Whenever I try to remove the video-id from a "watch"-url, it breaks, and linking to the "playlist"-endpoint doesn't start playing immediately.

Why does YouTube require a first video-id to be specified?

My reason for not including the video-id is that I want the player to start playing the first video even after the owner modifies the playlist and perhaps remove or replace the first video. I don't want the link to break just because of this.


To be clear this is what I meant:

Works:

https://www.youtube.com/watch?v=ZzO1sj6KU9s&list=PL180845BD0BEEE980

Does not work (for me at least):

https://www.youtube.com/watch?v=&list=PL180845BD0BEEE980

https://www.youtube.com/watch?list=PL180845BD0BEEE980

https://www.youtube.com/?list=PL180845BD0BEEE980

Doing the same with an embedded player apparently works fine, but not with a browser a-link.


Solution

  • You mean, for example embed the playlist without specifiyng the video_id, right?

    If so, you can try:

    https://www.youtube.com/embed?list=PLMlNiWEoh5QrLU6C7_Ad71UtRpACh3FdQ

    or

    https://www.youtube.com/embed/?listType=playlist&list=PLMlNiWEoh5QrLU6C7_Ad71UtRpACh3FdQ

    And - for autoplay the playlist - you have to add &autoplay=1&mute=0 parameters - after the playlist_id - (it will autoplay the playlist, but, muted).

    Otherwise, it wont autoplay.