mirror of
https://github.com/jellyfin/jellyfin-androidtv.git
synced 2024-11-23 05:49:50 +00:00
Reset queue index on end
Some checks are pending
Some checks are pending
With this change the queue index will always reset to -1 (INDEX_NONE) once the last item in the queue ends instead of leaving the last queue item active. This solves various issues in the UI (like the screensaver) where it keeps showing the last item when nothing is playing
This commit is contained in:
parent
ee1403aaad
commit
300346feb8
@ -54,7 +54,8 @@ class QueueService internal constructor() : PlayerService(), Queue {
|
||||
override fun onVideoSizeChange(width: Int, height: Int) = Unit
|
||||
override fun onMediaStreamEnd(mediaStream: PlayableMediaStream) {
|
||||
coroutineScope.launch {
|
||||
next(usePlaybackOrder = true, useRepeatMode = true)
|
||||
val nextItem = next(usePlaybackOrder = true, useRepeatMode = true)
|
||||
if (nextItem == null && _entryIndex.value != Queue.INDEX_NONE) setIndex(Queue.INDEX_NONE, true)
|
||||
}
|
||||
}
|
||||
})
|
||||
@ -91,7 +92,7 @@ class QueueService internal constructor() : PlayerService(), Queue {
|
||||
}
|
||||
|
||||
// Return item or null if not found
|
||||
return if (index < fetchedItems.size) fetchedItems[index]
|
||||
return if (index >= 0 && index < fetchedItems.size) fetchedItems[index]
|
||||
else null
|
||||
}
|
||||
|
||||
@ -144,7 +145,7 @@ class QueueService internal constructor() : PlayerService(), Queue {
|
||||
}
|
||||
|
||||
override suspend fun setIndex(index: Int, saveHistory: Boolean): QueueEntry? {
|
||||
if (index < 0) return null
|
||||
if (index < 0 && index != Queue.INDEX_NONE) return null
|
||||
|
||||
// Save previous index
|
||||
if (saveHistory && _entryIndex.value != Queue.INDEX_NONE) {
|
||||
|
Loading…
Reference in New Issue
Block a user