Unknown errors -16834 and -12640 when obtaining key request data

There are two errors we're seeing regularly (though rarely; most playbacks succeed but every day a few of these errors occur), both of which are unknown. Both errors occur when calling [AVAssetResourceLoadingRequest streamingContentKeyRequestDataForApp:contentIdentifier:options:error:], and the underlying error codes are -16834 and -12640.


Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo={NSUnderlyingError=0x160465630 {Error Domain=NSOSStatusErrorDomain Code=-16834 "(null)"}, NSLocalizedFailureReason=An unknown error occurred (-16834), NSLocalizedDescription=The operation could not be completed}


Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo=0x172471440 {NSUnderlyingError=0x170a49330 "The operation couldn’t be completed. (OSStatus error -12640.)", NSLocalizedFailureReason=An unknown error occurred (-12640), NSLocalizedDescription=The operation could not be completed}


Are there any hints as to what could be causing these errors when trying to stream a FairPlay video? I've already read the "Re: Fairplay SPC returning nil" thread, but I don't think it's really applicable because our playlists contain EXT-X-KEY (and most of our playbacks succeed).

I do have the same error. Unfortunately i cannot play encrypted video at all (SKC is always returned nil with this error).

Hi,


I am assuming that these errors are being logged from remote devices via TestFlight (or similar)?


have you considered that these devices may be JailBroken or tampered with in any way? Maybe the iOS versions reported might give you a clue...

Yes, we're seeing these errors from active users of our app, but their devices aren't (necessarily) JailBroken. I've managed to reproduce this issue on my iPhone 6 (running iOS 9.1) which is definitely not JailBroken. Unfortunately when I was able to reproduce this last year I couldn't find a root cause, and now I'm no longer able to reproduce it locally on my device, even though we still get regular reports of users encountering this error.


As for OS version, we've gotten reports of this happening on iOS 9.1, 9.2.X, 9.3.X, 10.0.X and others, so it's not isolated to a specific iOS version.


[edit: Seriously, Apple? You filter out J-A-I-L as **** on this forum? *sigh*]

Well i managed to fix that error on my side. I cannot really say what i did that helped (since i was doing a lot) but i did the following steps:
Added all properties to m3u8 that were used by apple demo.

Re-encoded all the videos.


I found out that error -12640 had something to do with bad m3u8. Not bad as in corrupted, but bad as in not using the required properties. In my case, i used everything except KEYFORMAT property (because i found in some docs that it is optional. It isn't).

Also i have an idea:

Maybe some users have no/poor connection to your licensing server?


Maybe you could create yourself a test environment where server does not respond or responds with huge timeouts? Or maybe doesn't respond at all?

Unknown errors -16834 and -12640 when obtaining key request data
 
 
Q