I have a MAC OSX application in which I would like to press a button in the main window and open a new window in which a movie is played. This is my IBAction code;

Code:

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

The window opens but no movie is played; can someone understand what I am doing wrong ? I can send the complete project (it is a test one, very small) if needed.

Thank you very much for any help.

Paolo
_______________________________________________

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

Reply via email to