Reloading keys in AVAsset when status is AVKeyValueStatusFailed

依然范特西╮ 提交于 2019-12-04 07:15:23
  1. Are you creating a new AVURLAsset or just reusing the previous one?
  2. In the completion handler for loadValuesAsynchronouslyForKeys:completionHandler: are you dispatching back to the main thread?

What happens if you call this method again (or something similar) when you're ready to retry.

- (void)setContentURL:(NSURL *)contentURL
{
    if (_contentURL != contentURL) {
        _contentURL = contentURL;

        AVURLAsset *asset = [AVURLAsset URLAssetWithURL:_contentURL options:nil];

        NSArray *requestedKeys = [NSArray arrayWithObjects:ISIVideoPlayerControllerTracksKey, ISIVideoPlayerControllerPlayableKey, nil];

        [asset loadValuesAsynchronouslyForKeys:requestedKeys completionHandler: ^{
             dispatch_async(dispatch_get_main_queue(), ^{
                 [self prepareToPlayAsset:asset withKeys:requestedKeys];
             });
         }];
    }
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!