2

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

Akorda
  • 51
  • 4
  • Have you tried using a background queue? – skaak Nov 07 '20 at 02:32
  • Maybe far out of mind, what if H.264 becomes H.266 ? [Frauenhofer Institute](https://newsletter.fraunhofer.de/-viewonline2/17386/465/11/14SHcBTt/V44RELLZBp/1) Are you sure the remote mp4 encoding is H.264 and older asset management didn't complain. Would be amazing to see the remote file, well if its public url. – Ol Sen Nov 07 '20 at 15:17

0 Answers0