From c72f7cddc8916f53b03de86ad4130e669fc15ebe Mon Sep 17 00:00:00 2001 From: Adam Traeger Date: Thu, 13 Mar 2025 22:48:06 -0500 Subject: [PATCH] Mark session as inactive if end of queue is reached. Ensures UI shows paused and stops incrementing session time. --- ios/App/Shared/player/AudioPlayer.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ios/App/Shared/player/AudioPlayer.swift b/ios/App/Shared/player/AudioPlayer.swift index 80cb9010..8231fbd9 100644 --- a/ios/App/Shared/player/AudioPlayer.swift +++ b/ios/App/Shared/player/AudioPlayer.swift @@ -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)