diff --git a/just_audio_background/CHANGELOG.md b/just_audio_background/CHANGELOG.md index 5e945226c..ac0472ff8 100644 --- a/just_audio_background/CHANGELOG.md +++ b/just_audio_background/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.0.1-beta.14 + +* Fix shuffleOrder when mutating ConcatenatingAudioSource (@jonmarkhall). + ## 0.0.1-beta.13 * Support rxdart 0.28.x. diff --git a/just_audio_background/lib/just_audio_background.dart b/just_audio_background/lib/just_audio_background.dart index 028c7ac07..4be09ce05 100644 --- a/just_audio_background/lib/just_audio_background.dart +++ b/just_audio_background/lib/just_audio_background.dart @@ -523,6 +523,8 @@ class _PlayerAudioHandler extends BaseAudioHandler ConcatenatingInsertAllRequest request) async { final cat = _source!.findCat(request.id)!; cat.children.insertAll(request.index, request.children); + cat.shuffleOrder + .replaceRange(0, cat.shuffleOrder.length, request.shuffleOrder); _updateShuffleIndices(); _broadcastStateIfActive(); _updateQueue(); @@ -533,6 +535,8 @@ class _PlayerAudioHandler extends BaseAudioHandler ConcatenatingRemoveRangeRequest request) async { final cat = _source!.findCat(request.id)!; cat.children.removeRange(request.startIndex, request.endIndex); + cat.shuffleOrder + .replaceRange(0, cat.shuffleOrder.length, request.shuffleOrder); _updateShuffleIndices(); _broadcastStateIfActive(); _updateQueue(); @@ -544,6 +548,8 @@ class _PlayerAudioHandler extends BaseAudioHandler final cat = _source!.findCat(request.id)!; cat.children .insert(request.newIndex, cat.children.removeAt(request.currentIndex)); + cat.shuffleOrder + .replaceRange(0, cat.shuffleOrder.length, request.shuffleOrder); _updateShuffleIndices(); _broadcastStateIfActive(); _updateQueue(); diff --git a/just_audio_background/pubspec.yaml b/just_audio_background/pubspec.yaml index a3247ec47..969fdf441 100644 --- a/just_audio_background/pubspec.yaml +++ b/just_audio_background/pubspec.yaml @@ -1,7 +1,7 @@ name: just_audio_background description: An add-on for just_audio that supports background playback and media notifications. homepage: https://github.com/ryanheise/just_audio/tree/master/just_audio_background -version: 0.0.1-beta.13 +version: 0.0.1-beta.14 topics: - audio - sound