如果服务器上没有文件(或其他服务器错误),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
}
}
答案 0 :(得分:0)
如果在ios9.0 +上。 检查AVPlayItem是否canUseNetworkResourcesForLiveStreamingWhilePaused是否为。