mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2026-08-03 18:38:49 +02:00
Mark session as inactive if end of queue is reached.
Ensures UI shows paused and stops incrementing session time.
This commit is contained in:
@@ -768,6 +768,11 @@ class AudioPlayer: NSObject {
|
|||||||
if keyPath == #keyPath(AVPlayer.currentItem) {
|
if keyPath == #keyPath(AVPlayer.currentItem) {
|
||||||
NotificationCenter.default.post(name: NSNotification.Name(PlayerEvents.update.rawValue), object: nil)
|
NotificationCenter.default.post(name: NSNotification.Name(PlayerEvents.update.rawValue), object: nil)
|
||||||
logger.log("WARNING: Item ended")
|
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 {
|
} else {
|
||||||
super.observeValue(forKeyPath: keyPath, of: object, change: change, context: context)
|
super.observeValue(forKeyPath: keyPath, of: object, change: change, context: context)
|
||||||
|
|||||||
Reference in New Issue
Block a user