Search code examples
iosios6uiwebviewyoutube

iOS Youtube Embedded video playlists


I'm having an issue embedding youtube videos into my iOS 6.0+ app in a UIWebView. Some of my playlist URLs work while others don't. The ones that don't work simply show a black box in the UIWebView with the appropriate title..but I can't hit play in the UIWebView to start the video.

Example of one that works: http://www.youtube.com/embed/videoseries?list=PLaLpP50ifUEi3z0IXMuc5EbxChfjj0YCX

Doesn't work: http://www.youtube.com/embed/videoseries?list=PLaLpP50ifUEhBzltdYTk63BNyVXx53bvj

However, both load properly in a browser.

My embedded NSString is

    NSString *embedHTML =[NSString stringWithFormat:@"\
                          <html><head>\
                          <style type=\"text/css\">\
                          body {\
                          background-color: transparent;\
                          color: blue;\
                          }\
                          </style>\
                          </head><body style=\"margin:0\">\
                          <iframe height=\"200\" width=\"300\" src=\"%@\"></iframe>\
                          </body></html>", url];

which I populate with the URL using:

[self.webView loadHTMLString:self.embedHTML baseURL:nil];

Why does this work for some playlist videos and not others?

Thanks!


Solution

  • Not shure if its exactly the same issue but since last week no playlist will work on iOS (iPhone,iPad) (embedded on a normal webpage) occurs with both iOS6 and iOS7.

    see my post:

    Playlist (embedded ) broken on iOS

    They still work in all desktop-browsers.

    Single videos will work...maybe that is why your 1st example still works cause its not a real playlist (?)...since it has only one video in it.

    Its a bug @ youtube ... their only reply till now (@google api groups) was "its filed" which ofcourse is nothing ...they could just as well have said "its not filed" since "filed" means nothing ..they should for a start confirm that this is a bug ...next they should mention if and when its going to be solved.

    Not shure but you may want to add/change a tag ( youtube-api ) not just "youtube" to your first post (if you still can).

    youtube-api

    youtube-api