Closed ceciliasaraiva closed 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 inPlayerEngine.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.
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
New Monitor Class:
Sources/Player/PlaybackEngine/Internal/AVQueuePlayer/Observers/ItemPlayedToEndMonitor.swift
: IntroducedItemPlayedToEndMonitor
to observe when anAVPlayerItem
finishes playing and trigger a callback.Integration into
AVPlayerItemMonitor
:Sources/Player/PlaybackEngine/Internal/AVQueuePlayer/AVPlayerItemMonitor.swift
: AddedplayerItemDidPlayToEndTimeMonitor
to monitor when an item has played to the end.Updates to Player Wrappers
AVQueuePlayerWrapper
:Sources/Player/PlaybackEngine/Internal/AVQueuePlayer/AVQueuePlayerWrapper.swift
: Updated to handle theonItemPlayedToEnd
callback and remove the player item if a feature flag is set. [1] [2]AVQueuePlayerWrapperLegacy
:Sources/Player/PlaybackEngine/Internal/AVQueuePlayer/Legacy/AVQueuePlayerWrapperLegacy.swift
: Similarly updated to handle theonItemPlayedToEnd
callback and remove the player item if a feature flag is set. [1] [2] [3]