Player queue

This commit is contained in:
2024-08-28 01:23:37 +08:00
parent 5a53fc7268
commit 785da526d3
6 changed files with 250 additions and 9 deletions

View File

@@ -311,6 +311,15 @@ class AudioPlayerProvider extends GetxController {
newIndex > state.value.tracks.length - 1 ||
oldIndex > state.value.tracks.length - 1) return;
final item = state.value.playlist.medias.removeAt(oldIndex);
state.value = state.value.copyWith(
playlist: state.value.playlist.copyWith(
medias: state.value.playlist.medias
..insert(oldIndex < newIndex ? newIndex - 1 : 0, item),
),
);
await audioPlayer.moveTrack(oldIndex, newIndex);
}