fix: shuffle not working

This commit is contained in:
Kingkor Roy Tirtho 2023-07-08 21:57:36 +06:00
parent 0089d471ae
commit 98912be24b

View File

@ -128,6 +128,7 @@ class MkPlayerWithState extends Player {
_playlist = null; _playlist = null;
_tempMedias = null; _tempMedias = null;
_playerStateStream.add(AudioPlaybackState.stopped); _playerStateStream.add(AudioPlaybackState.stopped);
_shuffleStream.add(false);
} }
@override @override
@ -242,6 +243,12 @@ class MkPlayerWithState extends Player {
play: true, 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; break;
} }
} }