setShuffle method
Enables or disables shuffle for Player. Default is false
.
Implementation
@override
Future<void> setShuffle(bool shuffle, {bool synchronized = true}) {
Future<void> function() async {
if (disposed) {
throw AssertionError('[Player] has been disposed');
}
await waitForPlayerInitialization;
await waitForVideoControllerInitializationIfAttached;
if (shuffle == isShuffleEnabled) {
return;
}
isShuffleEnabled = shuffle;
await _command(
[
shuffle ? 'playlist-shuffle' : 'playlist-unshuffle',
],
);
}
if (synchronized) {
return lock.synchronized(function);
} else {
return function();
}
}