How can I automatically embed the latest youtube video?

3k views Asked by At

I know how to embed a specific video using an embed code like this:

<iframe width="560" height="315" src="https://www.youtube.com/embed/{MY_VIDEO_ID}" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

However, how can I adjust this to play my latest video without me having to change the URL every time? Is there any way to do this? thanks, Tf0R24

1

There are 1 answers

0
wizardzeb On BEST ANSWER

Create a playlist for your channel and use the "advanced" playlist settings to make a rule that automatically adds videos. You could add all videos with a specific tag.

Then, sort the playlist by the newest publication date if you want the "latest" upload.

The URL for your embed tag will look like this:

https://www.youtube.com/embed/?list={PLAYLIST_ID}