mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-28 16:00:31 +05:30
Respect queue settings when using player controls
This commit is contained in:
parent
d96acd85fc
commit
dfef007bd9
@ -42,18 +42,17 @@ object PlayingQueue {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// return the next item, or if repeating enabled, the first one of the queue
|
||||||
fun getNext(): String? = queue.getOrNull(currentIndex() + 1)?.url?.toID()
|
fun getNext(): String? = queue.getOrNull(currentIndex() + 1)?.url?.toID()
|
||||||
?: queue.firstOrNull()?.url?.toID()?.takeIf { repeatQueue }
|
?: queue.firstOrNull()?.url?.toID()?.takeIf { repeatQueue }
|
||||||
|
|
||||||
|
// return the previous item, or if repeating enabled, the last one of the queue
|
||||||
fun getPrev(): String? = queue.getOrNull(currentIndex() - 1)?.url?.toID()
|
fun getPrev(): String? = queue.getOrNull(currentIndex() - 1)?.url?.toID()
|
||||||
|
?: queue.lastOrNull()?.url?.toID()?.takeIf { repeatQueue }
|
||||||
|
|
||||||
fun hasPrev(): Boolean {
|
fun hasPrev() = getPrev() != null
|
||||||
return currentIndex() > 0
|
|
||||||
}
|
|
||||||
|
|
||||||
fun hasNext(): Boolean {
|
fun hasNext() = getNext() != null
|
||||||
return currentIndex() + 1 < size()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun updateCurrent(streamItem: StreamItem) {
|
fun updateCurrent(streamItem: StreamItem) {
|
||||||
currentStream = streamItem
|
currentStream = streamItem
|
||||||
|
Loading…
x
Reference in New Issue
Block a user