🎥 Make videos programmatically with React
add documentation and examples
Jonny Burger2af8fb4ce2ae
diff --git a/packages/docs/docs/player/api.md b/packages/docs/docs/player/api.mdindex f9b45981e8..945127d060 100644--- a/packages/docs/docs/player/api.md+++ b/packages/docs/docs/player/api.md@@ -242,6 +242,18 @@ _optional, available from v3.2.14_Render the poster when the video has ended. Requires [`moveToBeginning`](#movetobeginningwhenended) to be set to `false`. [`renderPoster()`](#renderposter) to be set. Default: `false`.+### `inFrame`++_optional, available from v3.2.15_++Limit playback to only play after a certain frame. The video will start from this frame and move to this position once it has ended. Must be an integer, not smaller than `0`, not bigger than [`outFrame`](#outframe) and not bigger than `durationInFrames - 1`. Default `null`, which means the beginning of the video.++### `outFrame`++_optional, available from v3.2.15_++Limit playback to only play before a certain frame. The video will end at this frame and move to the beginning once it has ended. Must be an integer, not smaller than `1`, not smaller than [`inFrame`](#inframe) and not bigger than `durationInFrames - 1`. Default `null`, which means the end of the video.+## `PlayerRef`You may attach a ref to the player and control it in an imperative manner.diff --git a/packages/docs/docs/player/player-examples.md b/packages/docs/docs/player/player-examples.mdindex ced5698f69..c895a7d144 100644--- a/packages/docs/docs/player/player-examples.md+++ b/packages/docs/docs/player/player-examples.md@@ -163,8 +163,8 @@ export const MyVideo = () => <></>;// @filename: index.tsx// ---cut---import { Player, PlayerRef } from "@remotion/player";-import { MyVideo } from "./remotion/MyVideo";import { useCallback, useRef } from "react";+import { MyVideo } from "./remotion/MyVideo";export const App: React.FC = () => {const playerRef = useRef<PlayerRef>(null);@@ -200,8 +200,8 @@ export const MyVideo = () => <></>;// @filename: index.tsx// ---cut---import { Player, PlayerRef } from "@remotion/player";-import { MyVideo } from "./remotion/MyVideo";import { useEffect, useRef } from "react";+import { MyVideo } from "./remotion/MyVideo";export const App: React.FC = () => {const playerRef = useRef<PlayerRef>(null);@@ -243,8 +243,8 @@ export const MyVideo = () => <></>;// @filename: index.tsx// ---cut----import { useState } from "react";import { Player } from "@remotion/player";+import { useState } from "react";import { MyVideo } from "./remotion/MyVideo";export const App: React.FC = () => {@@ -266,6 +266,34 @@ export const App: React.FC = () => {};```+## Only play a portion of a video++```tsx twoslash {13-14}+// @allowUmdGlobalAccess+// @filename: ./remotion/MyVideo.tsx+export const MyVideo = () => <></>;++// @filename: index.tsx+// ---cut---+import { Player } from "@remotion/player";+import { MyVideo } from "./remotion/MyVideo";++export const App: React.FC = () => {+ return (+ <Player+ component={MyVideo}+ durationInFrames={120}+ compositionWidth={1920}+ compositionHeight={1080}+ fps={30}+ loop+ inFrame={30}+ outFrame={60}+ />+ );+};+```+## See also- [Snippet: Embedding a `<Player>` in an iframe](/docs/miscellaneous/snippets/player-in-iframe)