mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-28 16:00:31 +05:30
fix: button to play previous video doesnt work when repeat enabled
This commit is contained in:
parent
f60948696e
commit
ce9a7c27be
@ -47,7 +47,7 @@ object PlayingQueue {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// return the next item, or if repeating enabled, the first one of the queue
|
// return the next item, or if repeating enabled and no video left, the first one of the queue
|
||||||
fun getNext(): String? {
|
fun getNext(): String? {
|
||||||
val nextItem = queue.getOrNull(currentIndex() + 1)
|
val nextItem = queue.getOrNull(currentIndex() + 1)
|
||||||
if (nextItem != null) return nextItem.url?.toID()
|
if (nextItem != null) return nextItem.url?.toID()
|
||||||
@ -57,17 +57,14 @@ object PlayingQueue {
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
// return the previous item, or if repeating enabled, the last one of the queue
|
// return the previous item, or if repeating enabled and no video left, the last one of the queue
|
||||||
fun getPrev(): String? {
|
fun getPrev(): String? {
|
||||||
if (repeatMode != Player.REPEAT_MODE_ONE) {
|
val prevItem = queue.getOrNull(currentIndex() - 1)
|
||||||
queue.getOrNull(currentIndex() - 1)?.url?.toID()?.let { return it }
|
if (prevItem != null) return prevItem.url?.toID()
|
||||||
}
|
|
||||||
|
|
||||||
return when (repeatMode) {
|
if (repeatMode == Player.REPEAT_MODE_ALL) return queue.lastOrNull()?.url?.toID()
|
||||||
Player.REPEAT_MODE_ALL -> queue.lastOrNull()?.url?.toID()
|
|
||||||
Player.REPEAT_MODE_ONE -> currentStream?.url?.toID()
|
return null
|
||||||
else -> null
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun hasPrev() = getPrev() != null
|
fun hasPrev() = getPrev() != null
|
||||||
|
Loading…
x
Reference in New Issue
Block a user