1

I am creating an iOS app that uses the youtube iOS player helper. It works fine, but for some videos, when trying to play them, I get 'This video contains content from [YYY]. It is restricted from playback on certain sites'.

The metadata for one of the videos that doesn't work is here: http://gdata.youtube.com/feeds/api/videos/KJB49SAHIKM?v=2&prettyprint=true.

And http://gdata.youtube.com/feeds/api/videos/dRgPi1OPBeA?v=2&prettyprint=true is the metadata for a video that works.

The embed permission seems to be the same. What could the problem be? Is there something I'm missing? I know that 'syndicate' is denied for the video that doesn't work, but I also have a video with syndicate and embed allowed that doesn't play and gives the same error, so I assume there must be something else.

Also, I have access to the channels that uploaded those two videos. Are there any settings for the individual videos that have to be set for them to be able to be embedded?

  • it will not play. try play with UIWebView.. – Sunny Shah Jul 23 '14 at 09:31
  • @SunnyShah other videos play. That shouldn't be the issue. Also, if you look at the source of the youtube iOS player helper, it uses a UIWebView to play the videos. – Marius Constantinescu Jul 23 '14 at 09:36
  • oh, I think I get what you mean. You actually say to use a UIWebView that loads youtube.com on the page of that video and play it there. Yeah, that could be an option. But I was hoping that it could be done by changing some permissions of the videos in YouTube – Marius Constantinescu Jul 23 '14 at 09:50
  • Oh, according to http://stackoverflow.com/questions/12761100/youtube-in-ios5-done-button-tapped/12860616#12860616, that doesn't work in versions more recent than iOS6. The way to do it is to use an iframe, and then the embed code, so it would still be the same problem. – Marius Constantinescu Jul 23 '14 at 10:04
  • http://stackoverflow.com/a/30017897/1083128 add a url to the playerVars for origin key – Mia Aug 10 '15 at 08:57

2 Answers2

2

Add player vars while initializing youtube sdk:

NSDictionary *playerVars = @{
                             @"origin" : @"http://www.youtube.com",
                             };
[self.playerView loadWithVideoId:@"KOvoD1upTxM" playerVars:playerVars];

Enjoy!

atulkhatri
  • 10,896
  • 3
  • 53
  • 89
0

I had the same issue but it seems like its due to the fact that publishers have restricted the video to be played outside youtube.com. If you own the channel and videos then probably you have a setting that restricts playback of videos outside youtube. For other videos that I dont have access to I put an option to watch it on youtube that would fire up native youtube app with the video loaded.

Hem Acharya
  • 258
  • 3
  • 15