AVURLAsset / AVPlayerItem blocks thread on init with poor connection

Hi

I am trying to play a remote video within a UITableViewCell and faced some strange behaviour:

If network condition is pure then attempt to initialize AVURLAsset(with: url) stuck and blocks the main thread (see stack trace in attachment).

I've managed to find only info about asynchronous loading additional meta for assets (like duration and e.t.c) and all that loading occur after init while my problem while init.

I've try using AVPlayerItem(url: url) instead but nothing changes as it uses AVURLAsset underlying so I see the very same stacktrace.

Is there any way to fix it and make asset to be loaded async after init?

Reproduces on iOS15 and iOS16. With poor network or network conditioner.

Hanging in AVAsset's initialization is definitely not expected, even when there is poor network connectivity. Could you file a report with a sysdiagnose when the problem reproduces? Thanks.

Hi I am also facing same issue? Did you got any reply from Apple after analyzing sysdiagnose file?

Thread 0 - com.apple.main-thread 12 AVFCore +0x12dd8 -[AVFigAssetInspectorLoader initWithURL:figAssetCreationFlags:figAssetCreationOptions:avAssetInitializationOptions:forAsset:figErr:] 13 AVFCore +0x117f4 _avurlasset_setupGuts 14 AVFCore +0x11214 -[AVURLAsset initWithURL:options:]

AVURLAsset / AVPlayerItem blocks thread on init with poor connection
 
 
Q