Mark session as inactive if end of queue is reached.

Ensures UI shows paused and stops incrementing session time.
This commit is contained in:
Adam Traeger
2025-03-13 22:48:06 -05:00
parent e7c3242765
commit c72f7cddc8
+5
View File
@@ -768,6 +768,11 @@ class AudioPlayer: NSObject {
if keyPath == #keyPath(AVPlayer.currentItem) {
NotificationCenter.default.post(name: NSNotification.Name(PlayerEvents.update.rawValue), object: nil)
logger.log("WARNING: Item ended")
if audioPlayer.currentItem == nil {
logger.log("Player ended or next item is nil, marking ended")
self.markAudioSessionAs(active: false)
}
}
} else {
super.observeValue(forKeyPath: keyPath, of: object, change: change, context: context)