3

How can i streaming video from youtube in my application. I have tried but not only black screen appear so help me to play video from youtube in movieplayer.

Thanks

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Ashit Soni
  • 226
  • 1
  • 9

2 Answers2

2

I think the only official way is to make it play inside a UIWebView.

However there is a project called XCDYouTubeKit that, I think, will do exactly what you want: https://github.com/0xced/XCDYouTubeKit

That's allows you to make a youtube view play in a specific frame, that's maybe what your looking for.

example of use:

NSString *videoIdentifier = @"EdeVaT-zZt4"; // A 11 characters YouTube video identifier
[[XCDYouTubeClient defaultClient] getVideoWithIdentifier:videoIdentifier completionHandler:^(XCDYouTubeVideo *video, NSError *error) {
    if (video)
    {
        // Do something with the `video` object
    }
    else
    {
        // Handle error
    }
}];

Documentation is available here: http://cocoadocs.org/docsets/XCDYouTubeKit/2.0.1/

Good luck

tanou
  • 1,083
  • 2
  • 13
  • 33
  • i have download it but it not run, it build succeed but after build it will not run. – Ashit Soni Jul 15 '14 at 08:22
  • You have to include it on your project as a library, then import it and try the examples lines in my updated answer. – tanou Jul 15 '14 at 08:59
1
NSURL *url=[NSURL URLWithString:@"http://www.youtube.com/watch?v=mDFKyp40XUc"];
NSURLRequest *request=[NSURLRequest requestWithURL:url];
[self.myWebView loadRequest:request];
Ashit Soni
  • 226
  • 1
  • 9