1

I'm seeing that setting up a notification on QTMovieLoadStateDidChangeNotification has no effect and the target selector never gets called. Am I missing something?

In awakeFromNib:

[[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(movieLoadStateDidChange:)
                                             name:QTMovieLoadStateDidChangeNotification
                                           object:nil];

On loading movie:

NSNumber *num = [NSNumber numberWithBool:YES];
NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:
 url, QTMovieURLAttribute,
 nil];

self.mQTMovie1 = [[QTMovie alloc] initWithAttributes:attributes
                                               error:&error];

Also

- (void)movieLoadStateDidChange:(NSNotification *)notification {
NSLog(@"movieLoadStateDidChange got called");
}
martinjbaker
  • 1,424
  • 15
  • 23

1 Answers1

1

I'm not sure this is the answer but I've encountered this before. The cause in my case was a file whose codec was supported only by a third-party plugin (Flip4Mac in my case).

The load state notification isn't called until the movie finishes after it auto-plays (to nowhere). For long media files, it effectively looks like the notification is never called, since we rarely wait 5 minutes or an hour for a load notification when testing our code. To the user, it looks like the app simply isn't loading the file.

Having the user disable the plugin's auto-play-on-load in System Preferences resolves the issue but unfortunately this one support FAQ I can't get around since users of the app in question frequently use Flip4Mac to support files from common digital voice recorders.

Joshua Nozzi
  • 60,946
  • 14
  • 140
  • 135
  • This is with standard codecs like ProRes and Animation. It was causing issues with setting the movie on a QTMovieLayer since querying the load state was saying it was loaded but it didn't get drawn on screen. In the end I hacked in a 0.2 seconds delay before setting the QTMovieLayer movie and all is good :-) – martinjbaker May 07 '13 at 13:51