From dc76634a6e4ccdca0f09d63a2db82cce53d950d7 Mon Sep 17 00:00:00 2001 From: Kingkor Roy Tirtho Date: Sat, 8 Jul 2023 21:58:57 +0600 Subject: [PATCH] fix: shuffle not working (#562) --- lib/services/audio_player/mk_state_player.dart | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/services/audio_player/mk_state_player.dart b/lib/services/audio_player/mk_state_player.dart index 053cd89fc..5eb16e01d 100644 --- a/lib/services/audio_player/mk_state_player.dart +++ b/lib/services/audio_player/mk_state_player.dart @@ -128,6 +128,7 @@ class MkPlayerWithState extends Player { _playlist = null; _tempMedias = null; _playerStateStream.add(AudioPlaybackState.stopped); + _shuffleStream.add(false); } @override @@ -242,6 +243,12 @@ class MkPlayerWithState extends Player { play: true, ); } + + // replace in the _tempMedias if it's not null + if (shuffled && _tempMedias != null) { + final tempIndex = _tempMedias!.indexOf(media); + _tempMedias![tempIndex] = Media(newUrl, extras: media.extras); + } break; } }