HLS Video in Simulator getting `segPumpRequestCustomURLForCryptKey` crash:

I have some HLS videos that are encrypted with a key for streaming playback in my app. So far, my testing indicates that they work on device all the way through, but only in the simulator up to iOS 14.5. In iOS 15 simulators, I get a crash that appears to be within private APIs with this copied from the stack:

#0	0x0000000110584e8c in segPumpRequestCustomURLForCryptKey ()

Is anyone else getting this crash?

Post not yet marked as solved Up vote post of mredig Down vote post of mredig
2.6k views
  • It appears to be centered around the usage of a custom scheme in the HLS m3u8 file link to the encryption key: if I use http(s) to link the encryption key, it works fine. If I use something custom like fakey, it never even makes it to the delegate method for AVAssetResourceLoaderDelegate called resourceLoader(_ resourceLoader: AVAssetResourceLoader, shouldWaitForLoadingOfRequestedResource loadingRequest: AVAssetResourceLoadingRequest) where I'd swap out the scheme for a real one, because it crashes first. So far, I can only replicate this on the iOS 15 simulator.

    I've opened a feedback: FB9764319

  • I've been seeing this crash as well. That is, attempting to using a custom url scheme to retrieve an HLS key results in crash on simulator. iOS device appears to run fine, however.

Add a Comment

Replies

I was able to stop the crash by adding KEYFORMAT="indentity" to the #EXT-X-KEY tag in the .m3u8 files. (I'm guessing the bug involves an Xcode assumption that we're using FairPlay for encryption when utilizing a custom url scheme.)

Still can't get AVAssetResourceLoaderDelegate to fire in the Simulator, though...

  • Update: While adding KEYFORMAT="indentity" to the #EXT-X-KEY tag in the m3u8 file did prevent the aforementioned crash on Simulator, strangely, this tag edit now prevents the AVAssetResourceLoaderDelegate from getting called on the device.

  • Update 2: Revisiting this for 15.2 and adding the KEYFORMAT="identity" no longer prevents crash on Simulator. Maybe it was just a fluke that it worked before...? Anyway, HLS w/custom url scheme still works on device, just not on Xcode Simulator.

Add a Comment

I've been seeing this crash as well.

Facing this issue too, and it's not work while adding KEYFORMAT="indentity" to the #EXT-X-KEY tag...

same here. this makes using the simulator impossible for us... :( we use HLS with key, no FairPlay

Thread 17 Crashed::  Dispatch queue: com.apple.root.default-qos
0   MediaToolbox                  	       0x11e995ac1 segPumpRequestCustomURLForCryptKey + 282
1   <translation info unavailable>	       0x10e0d17dc ???
2   MediaToolbox                  	       0x11e985cd4 segPumpSendCryptKeyRequest + 1167
3   MediaToolbox                  	       0x11e97d1f9 segPumpReadNextCryptKeyForStream + 181
4   MediaToolbox                  	       0x11e99ece2 segPumpStreamDoDeliveryFollowUp + 1126
5   MediaToolbox                  	       0x11e9a71f9 segPumpDeliverNextMediaForAllStreams + 598
6   MediaToolbox                  	       0x11e9a606b segPumpOpen + 1618
7   MediaToolbox                  	       0x11e6cf1a1 fpfsi_NowReadyForInspection + 1131
8   MediaToolbox                  	       0x11e6f9282 fpfsi_deferredAssetBatchPropertyLoadComplete + 151
9   CoreMedia                     	       0x1135337b1 figDeferredNotificationDispatchFunction + 39
10  libdispatch.dylib             	       0x117078b25 _dispatch_client_callout + 8
11  libdispatch.dylib             	       0x117089475 _dispatch_root_queue_drain + 781
12  libdispatch.dylib             	       0x117089c5e _dispatch_worker_thread2 + 155
13  libsystem_pthread.dylib       	       0x11767302e _pthread_wqthread + 256
14  libsystem_pthread.dylib       	       0x117671ffb start_wqthread + 15

Please file a bug, including sample content.