This way
Trying to get Shuffle Playlist to work
I find it useful in certain situations.
For instance, if autoplay is being used, or if it is not being used.
Works good for both instances.
https://jsfiddle.net/knrb1w09/
function onPlayerReady(event) {
player = event.target;
player.setVolume(100); // percent
}
let hasShuffled = false;
function onPlayerStateChange(event) {
player = event.target;
const shufflePlaylist = true;
if (!hasShuffled) {
player.setShuffle(shufflePlaylist);
player.playVideoAt(0);
hasShuffled = true;
}