views:

461

answers:

1

I've been working with the MPMediaPlayer framework for the 3.0 SDK. Sometimes the Media Player is slow to respond, or doesn't respond at all. I get warning messages in the console, but the user will never see these messages (and thus blame my app for the timeouts).

Is there a way to recover from these timeouts? Can I set things to NOT retry also?

A: 

Does your app register to receive notifications from the MPMediaPlayer? I haven't seen these timeouts, so I don't know if they return the MPMoviePlayerContentPreloadDidFinishNotification with the userInfo filled with your error.

From MPMoviePlayerController.h:

MP_EXTERN NSString *const MPMoviePlayerContentPreloadDidFinishNotification; // userInfo contains NSError for @"error" key if preloading fails

From the MoviePlayer sample code:

// Register to receive a notification that the movie is now in memory and ready to play
[[NSNotificationCenter defaultCenter] addObserver:self 
     selector:@selector(moviePreloadDidFinish:) 
     name:MPMoviePlayerContentPreloadDidFinishNotification 
     object:nil];

// Register to receive a notification when the movie has finished playing. 
[[NSNotificationCenter defaultCenter] addObserver:self 
    selector:@selector(moviePlayBackDidFinish:) 
    name:MPMoviePlayerPlaybackDidFinishNotification 
    object:nil];

// Register to receive a notification when the movie scaling mode has changed. 
[[NSNotificationCenter defaultCenter] addObserver:self 
    selector:@selector(movieScalingModeDidChange:) 
    name:MPMoviePlayerScalingModeDidChangeNotification 
    object:nil];
Dimitri
My app does register itself for notifications, however, I'm using the MPMusicPlayer, not Movie Player. Still, seems like a worthwhile direction to look to. Thanks!
casademora