Dynamic embed code for youtube

Occasional Contributor

How do I embed the latest posted video from a YouTube page (dynamic code)? any help please?

8 Replies
Hi,

To add a YouTube video you can use 3 different options to achieve this:
1. Add YouTube video to SharePoint Online Page: choose YouTube from the Webpart list when you edit a page. Copy the url or the embed code and paste this in the webpart parameters.
2. Host the video in Microsoft Streams and embed in SharePoint Online site: choose Stream from the Webpart list when you edit the page. Choose Share in Stream and use this to paste in the address parameter for the Webpart.
3. Use Embed Web Part to Add a Video to SharePoint Online: choose Embed from the Webpart list when you edit the page. Copy the Embed code from the YouTube video and paste it in the Embed Webpart.

@Noa-Arkenaar 

This I understand. But it's still one specific video. I'm looking for a dynamic embed code which automatically uses always last added video on out youtube page.

This is not specifically SharePoint related, but you can use the following embedded code and replace "YOUR_CHANNEL_NAME_HERE" with your channel.

<iframe width="600" height="340" src="https://www.youtube.com/embed?max-results=1&controls=0&showinfo=0&rel=0&listType=user_uploads&list=YOUR_CHANNEL_NAME_HERE" frameborder="0" allowfullscreen></iframe>

 

 

It's not working :( it says "This video is unavailable."

@milankysel could you share the code snippet you are using?

@Noa-Arkenaar you mean this?

<iframe width="600" height="340" src="https://www.youtube.com/embed?max-results=1&controls=0&showinfo=0&rel=0&listType=user_uploads&list=UC9t-1z5eKCl43eSuAarJRkw" frameborder="0" allowfullscreen></iframe>

 

@milankysel This has to do with YouTube and you need to find help with YouTube support for this. I think it has to do something with the copyright or embed settings.

 

For example, the following is working:

<iframe width="600" height="340" src="https://www.youtube.com/embed?max-results=1&amp;controls=0&amp;showinfo=0&amp;rel=0&amp;listType=user_uploads&amp;list=MrSuicideSheep" frameborder="0" allowfullscreen=""></iframe>

 

@Noa-Arkenaar thank you :)