From 19ef693b3807257a4f6f9e194dbf81aee959f581 Mon Sep 17 00:00:00 2001 From: Jacques Yakoub Date: Wed, 17 Jul 2024 20:36:48 +0200 Subject: [PATCH] feat: add shufflePlaylist parameter to Youtube player https://github.com/cookpete/react-player/issues/1864 --- src/players/YouTube.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/players/YouTube.js b/src/players/YouTube.js index 8498c617..4499be5e 100644 --- a/src/players/YouTube.js +++ b/src/players/YouTube.js @@ -28,7 +28,7 @@ export default class YouTube extends Component { } load (url, isReady) { - const { playing, muted, playsinline, controls, loop, config, onError } = this.props + const { playing, muted, playsinline, controls, loop, shufflePlaylist, config, onError } = this.props const { playerVars, embedOptions } = config const id = this.getID(url) if (isReady) { @@ -65,6 +65,9 @@ export default class YouTube extends Component { if (loop) { this.player.setLoop(true) // Enable playlist looping } + if (shufflePlaylist) { + this.player.setShuffle(shufflePlaylist) // Enable playlist shuffling + } this.props.onReady() }, onPlaybackRateChange: event => this.props.onPlaybackRateChange(event.data),