-
Notifications
You must be signed in to change notification settings - Fork 145
errorCode
isExist? edited this page Sep 22, 2016
·
7 revisions
出现错误无法播放时通过MPMoviePlayerPlaybackDidFinishNotification通知发送具体的错误原因
| 变量名 | 数值 | 含义 |
|---|---|---|
| KSYMPErrorCodeUnknownError | 1 | 未知的播放器错误 |
| KSYMPErrorCodeFileIOError | -1004 | 文件或网络相关操作错误 |
| KSYMPErrorCodeUnsupportProtocol | -10001 | 不支持的流媒体协议 |
| KSYMPErrorCodeDNSParseFailed | -10002 | DNS解析失败 |
| KSYMPErrorCodeCreateSocketFailed | -10003 | 创建socket失败 |
| KSYMPErrorCodeConnectServerFailed | -10004 | 连接服务器失败 |
| KSYMPErrorCodeBadRequest | -10005 | http请求返回400 |
| KSYMPErrorCodeUnauthorizedClient | -10006 | http请求返回401 |
| KSYMPErrorCodeAccessForbidden | -10007 | http请求返回403 |
| KSYMPErrorCodeTargetNotFound | -10008 | http请求返回404 |
| KSYMPErrorCodeOtherErrorCode | -10009 | http请求返回4xx |
| KSYMPErrorCodeServerException | -10010 | http请求返回5xx |
| KSYMPErrorCodeInvalidData | -10011 | 无效的媒体数据 |
| KSYMPErrorCodeUnsupportVideoCodec | -10012 | 不支持的视频编码类型 |
| KSYMPErrorCodeUnsupportAudioCodec | -10013 | 不支持的音频编码类型 |
| KSYMPErrorCodeVideoDecodeFailed | -10014 | 视频解码失败 |
| KSYMPErrorCodeAudioDecodeFailed | -10015 | 音频解码失败 |
| KSYMPErrorCode3xxOverFlow | -10016 | 多次3xx跳转 |
也可以通过参考API文档中KSYMPErrorCode定义
当接收到MPMoviePlayerPlaybackDidFinishNotification通知时,可通过userInfo字典中关键字MPMoviePlayerPlaybackDidFinishReasonUserInfoKey查询具体的结束原因。当结束原因为MPMovieFinishReasonPlaybackError时,userInfo字典中的关键字error指明了具体的错误码。
if (MPMoviePlayerPlaybackDidFinishNotification == notify.name) {
NSLog(@"player finish state: %ld", (long)_player.playbackState);
int reason = [[[notify userInfo] valueForKey:MPMoviePlayerPlaybackDidFinishReasonUserInfoKey] intValue];
if (reason == MPMovieFinishReasonPlaybackEnded) {
stat.text = [NSString stringWithFormat:@"player finish"];
}else if (reason == MPMovieFinishReasonPlaybackError){
stat.text = [NSString stringWithFormat:@"player Error : %@", [[notify userInfo] valueForKey:@"error"]];
}else if (reason == MPMovieFinishReasonUserExited){
stat.text = [NSString stringWithFormat:@"player userExited"];
}
}

