Is there any other way to check whether an AVPlayerItem
has ended except with NotificationCenter.default.addObserver(self, selector: #selector(hasEnded), name: .AVPlayerItemDidPlayToEndTime, object: player.currentItem)
? I am asking because when an item finishes it triggers the function and I seek the item to 0. Afterwards when it finishes for a second time it doesn't want to enter the hasEnded
method for a second time on this item. If there is a way to fix this method I would be happy to learn it.
I tried with NotificationCenter.default.publisher()
as well.
Asked
Active
Viewed 33 times
0

Boyan Pavlov
- 61
- 6
-
Can you use the rate of avplayer to determine if a item has stopped playing. – Patrick Koning Mar 04 '23 at 15:51