AVPlayerItemDidPlayToEndTimeNotification doesn't fire on iOS 13 Beta 4

When a video reaches to the end, "AVPlayerItemDidPlayToEndTimeNotification" doesn't not fire. Instead, sometimes I saw "AVPlayerItemPlaybackStalledNotification" is triggered when the video playback reaches the end. However, it works correctly on iOS 12 and below.



[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playerItemDidReachEnd:) name:AVPlayerItemDidPlayToEndTimeNotification object:avPlayerItem];

.....

- (void)playerItemDidReachEnd:(NSNotification *)notification {

// This handler is never been called on iOS 13 Beta and tvOS 13 Beta

}


We rely on reading this observer notifcation to signal the video has been reached to the end. Without the correct notification, the video will be handing to the end.

Replies

I am seeing the same behavior, for what its worth it seems like AVPlayerItemDidPlayToEndTimeNotification does fire correctly with the following sample app from Apple: https://developer.apple.com/library/archive/samplecode/AVPlayerDemo/

(you will have to comment out the lines: check( dispatch_get_current_queue() == assetQueue ); )


I have not yet narrowed down why it works in the demo app and not my app.

I belive that this is a bug.

  • Using the aforementioned sample app, place a breakpoint in the method playerItemDidReachEnd: in AVPlayerDemoPlaybackViewController.
  • Play a local video as intended
  • Note that at the end of playback the breakpoint is hit 👍


Reproducing the issue:


I believe that there is an issue with AVPlayerItem not correctly firing AVPlayerItemDidPlayToEndTimeNotification when a HLS based asset reaches the end of playback. At least that is the conculsion I came to based on the research I did today.

Hi,


I am also facing the same issue.


AVPlayerItemDidPlayToEndTimeNotification doesn't get called most of the time for the offline HLS based asset.

However, I have also noticed, sometimes it gets called very quickly, as soon as I start the downloaded song. The song starts and then end since this time it received the AVPlayerItemDidPlayToEndTimeNotification but very early without finishing the complete playback of the downloaded song.


This issue is occurred in iOS 13, 13.1 beta.
Do you guys have any alternative or suggestion?
For now, I have filled an issue with Apple using Feedback assistance. Waiting for their reply.

Hi,


I am also facing the same issue. We are using AVQueuePlayer.


I tried sample from Apple: https://developer.apple.com/library/archive/samplecode/AVPlayerDemo/. It is working fine, when i change AVPlayer to AVQueuePlayer it also stop recieving AVPlayerItemDidPlayToEndTimeNotification. So i think this issue with AVQueuePlayer.


This issue is occurred in iOS 13, 13.1 beta. It is working fine till iOS 12.X.


I didn't tried use of AVPlayer in my project, i will change in project once and after that update here.