I'm developing a cocoa application. I have to play a youtube video. http://www.youtube.com/watch?v=dElLBPL_h1Q

I'm using QTKit for playing video. Code is as follow:

NSURL *fileURL = [NSURL URLWithString:@"http://www.youtube.com/watch?v=dElLBPL_h1Q"];
QTMovie *movie = [QTMovie movieWithURL:fileURL error:&error];
[movieView setMovie:movie];
[movieView.movie play];

Where, movieView is an instance of QTMovieView.

Please help.

有帮助吗?

解决方案

Use LBYouTubeView to play YouTube videos with choice of streaming with high-quality and standard quality .

LBYouTubeView contains is LBYouTubePlayerViewController and its just a small view that is able to display YouTube videos in a MPMoviePlayerController. You even have the choice between high-quality and standard quality stream.

EDIT : Its easy to use.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top