Thanks for being a part of WWDC25!

How did we do? We’d love to know your thoughts on this year’s conference. Take the survey here

AVPlayer periodic time observer stops notifying when switching back from AirPlay to local playback

The app registers a periodic time observer to the AVPlayer when the playback starts and it works fine. When switching to AirPlay during playback, the periodic time observation continues working as expected.

However, when switching back to local playback, the periodic time observer does not fire anymore until a seek is performed. The app removes the periodic time observer only when the playback stops.

I can see that when switching back to local playback, the timeControlStatus successively changes

  1. to .waitingToPlayAtSpecifiedRate (reason: .evaluatingBufferingRate)
  2. then to .waitingToPlayAtSpecifiedRate (reason: .toMinimizeStalls)
  3. and finally to .playing

But the time observation does not work anymore.

Also, the issue is systematic with Live and VOD streams providing a program date (with HLS property #EXT-X-PROGRAM-DATE-TIME), with or without any DRM, and is never reproduced with other VOD streams.

Actually the problem is even worse: the AVPlayer.currentTime() does not change anymore after the playback transitions from AirPlay (to an Apple TV) to local despite the playback still ongoing.

Also, it's worth noting that when the issue occurs, AVPlayer.currentDate() is properly updated.

So the problem is probably not related to the periodic time observation but rather to the AVPlayer.currentTime() not being updated anymore when switching from AirPlay to local playback.

I have reported the issue with Feedback assistant: https://feedbackassistant.apple.com/feedback/17172515

I have also included a sample project allowing to easily reproduce the issue.

AVPlayer periodic time observer stops notifying when switching back from AirPlay to local playback
 
 
Q