mirror of
https://github.com/Boof2015/astra-mobile.git
synced 2026-08-12 05:10:52 +02:00
fix queue bug
This commit is contained in:
+4
-3
@@ -183,9 +183,10 @@ class QueuedAudioPlayer(
|
|||||||
*/
|
*/
|
||||||
fun move(fromIndex: Int, toIndex: Int) {
|
fun move(fromIndex: Int, toIndex: Int) {
|
||||||
exoPlayer.moveMediaItem(fromIndex, toIndex)
|
exoPlayer.moveMediaItem(fromIndex, toIndex)
|
||||||
val item = queue[fromIndex]
|
// Mirror ExoPlayer's remove-then-insert-at-toIndex semantics exactly, or this
|
||||||
queue.removeAt(fromIndex)
|
// metadata list drifts from the timeline and events report the wrong track.
|
||||||
queue.add(max(0, min(items.size, if (toIndex > fromIndex) toIndex else toIndex - 1)), item)
|
val item = queue.removeAt(fromIndex)
|
||||||
|
queue.add(max(0, min(queue.size, toIndex)), item)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user