Since iOS 15 we've had quite a few reports from users having issues with live stream playback.
After some digging, it seems the following is happening.
- A user plays a live stream
- They put the app in the background
- They return at some point later and play the stream again, at this point the stream plays correctly.
- User rotates their phone to landscape, this triggers logic to remove the view that holds an AVPlayerLayer from its current view hierarchy, into a new one to display in fullscreen.
- At this point, the AVPlayer playback rate is set to 0 and stops streaming, a rateDidChange notification is fired with the reason AVPlayerRateDidChangeReasonAppBackgrounded
Has anyone else experienced this issue or have any guidance on why this might be happening? It seems like an AVFoundation bug as the rate change reason is fundamentally incorrect as the app is not in fact backgrounded.