• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: QTMovie not playing in new window
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: QTMovie not playing in new window


  • Subject: Re: QTMovie not playing in new window
  • From: Michael Babin <email@hidden>
  • Date: Wed, 06 Jul 2011 07:18:12 -0500

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

References: 
 >QTMovie not playing in new window (From: Paolo Franzetti <email@hidden>)

  • Prev by Date: Dynamically loading NIB files with a common stem
  • Next by Date: Re: Dynamically loading NIB files with a common stem
  • Previous by thread: Re: QTMovie not playing in new window
  • Next by thread: NSComboBox in NSTableView behaving strangely
  • Index(es):
    • Date
    • Thread