0
votes

I want to play the youtube video in my app. I have tried all the different way but not able to play video. Video that are not playing

  1. http://www.youtube.com/watch?v=uuZE_IRwLNI

  2. http://www.youtube.com/watch?v=FyXtoTLLcDk

1. Simple load request with UIWebView

it fail with Error

 NSURL *url = [NSURL URLWithString:@"http://www.youtube.com/watch?v=fDXWW5vX-64"];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[self.webView loadRequest:request];
**Domain=NSURLErrorDomain Code=-999 "The operation couldn’t be completed.**

2. Embedding youtube Video

    NSString* embedHTML = [NSString stringWithFormat:@"\
                           <html>\
                                <body style='margin:0px;padding:0px;'>\
                                    <script type='text/javascript' src='http://www.youtube.com/iframe_api'></script>\
                                    <script type='text/javascript'>\
                                        function onYouTubeIframeAPIReady()\
                                        {\
                                            ytplayer=new YT.Player('playerId',{events:{onReady:onPlayerReady}})\
                                        }\
                                        function onPlayerReady(a)\
                                        { \
                                            a.target.playVideo(); \
                                        }\
                                    </script>\
                                    <iframe id='playerId' type='text/html' width='%d' height='%d' src='http://www.youtube.com/embed/%@?enablejsapi=1&rel=0&playsinline=1&autoplay=1' frameborder='0'>\
                                </body>\
                           </html>", 300, 200, @"uuZE_IRwLNI"];
    [self.webView loadHTMLString:embedHTML baseURL:[[NSBundle mainBundle] resourceURL]];

Here its just keep loading not able to play

3. Extracting Video URL

LBYouTubeExtractor* extractor = [[LBYouTubeExtractor alloc]initWithID:[self getVideoID] quality:1];
extractor.delegate = self;
[extractor startExtracting];

But here is same reasult

1
i have tried the first one, i can't play it in my web browser neither, since it is not allowed to be played in my geographical region. Maybe similar error?Volker
So is there any way to play within my application?Sunny Shah
if they are locked for a geographical region the only way to play them is to sue a proxy server in another geo region...Volker
if it is locked then it should not play in my browser but its playing. are you talking about proxy server it is possible in IOS?Sunny Shah

1 Answers

0
votes

For the time being, calling

[videoView setMediaPlaybackRequiresUserAction:NO]

Will fix the issue you are facing till Google fix the problem on their end.