【发布时间】:2009-08-02 22:08:18
【问题描述】:
我一直在使用 3.0 SDK 的 MPMediaPlayer 框架。有时媒体播放器响应缓慢,或根本不响应。我在控制台中收到警告消息,但用户永远不会看到这些消息(因此将超时归咎于我的应用程序)。
有没有办法从这些超时中恢复?我也可以设置不重试吗?
【问题讨论】:
标签: iphone frameworks media-player
我一直在使用 3.0 SDK 的 MPMediaPlayer 框架。有时媒体播放器响应缓慢,或根本不响应。我在控制台中收到警告消息,但用户永远不会看到这些消息(因此将超时归咎于我的应用程序)。
有没有办法从这些超时中恢复?我也可以设置不重试吗?
【问题讨论】:
标签: iphone frameworks media-player
您的应用是否注册以接收来自 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];
【讨论】: