我一直在使用3.0 SDK的MPMediaPlayer框架。有时媒体播放器响应缓慢,或根本没有响应。我在控制台中收到警告消息,但用户永远不会看到这些消息(从而责怪我的应用程序超时)。
有没有办法从这些超时中恢复?我可以将事情设置为不重试吗?
答案 0 :(得分: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];