I'm doing the following:
AVAsset
with a given URL. That URL points to a video on a remote web server.tracks
property by calling loadValuesAsynchronouslyForKeys:completionHandler:
statusOfValueForKey:error:
loadValuesAsynchronouslyForKeys:completionHandler:
again.Here's where the problems begin. I would imagine that the AVAsset
goes ahead and attempts to reload the tracks property since it failed previously. However, this does not seem to happen. statusOfValueForKey:error:
will still return AVKeyValueStatusFailed
, although a working internet connection is available and the video is playable.
Is there a way to reset the state for this given property and to attempt another load? Is there another way to work around this?
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];
});
}];
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With