objective-ccocoayoutubeqtkit

How to play youtube video in QTMovieView


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.


Solution

  • 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.