tidal-music / tidal-sdk-ios

TIDAL SDK for iOS
Apache License 2.0
16 stars 1 forks source link

Add player item monitor for when an item reaches the end when action at end is none #133

Closed ceciliasaraiva closed 2 weeks ago

ceciliasaraiva commented 2 weeks ago

Continuation of logic for when the item reaches the end. First part here: https://github.com/tidal-music/tidal-sdk-ios/pull/110

Here, I've added a monitor for when the player item reached the end. At that moment, since we don't automatically perform any action automatically, I remove it from the player when the FF is enabled.

I continue testing to see if there's any scenario which I might have missed.


This pull request introduces a new feature to handle the event when an AVPlayerItem finishes playing. It adds a new monitor class and integrates it into the existing player wrapper classes.

New Feature: Item Played to End Monitoring

Updates to Player Wrappers

ceciliasaraiva commented 2 weeks ago

With this new event and flag, does playerItemChanged(oldPlayerItem: AVPlayerItem) get called?

The way I understand this works is that the current item ends, it is removed and we call completed() to the delegates, which ends up in PlayerEngine.completed()calling play in the next(new current) item. Is that correct?

It's still being called. When we remove the old item from player, it's same as advancing to the next item, my guess is that when we call remove again in the playerItemChanged, if not present, nothing happens and then it proceeds to completed as you described above.