setShuffle method

  1. @override
Future<void> setShuffle({
  1. required bool shufflePlaylists,
})

This function indicates whether a playlist's videos should be shuffled so that they play back in an order different from the one that the playlist creator designated. If you shuffle a playlist after it has already started playing, the list will be reordered while the video that is playing continues to play. The next video that plays will then be selected based on the reordered list.

This setting will not persist if you load or cue a different playlist, which means that if you load a playlist, call the setShuffle function, and then load a second playlist, the second playlist will not be shuffled.

If shufflePlaylists is true, then YouTube will shuffle the playlist order. If you instruct the function to shuffle a playlist that has already been shuffled, YouTube will shuffle the order again.

Implementation

@override
Future<void> setShuffle({required bool shufflePlaylists}) {
  return _eval('player.setShuffle($shufflePlaylists)');
}