如果服务器上没有文件(或另一个服务器错误),AVPlayer 返回一个错误 5-10 秒。如何设置超时?
示例:
let assetKeys = ["playable", "tracks", "duration"]
asset.loadValuesAsynchronouslyForKeys(assetKeys) {
var loaded = false
for assetKey in assetKeys {
var error: NSError?
let status = asset.statusOfValueForKey(assetKey, error: &error)
loaded = status == .Loaded
}
if !loaded {
// error in 5-10 sec
}
}
如果在 ios9.0+ 上。 检查 AVPlayItem canUseNetworkResourcesForLiveStreamingWhilePaused 是否为 YES。
关于ios - AVPlayer/AVPlayerItem 返回播放错误太慢,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40088660/
欢迎光临 OGeek|极客世界-中国程序员成长平台 (https://ogeek.cn/) | Powered by Discuz! X3.4 |