Skip to content

errorCode

isExist? edited this page Sep 21, 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 -10016 视频解码失败
KSYMPErrorCodeAudioDecodeFailed -10017 音频解码失败
KSYMPErrorCode3xxOverFlow -10018 多次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"];
    }
}
Clone this wiki locally