Re: QTMovie not playing in new window
Re: QTMovie not playing in new window
- Subject: Re: QTMovie not playing in new window
- From: Kyle Sluder <email@hidden>
- Date: Tue, 05 Jul 2011 22:12:41 -0700
On Mon, Jul 4, 2011 at 2:21 AM, Paolo Franzetti <email@hidden> 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.
Have you made sure this outlet is connected?
This also violates good principles of encapsulation. It would be
better to subclass NSWindowController and provide a custom
initializer, like this:
@interface MoviePlayerWindowController : NSWindowController
- (id)initWithMovie:(QTMovie *)aMovie
@end
--Kyle Sluder
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden