playback: re-add old swap move
Turns out this did have a reason to exist, ExoPlayer doesn't have intrinsic capabilities to update the shuffle order on moves.
This commit is contained in:
parent
66db61899c
commit
8e5d061af5
1 changed files with 4 additions and 1 deletions
|
@ -21,7 +21,6 @@ package org.oxycblt.auxio.playback.service
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.media.audiofx.AudioEffect
|
import android.media.audiofx.AudioEffect
|
||||||
import android.os.Bundle
|
|
||||||
import androidx.media3.common.AudioAttributes
|
import androidx.media3.common.AudioAttributes
|
||||||
import androidx.media3.common.C
|
import androidx.media3.common.C
|
||||||
import androidx.media3.common.MediaItem
|
import androidx.media3.common.MediaItem
|
||||||
|
@ -329,12 +328,16 @@ class ExoPlaybackStateHolder(
|
||||||
|
|
||||||
val trueFrom = indices[from]
|
val trueFrom = indices[from]
|
||||||
val trueTo = indices[to]
|
val trueTo = indices[to]
|
||||||
|
// ExoPlayer does not actually update it's ShuffleOrder when moving items. Retain a
|
||||||
|
// semblance of "normalcy" by doing a weird no-op swap that actually moves the item.
|
||||||
when {
|
when {
|
||||||
trueFrom > trueTo -> {
|
trueFrom > trueTo -> {
|
||||||
player.moveMediaItem(trueFrom, trueTo)
|
player.moveMediaItem(trueFrom, trueTo)
|
||||||
|
player.moveMediaItem(trueTo + 1, trueFrom)
|
||||||
}
|
}
|
||||||
trueTo > trueFrom -> {
|
trueTo > trueFrom -> {
|
||||||
player.moveMediaItem(trueFrom, trueTo)
|
player.moveMediaItem(trueFrom, trueTo)
|
||||||
|
player.moveMediaItem(trueTo - 1, trueFrom)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
playbackManager.ack(this, ack)
|
playbackManager.ack(this, ack)
|
||||||
|
|
Loading…
Reference in a new issue