From 25a946f64d18ffcde9cdd0eb309a63b09fed2c0d Mon Sep 17 00:00:00 2001 From: Pete Cook Date: Sat, 23 Mar 2019 13:46:30 +0000 Subject: [PATCH] Pass controls prop through to preload players Fixes https://github.com/CookPete/react-player/issues/587 --- src/ReactPlayer.js | 4 ++-- src/preload.js | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ReactPlayer.js b/src/ReactPlayer.js index f469bf2f..fda66067 100644 --- a/src/ReactPlayer.js +++ b/src/ReactPlayer.js @@ -119,12 +119,12 @@ export default class ReactPlayer extends Component { return 0 } render () { - const { url, style, width, height, light, wrapper: Wrapper } = this.props + const { url, controls, style, width, height, light, wrapper: Wrapper } = this.props const { showPreview } = this.state const otherProps = omit(this.props, SUPPORTED_PROPS, DEPRECATED_CONFIG_PROPS) const activePlayer = this.getActivePlayer(url) const renderedActivePlayer = this.renderActivePlayer(url, activePlayer) - const preloadPlayers = renderPreloadPlayers(url, this.config) + const preloadPlayers = renderPreloadPlayers(url, controls, this.config) const players = [ renderedActivePlayer, ...preloadPlayers ].sort(this.sortPlayers) if (showPreview && url) { return ( diff --git a/src/preload.js b/src/preload.js index cefb8ec2..6568b601 100644 --- a/src/preload.js +++ b/src/preload.js @@ -29,7 +29,7 @@ const PRELOAD_PLAYERS = [ } ] -export default function renderPreloadPlayers (url, config) { +export default function renderPreloadPlayers (url, controls, config) { const players = [] for (let player of PRELOAD_PLAYERS) { @@ -39,6 +39,7 @@ export default function renderPreloadPlayers (url, config) { key={player.Player.displayName} activePlayer={player.Player} url={player.url} + controls={controls} playing muted style={{ display: 'none' }}