Using Cocoa's QTKit framework makes playing QuickTime movies within your application fairly simple. In this recipe, we will use the QTMovieView
to play a movie.
1. Click on
MovieAppDelegate.h
to open it.2. Add the import for QuickTime:
#import <QTKit/QTKit.h>
3. Right-click on Frameworks and choose Add..., then choose Existing Frameworks... Select the QTKit.framework and click on Add:
4. Add a variable for the
QTMovieView:
QTMovieView *movieView;
6. Click on the
MovieAppDelegate.m
file to open it.7. Synthesize the
movieView
variable:@synthesize movieView;
8. Add the following code to the
applicationDidFinishLaunching:
method:[movieView setControllerVisible:YES]; NSError *error = nil; QTMovie *movie = [QTMovie movieNamed:@"BarrelRace.mov" error:&error]; if...