I am building an application where I want to play video from url like Youtube, Vimeo, Direct url. I am making custom player using AVPlayer to play a video from a direct url
For Vimeo player you can check this link https://github.com/lilfaf/YTVimeoExtractor it plays the video in real player and if you want to run the video in uiwebview,here is the code for that https://stackoverflow.com/a/15918011/1865424.
Pass you URL of YouTube Video in “urlStr”.
//In .h file
UIWebView *videoView;
// In .m file
videoView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 385)];
[self embedYouTube :urlStr frame:CGRectMake(0, 0, 320, 385)];
[self.view addSubview:videoView];
// methos to embed URL in HTML & load it to UIWebView
- (void)embedYouTube:(NSString*)url frame:(CGRect)frame
{
NSString* embedHTML = @”\
\
\
\
\
”;
NSString* html = [NSString stringWithFormat:embedHTML, url, frame.size.width, frame.size.height];
if(videoView == nil) {
videoView = [[UIWebView alloc] initWithFrame:frame];
[self.view addSubview:videoView];
}
[videoView loadHTMLString:html baseURL:nil];
}
Courtsey :- http://nanostuffs.com/Blog/?p=641
Hope This Will Help You Out. If this doesn't help you out please check out these links:-
http://blog.softwareispoetry.com/2010/03/how-to-play-youtube-videos-in-your.html
https://gist.github.com/darkredz/5334409
http://maniacdev.com/2012/02/open-source-library-for-easily-playing-a-youtube-video-in-an-mpmovieplayer