AVAsset/AVURLAsset playable property not accurate on iPhone 5S

Originator:maxime.chapelet
Number:rdar://25873955 Date Originated:22-Apr-2016 11:17 AM
Status:Open Resolved:No
Product:iOS SDK Product Version:
Classification:2 - Important Reproducible:Always
 
Summary:
Hi guys,

I am currently experiencing a weird issue with AVAsset/AVURLAsset class.
I am implementing a method to know if our video media format is compatible with the iOS device.

- (void)checkVideoPlaybackSupport:(void (^)(BOOL isPlaybackSupported))result {
  static NSString *const compatibilityVideo = @"Medias/compatibility.mp4";
  NSString *const path = [[NSBundle mainBundle]
       pathForResource:compatibilityVideo
                 ofType:nil];
  NSURL *const url = [NSURL fileURLWithPath:path];
  __block AVAsset *asset = [AVAsset assetWithURL:url];
  [asset loadValuesAsynchronouslyForKeys:@[@"tracks"]
       completionHandler:^{
            dispatch_async(dispatch_get_main_queue(),^{
                 BOOL isPlayable = YES;
                 for (AVAssetTrack *track in asset.tracks) {
                      if(!track.isPlayable){
                           isPlayable = NO;
                      }
                 }
                 if (result) {
                      result(isPlayable);
                 }
            });
  }];
}

On iPhone 5, the AVAsset isPlayable property returns NO, and it's video AVAssetTrack isPlayable property returns NO.
Bypassing the isPlayable property check, the media does not play at all in an AVPlayer either, on iPhone 5.

On iPhone 5S with iOS 9.2.1, the AVAsset isPlayable property returns NO, and it's video AVAssetTrack isPlayable property returns NO.
BUT, bypassing the isPlayable property check, the media plays properly in an AVPlayer on iPhone 5S.

On iPhone 6Plus with iOS 9.3.1, the AVAsser isPlayable property returns YES, and it's video AVAssetTrack isPlayable property returns YES.
The media playes properly on iPhone 6Plus as expected.

I was wondering why it plays on iPhone 5S when the isPlayable property says the opposite ?
If it's a bug from the iOS SDK, is there a workaround to know if a media is playable without playing it to see if it can play ?
Is it related to the device ? the iOS version ? How could it be figured out ?
Should I fill a radar about it ?
I just read this one http://www.openradar.me/19703131‌ and it will never be addressed...
Our biggest concern is to have to buy as many device as we may have to, to be able to check this behaviour on every device we want to target, just because the SDK does not seems to be accurate about this property check.
Any help will be appreciated.

Best regards

Steps to Reproduce:
1. Load the attached media as an AVAsset like in the code in the description
2. Test it on iPhone 5S
3. [AVAsset isPlayable] will return NO
4. When an attempt to play with an AVPlayer, the asset plays properly

Expected Results:
[AVAsset isPlayable] should return YES
[AVAssetTrack isPlayable] should return YES

Actual Results:
[AVAsset isPlayable] returns NO
[AVAssetTrack isPlayable] returns NO

Version:
iOS 9.2.1 (13D15)

Notes:


Configuration:
iPhone 5S 16GB

Attachments:

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!