Reputation: 1424
I know the following code works for any channel that has a username. Eg: (NerdAlert)
<iframe width="300" height="200" src="http://www.youtube.com/embed?max-results=1&controls=0&showinfo=0&rel=0&listType=user_uploads&list=NerdAlert" frameborder="0" allowfullscreen="allowfullscreen"></iframe>
Eg: http://codepen.io/liquidvisual/pen/oZxORy
However, I can't get this to work with my channel - which doesn't have a user name like the above. I only have access to a channel ID, and this doesn't work.
Upvotes: 0
Views: 1186
Reputation: 785
As tested [here] , it would seem that the embedded player has no saport at the moment for "Channel ID's".
So I would put a bug request in if I was you.
As a work around. you can use the iFrame embed Api from [here]
In the "videoId" part, you can put a coma separated string of all the video id's. That will then act like what you wanted.
Depending on your need's, if you require a more dynamic one for a site, then you will need to have some code in place to collect and populate the player.
First is to get the uploaded list from the channel.
https://www.googleapis.com/youtube/v3/channels?part=contentDetails&id=[THE_CHANNEL_ID]&key=[apiKey]
Change "id=[THE_CHANNEL_ID]" to "forUsername=[LEGACY_USERNAME]" if required.
Then grab in code the upload's playlist from
[items] => [0] => [contentDetails] => [relatedPlaylists] => [uploads]
Then you can take it and plug that into the ...../v3/playlistItems api call.
Here you will need to have a loop setup to collect all your videoID's.
Then you can put them into a string to load into the player.
Also note that if your selected channel has more than 50 video's, then you will need to page through the results a few times to get a full list.
Also note that some channels can have well over 500 uploads. So selecting a limit might be a good idea.
Upvotes: 1