Skip to content

🎥 Make videos programmatically with React

clickToPlay only is true by default if controls are enabled

Jonny Burger41cf399be515
diff --git a/packages/docs/docs/player.md b/packages/docs/docs/player.md
index e9d8f28f94..49af428450 100644
--- a/packages/docs/docs/player.md
+++ b/packages/docs/docs/player.md
@@ -103,7 +103,7 @@ Whether the video can go fullscreen. By default true.
_optional_
-A boolean property defining whether you can play, pause or resume the video with a single click into the player. Default true.
+A boolean property defining whether you can play, pause or resume the video with a single click into the player. Default `true` if `controls` are true, otherwise `false`.
### `doubleClickToFullscreen`
diff --git a/packages/player/src/Player.tsx b/packages/player/src/Player.tsx
index 7e16639bb1..a201ad023c 100644
--- a/packages/player/src/Player.tsx
+++ b/packages/player/src/Player.tsx
@@ -65,7 +65,7 @@ export const PlayerFn = <T,>(
autoPlay = false,
showVolumeControls = true,
allowFullscreen = true,
- clickToPlay = true,
+ clickToPlay,
doubleClickToFullscreen = false,
...componentProps
}: PlayerProps<T>,
@@ -249,7 +249,11 @@ export const PlayerFn = <T,>(
style={style}
inputProps={passedInputProps}
allowFullscreen={Boolean(allowFullscreen)}
- clickToPlay={Boolean(clickToPlay)}
+ clickToPlay={
+ typeof clickToPlay === 'boolean'
+ ? clickToPlay
+ : Boolean(controls)
+ }
showVolumeControls={Boolean(showVolumeControls)}
setMediaVolume={setMediaVolumeAndPersist}
mediaVolume={mediaVolume}