On Jul 4, 2011, at 4:21 AM, Paolo Franzetti wrote: > - (IBAction) playButtonClicked: (id) sender > { > MoviePlayerController *moviePlayerWindow = [[MoviePlayerController alloc] > initWithWindowNibName:@"MoviePlayer"]; > [moviePlayerWindow showWindow:self]; > > NSError *error; > NSString *moviePath = [[NSBundle mainBundle] > pathForResource:@"sample_iTunes" ofType:@"mov"]; > QTMovie *movie = [QTMovie movieWithFile:moviePath error:&error]; > if (error) { > NSLog(@"%@", [error localizedDescription]); > } else { > [movie gotoBeginning]; > [moviePlayerWindow.movieViewer setMovie:movie]; > [moviePlayerWindow.movieViewer play:nil]; > } > > } > > movieViewer is a QTMovieViewer outlet inside the new window.
In addition to Kyle's observations, I would also point out that your method of checking for failure in +[QTMovie movieWithFile:error:] is incorrect. The primary check for failure is the return value (did it return nil?). Only if it returns nil should you then pay any attention to the error value. QTMovie *movie = [QTMovie movieWithFile:moviePath error:&error]; if (movie == nil) { if (error) { /* log or otherwise handle error */ } } else { /* use movie */ } _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com