fix: shuffle not working (#562)

This commit is contained in:
Kingkor Roy Tirtho 2023-07-08 21:58:57 +06:00 committed by GitHub
parent 0089d471ae
commit dc76634a6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;
}
}