Skip to content

🎥 Make videos programmatically with React

update player API

Jonny Burger2c27b555de98
diff --git a/packages/player/README.md b/packages/player/README.md
index 5ba5187da4..ecc564ded7 100644
--- a/packages/player/README.md
+++ b/packages/player/README.md
@@ -1,83 +1,86 @@
### Remotion Player
-[![NPM Version](http://img.shields.io/npm/v/@remotion/player.svg?style=flat)](https://www.npmjs.org/package/@remotion/player)
+[![NPM Version](https://img.shields.io/npm/v/@remotion/player.svg?style=flat)](https://www.npmjs.org/package/@remotion/player)
[![NPM Downloads](https://img.shields.io/npm/dm/@remotion/player.svg?style=flat)](https://npmcharts.com/compare/@remotion/player?minimal=true)
[![Install Size](https://packagephobia.now.sh/badge?p=@remotion/player)](https://packagephobia.now.sh/result?p=@remotion/player)
-To use this package, we'll be assuming you already have the required setup to use Remotion. The dependencies that Remotion requires you to have pre-installed on your machine are Node.js and FFMPEG. You can take a look at this [guide](https://github.com/adaptlearning/adapt_authoring/wiki/Installing-FFmpeg) on how to get FFMPEG on your machine.
+The `@remotion/player` package allows you to embed a video powered by Remotion in a React application.
+## Installation and prerequisites
-The `@remotion/player` package allows you to include a video powered by Remotion in a React application. To get started with using this package, you need to have this package installed as a dependency in your project.
+The dependencies that Remotion requires you to have pre-installed on your machine are Node.js and FFMPEG. You can take a look at this [guide](https://github.com/adaptlearning/adapt_authoring/wiki/Installing-FFmpeg) on how to get FFMPEG on your machine.
-The command below does that for you.
+Install this package and Remotion with the package manager that you use for project:
```bash
-npm install @remotion/player
+npm i remotion @remotion/player
```
-There are other package managers that you can use to get this dependency in your projects. We have [yarn](https://yarnpkg.com/) and [pnpm](https://pnpm.io/). You can go with whichever one is the most convenient for you. Below are the commands that will get the package into your project.
-
```bash
-yarn add @remotion/player
+yarn add remotion @remotion/player
```
```bash
-pnpm install @remotion/player
+pnpm i remotion @remotion/player
```
-## remotion/player in action.
+> Make sure all Remotion packages you install (`remotion`, `@remotion/player`, `@remotion/gif`...) [have the same version](https://remotion.dev/docs/version-mismatch).
+
+## Getting started
-Now that you have this package as a dependency in your React project. It is time to see some of the basic examples that you can spin up with this package.
+Now that you have this package as a dependency in your React project, it is time to see some of the basic examples that you can spin up with this package.
-The `player` package can be imported as a React component from the library, which you can make use of in your components, either by nesting it in a custom component of yours or simply making it a standalone component.
+The `@remotion/player` package can be imported as a React component from the library, which you can make use of in your components, either by nesting it in a custom component of yours or simply making it a standalone component.
```javascript
-// components/MyVideo
-import React from "react"
-import { useCurrentFrame } from "remotion"
+// components/MyVideo.js
+import React from 'react';
+import {useCurrentFrame} from 'remotion';
const MyVideo = () => {
- const frame = useCurrentFrame()
-
- return (
- <div
- style={{
- flex: 1,
- textAlign: "center",
- fontSize: "7em",
- }}
- >
- The current frame is {frame}.
- </div>
- );
-}
+ const frame = useCurrentFrame();
+
+ return (
+ <div
+ style={{
+ flex: 1,
+ textAlign: 'center',
+ fontSize: '7em',
+ }}
+ >
+ The current frame is {frame}.
+ </div>
+ );
+};
```
```javascript
-import { Player } from "@remotion/player"
-import { MyVideo } from "../components/Myvideo"
+import {Player} from '@remotion/player';
+import {MyVideo} from '../components/MyVideo';
export const App = () => {
- return (
- <Player
- component={MyVideo}
- durationInFrames={120}
- compositionWidth={1920}
- compositionHeight={1080}
- fps={30}
- />
- );
+ return (
+ <Player
+ component={MyVideo}
+ durationInFrames={120}
+ compositionWidth={1920}
+ compositionHeight={1080}
+ fps={30}
+ />
+ );
};
```
-## The props in Player and their roles
+## API
+
+The most important props accepted:
-Props | Function |
---- | --- |
-component | the component prop takes in a React component or a function that returns a dynamic import. |
-durationInFrames | The duration of the video in frames
-compositionHeight | The height of the composition in pixels
-compositionWidth | The width of the composition in pixels
-fps | The frame rate of the video
+| Props | Function |
+| ----------------- | ---------------------------------------- |
+| component | A React component that renders the video |
+| durationInFrames | The duration of the video in frames |
+| compositionHeight | The height of the composition in pixels |
+| compositionWidth | The width of the composition in pixels |
+| fps | The frame rate of the video |
-For a complete reference of the available props, refer to [@remotion/player API](https://www.remotion.dev/docs/player/api).
\ No newline at end of file
+For a complete reference of the available props, refer to [@remotion/player API](https://www.remotion.dev/docs/player/api).