Skip to content

🎥 Make videos programmatically with React

width -> compositionHeight, also for height

Jonny Burgerc031cbf3e8dc
diff --git a/packages/docs/docs/player.md b/packages/docs/docs/player.md
index f8d61d91f1..3cbf81a016 100644
--- a/packages/docs/docs/player.md
+++ b/packages/docs/docs/player.md
@@ -56,11 +56,11 @@ The duration of the video in frames. Must be an integer and greater than 0.
The frame rate of the video.
-### `width`
+### `compositionWidth`
The width of the composition in pixels.
-### `height`
+### `compositionHeight`
The height of the composition in pixels.
@@ -82,6 +82,10 @@ _optional_
Whether the video should display a seek bar and a play/pause button. Default `false.`
+### `style`
+
+A regular `style` prop for a div element. You can pass a different height and width if you would like to choose different dimensions than the original composition dimensions.
+
## `PlayerRef`
You may attach a ref to the player and control it in an imperative manner.
@@ -219,10 +223,8 @@ This feature is implemented using an [error boundary](https://reactjs.org/docs/e
Before we mark the player as stable, we are looking to improve in the following areas:
-- Allow the player size to be a different size than the composition size.
- Better loading state than the current "Loading..." text.
- Implement keyboard controls.
-- Fullscreen support.
- Better props validation
- Customize error UI
diff --git a/packages/player-example/src/App.tsx b/packages/player-example/src/App.tsx
index 3deb8022f6..2dd3bbfec6 100644
--- a/packages/player-example/src/App.tsx
+++ b/packages/player-example/src/App.tsx
@@ -32,8 +32,8 @@ export default function App() {
<Player
autoPlay
ref={ref}
- width={500}
- height={432}
+ compositionWidth={500}
+ compositionHeight={432}
fps={30}
durationInFrames={500}
component={CarSlideshow}
diff --git a/packages/player/src/Player.tsx b/packages/player/src/Player.tsx
index 2bbb00108b..4eddc01356 100644
--- a/packages/player/src/Player.tsx
+++ b/packages/player/src/Player.tsx
@@ -29,8 +29,8 @@ type PropsIfHasProps<Props> = {} extends Props
export type PlayerProps<T> = {
durationInFrames: number;
- width: number;
- height: number;
+ compositionWidth: number;
+ compositionHeight: number;
fps: number;
controls?: boolean;
style?: React.CSSProperties;
@@ -46,8 +46,8 @@ Internals.CSSUtils.injectCSS(
export const PlayerFn = <T,>(
{
durationInFrames,
- height,
- width,
+ compositionHeight: height,
+ compositionWidth: width,
fps,
props,
controls,