Reputation: 51
We've been using the same AVAsset loader methods for five years. Recently, with the release of iOS 14.2, the loader methods fail now. Specifically, when trying to read meta-data within an h.264 encoded mp4 it consistently returns "this media may be damaged". This only happens with remote loaded mp4s using https.
Here is an example using a resourceLoader class to assist with remote urls.
AVURLAsset *mAsset = [AVURLAsset URLAssetWithURL:URL options:nil];
[mAsset.resourceLoader setDelegate:self->mAssetResourceLoader queue:dispatch_get_main_queue()];
[mAsset loadValuesAsynchronouslyForKeys:@[@"availableMetadataFormats"] completionHandler:^{
// Setup
NSError *error = nil;
RLScene *scene = nil;
AVKeyValueStatus status = [mAsset statusOfValueForKey:@"availableMetadataFormats" error:&error];
switch (status) {
case AVKeyValueStatusLoaded:
NSLog(@"Sucessfully loaded, continue processing");
break;
case AVKeyValueStatusFailed:
NSLog(@"Examine NSError pointer to determine failure");
break;
case AVKeyValueStatusCancelled:
NSLog(@"Loading cancelled");
break;
default:
NSLog(@"Handle all other cases");
break;
}
NSLog(@" %@", error.localizedFailureReason);
The above will not return a readable status. The error will always return "this media may be damaged" only in 14.2. It is successful otherwise going back to iOS 10
Upvotes: 2
Views: 205