-1

I am trying to add a youtube player for my channel using iframe on my website.

I picked up code from here

The channel is - http://youtube.com/channel/UCYPhPtoN64fI2hfge6Iw_gQ

I have used the channel id - UCYPhPtoN64fI2hfge6Iw_gQ in the below html code snippet on my website.

<iframe id="ytplayer" type="text/html" width="400" height="225" src="//www.youtube.com/embed/?listType=user_uploads&list=UCYPhPtoN64fI2hfge6Iw_gQ" frameborder="0" allowfullscreen></iframe>

I get error inside player -

An error occurred. Please try again later

Also, I could see in the network tab that I am getting a 400 [BAD REQUEST] http response for the request

https://www.youtube.com/list_ajax?action_get_user_uploads_by_user=1&style=xml&username=UCYPhPtoN64fI2hfge6Iw_gQ

The error is

{"errors": ["The URL contained a malformed username.", "Invalid request."]}

I need help with embedding this channel using channel id on a webpage. Any help will be appreciated.

pikachu
  • 97
  • 1
  • 8

1 Answers1

0

The list param should be the username and not the userID, try and check your username here https://www.youtube.com/account_advanced

like so for example:

<iframe id="ytplayer" type="text/html" width="400" height="225" src="//www.youtube.com/embed/?listType=user_uploads&list=UKFDrumandBass" frameborder="0" allowfullscreen></iframe>

it would get all the videos uploaded by the user UKFDrumandBass

If you want to embed videos from a channel and not from a username check this thread How to embed a YouTube channel into a webpage

Community
  • 1
  • 1
0Ds0
  • 598
  • 5
  • 19
  • I have used channel id in the example I posted above. On https://www.youtube.com/account_advanced, I could see youtube user id and youtube channel id but the player doesn't work with both. – pikachu Feb 06 '15 at 15:51