2009-08-02 214 views
0

我一直在使用3.0 SDK的MPMediaPlayer框架。有时媒体播放器响应缓慢,或根本没有响应。我在控制台中收到警告消息,但用户永远不会看到这些消息(并因此责怪我的应用程序超时)。如何判断发送给MPMediaPlayer的消息是否超时?

有没有办法从这些超时恢复?我可以设置不重试吗?

回答

0

您的应用程序是否注册以接收来自MPMediaPlayer的通知?我没有看到这些超时,所以我不知道他们是否返回MPMoviePlayerContentPreloadDidFinishNotification与填充您的错误的userInfo。

从MPMoviePlayerController.h:

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

从MoviePlayer示例代码:

// 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]; 
+0

我的应用程序不会注册本身的通知,不过,我使用的MPMusicPlayer,没有电影播放器​​。不过,看起来似乎是值得期待的方向。谢谢! – casademora 2009-08-03 02:22:12

相关问题