-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add player item monitor for when an item reaches the end when action at end is none #133
Add player item monitor for when an item reaches the end when action at end is none #133
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
@objc | ||
private func playerItemDidPlayToEndTime(notification: Notification) { | ||
if let playerItem = notification.object as? AVPlayerItem { | ||
print("--> PlayerItemDidPlayToEndTimeMonitor.playerItemDidPlayToEndTime(notification: \(notification))") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be deleted, or convert into a proper Player Log?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, deleted, I always add a lot of prints to get the whole flow, will delete it.
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 |
Continuation of logic for when the item reaches the end.
First part here: #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]