Skip to content

🎥 Make videos programmatically with React

allow to set height and width

Jonny Burger34d9821cc504
diff --git a/packages/player-example/src/App.tsx b/packages/player-example/src/App.tsx
index 3deb8022f6..7c5d06efa1 100644
--- a/packages/player-example/src/App.tsx
+++ b/packages/player-example/src/App.tsx
@@ -38,6 +38,10 @@ export default function App() {
durationInFrames={500}
component={CarSlideshow}
controls
+ style={{
+ height: 200,
+ width: 200,
+ }}
loop={loop}
props={{
title: String(title),
diff --git a/packages/player/src/Player.tsx b/packages/player/src/Player.tsx
index a7098ae442..010f651e87 100644
--- a/packages/player/src/Player.tsx
+++ b/packages/player/src/Player.tsx
@@ -33,7 +33,7 @@ export type PlayerProps<T> = {
height: number;
fps: number;
controls?: boolean;
- style?: Omit<React.CSSProperties, 'height' | 'width'>;
+ style?: React.CSSProperties;
loop?: boolean;
autoPlay?: boolean;
} & PropsIfHasProps<T> &
diff --git a/packages/player/src/PlayerUI.tsx b/packages/player/src/PlayerUI.tsx
index d2e7333229..e9d4dedfa6 100644
--- a/packages/player/src/PlayerUI.tsx
+++ b/packages/player/src/PlayerUI.tsx
@@ -81,8 +81,9 @@ const PlayerUI: React.ForwardRefRenderFunction<
overflow: 'hidden',
width: config.width,
height: config.height,
+ ...style,
};
- }, [config]);
+ }, [config, style]);
const containerStyle: React.CSSProperties = useMemo(() => {
if (!config) {
@@ -94,9 +95,8 @@ const PlayerUI: React.ForwardRefRenderFunction<
width: '100%',
height: '100%',
overflow: 'hidden',
- ...style,
};
- }, [config, style]);
+ }, [config]);
const onError = useCallback(
(error: Error) => {