Downloaded HLS FairPlay content stalls on first playback

We have a situation where downloaded HLS content can stall, most frequently on first playback. The concrete steps I can use to replicate this issue are:

- Downloads HLS content

- Force kill the app

- Relaunch the app

- Play the downloaded content


If we get a Notification when listening for Notification.Name.AVPlayerItemNewErrorLogEntry we get the following error


<AVPlayerItemErrorLog: 0x281b13bb0>

#Version: 1.0

#Software: AppleCoreMedia/1.0.0.16D57 (iPhone; U; CPU OS 12_1_4 like Mac OS X; en_us)

#Date: 2019/07/11 15:54:15.015

#Fields: date time uri cs-guid s-ip status domain comment cs-iftype

2019/07/11 15:54:15.015 (License server URI) B9ECC2F4-4D52-4178-8E72-546AC90CDCC4 - -12885 "CoreMediaErrorDomain" - unknown


The odd part is if we check that we are playing downloaded content and that the AVPlayer status is == .readyToPlay, calling play() on the player will get playback to start 80% of the time. The other 20% (and 100% reproducible using the above ^ steps listed) will cause our observer on the timeControlStatus property to fire with the value == .waitingToPlayAtSpecifiedRate, at that point the player's .reasonForWaitingToPlay property == AVPlayer.WaitingReason.toMinimizeStalls, and the player's currentItem's property .isPlaybackBufferEmpty == true. Once in this state, the only way to get playback to start is to seek forward 1 second (or if the user uses the UISlider to seek to a new position within the content). If the user kills the app and relaunches, the player will remain in this "buffering" state. Or if we call play(), or pause() then play() on the player, (either in code or though the user tapping the play button) playback will never start. Backing out of the player and immediately restarting the content also fixes the issue, but that's a horrible user experience. Also, using a manual seek will correct this issue and stop it from happening again if the app is dismissed and relaunched.


Any advice on how to get out of this state without seeking? Or info about how or why the AVPlayer would be in this state when the content is downloaded and readily available on disk?