2009-08-02 76 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

相關問題