2015-10-9--avplayer拖动导致卡顿

在线视频
在播放在线视频的时候,如果网速很慢,视频会卡住不动,在有效的时间内,如果数据缓冲过来,视频可以继续往下播放,如果长时间得不到数据,播放器就会失效。

边下边播视频
边下边播的视频也存在以上情况,还存在更加奇葩的现象,拖动滑竿 的时候,如果超出缓冲区域外去播放,这个时候如果网速比较慢,有可能会卡住,还可能画面卡住,但是有声音。
现在解决的办法是:滑竿拖到某处开始播放的时候先暂停,等到缓冲了足够播放的数据后,再让其开始播放,在等在的过程中,加一个菊花转,增加用户体验。

附上常用网络错误码

#网络中断:-1005
#无网络连接:-1009
#请求超时:-1001
#服务器内部错误:-1004
#找不到服务器:-1003

oc

enum { NSURLErrorUnknown = - 1 ,
NSURLErrorCancelled = - 999 ,
NSURLErrorBadURL = - 1000 ,
NSURLErrorTimedOut = - 1001 ,
NSURLErrorUnsupportedURL = - 1002 ,
NSURLErrorCannotFindHost = - 1003 , NSURLErrorCannotConnectToHost = - 1004 , NSURLErrorDataLengthExceedsMaximum = - 1103 , NSURLErrorNetworkConnectionLost = - 1005 , NSURLErrorDNSLookupFailed = - 1006 , NSURLErrorHTTPTooManyRedirects = - 1007 , NSURLErrorResourceUnavailable = - 1008 , NSURLErrorNotConnectedToInternet = - 1009 , NSURLErrorRedirectToNonExistentLocation = - 1010 , NSURLErrorBadServerResponse = - 1011 , NSURLErrorUserCancelledAuthentication = - 1012 , NSURLErrorUserAuthenticationRequired = - 1013 , NSURLErrorZeroByteResource = - 1014 , NSURLErrorCannotDecodeRawData = - 1015 , NSURLErrorCannotDecodeContentData = - 1016 , NSURLErrorCannotParseResponse = - 1017 , NSURLErrorInternationalRoamingOff = - 1018 , NSURLErrorCallIsActive = - 1019 ,
NSURLErrorDataNotAllowed = - 1020 ,
NSURLErrorRequestBodyStreamExhausted = -1021, NSURLErrorFileDoesNotExist = -1100, NSURLErrorFileIsDirectory = -1101, NSURLErrorNoPermissionsToReadFile = -1102, NSURLErrorSecureConnectionFailed = -1200, NSURLErrorServerCertificateHasBadDate = -1201, NSURLErrorServerCertificateUntrusted = -1202, NSURLErrorServerCertificateHasUnknownRoot = -1203, NSURLErrorServerCertificateNotYetValid = -1204, NSURLErrorClientCertificateRejected = -1205, NSURLErrorClientCertificateRequired = -1206, NSURLErrorCannotLoadFromNetwork = -2000, NSURLErrorCannotCreateFile = -3000, NSURLErrorCannotOpenFile = -3001, NSURLErrorCannotCloseFile = -3002, NSURLErrorCannotWriteToFile = -3003, NSURLErrorCannotRemoveFile = -3004, NSURLErrorCannotMoveFile = -3005, NSURLErrorDownloadDecodingFailedMidStream = -3006, NSURLErrorDownloadDecodingFailedToComplete = -3007 }

你可能感兴趣的:(2015-10-9--avplayer拖动导致卡顿)