Skip to content

🎥 Make videos programmatically with React

Add docs + missing parts

Jonny Burger470878f2c404
diff --git a/packages/core/src/Img.tsx b/packages/core/src/Img.tsx
index ccf1605796..904263d385 100644
--- a/packages/core/src/Img.tsx
+++ b/packages/core/src/Img.tsx
@@ -141,6 +141,7 @@ const ImgRefForwarding: React.ForwardRefRenderFunction<
if (typeof window !== 'undefined') {
const isPremounting = Boolean(sequenceContext?.premounting);
+ const isPostmounting = Boolean(sequenceContext?.postmounting);
// eslint-disable-next-line react-hooks/rules-of-hooks
useLayoutEffect(() => {
if (window.process?.env?.NODE_ENV === 'test') {
@@ -161,7 +162,7 @@ const ImgRefForwarding: React.ForwardRefRenderFunction<
timeoutInMilliseconds: delayRenderTimeoutInMilliseconds ?? undefined,
});
const unblock =
- pauseWhenLoading && !isPremounting
+ pauseWhenLoading && !isPremounting && !isPostmounting
? delayPlayback().unblock
: () => undefined;
@@ -231,6 +232,7 @@ const ImgRefForwarding: React.ForwardRefRenderFunction<
delayRenderTimeoutInMilliseconds,
pauseWhenLoading,
isPremounting,
+ isPostmounting,
onImageFrame,
]);
}
diff --git a/packages/core/src/use-media-buffering.ts b/packages/core/src/use-media-buffering.ts
index eef6c0db70..c6a9a40d70 100644
--- a/packages/core/src/use-media-buffering.ts
+++ b/packages/core/src/use-media-buffering.ts
@@ -47,7 +47,10 @@ export const useMediaBuffering = ({
// has no future data.
// Breaks on Firefox though: https://github.com/remotion-dev/remotion/issues/3915
- if (isPremounting && current.readyState < current.HAVE_FUTURE_DATA) {
+ if (
+ (isPremounting || isPostmounting) &&
+ current.readyState < current.HAVE_FUTURE_DATA
+ ) {
if (!navigator.userAgent.includes('Firefox/')) {
playbackLogging({
logLevel,
diff --git a/packages/docs/docs/sequence.mdx b/packages/docs/docs/sequence.mdx
index c8a4acc096..8e064aa1c7 100644
--- a/packages/docs/docs/sequence.mdx
+++ b/packages/docs/docs/sequence.mdx
@@ -262,6 +262,13 @@ _optional_
[Premount](/docs/player/premounting) the sequence for a set number of frames.
+### `postmountFor`<AvailableFrom v="4.0.340" />
+
+_optional_
+
+Same as `premountFor`, but for after the sequence has ended.
+Use this only if you expect the user to frequently seek backwards in the timeline and you want to avoid flickers for this behavior.
+
### `styleWhilePremounted`<AvailableFrom v="4.0.252" />
_optional_
diff --git a/packages/docs/docs/transitions/transitionseries.mdx b/packages/docs/docs/transitions/transitionseries.mdx
index 406fff6ad9..974f7dc345 100644
--- a/packages/docs/docs/transitions/transitionseries.mdx
+++ b/packages/docs/docs/transitions/transitionseries.mdx
@@ -75,7 +75,7 @@ The `<TransitionSeries>` component can only contain `<TransitionSeries.Sequence>
### `<TransitionSeries.Sequence>`
-Inherits the [`durationInFrames`](/docs/sequence#durationinframes), [`name`](/docs/sequence#name), [`className`](/docs/sequence#classname), [`style`](/docs/sequence#style), [`premountFor`](/docs/sequence#premountfor) and [`layout`](/docs/sequence#layout) props from [`<Sequence>`](/docs/sequence).
+Inherits the [`durationInFrames`](/docs/sequence#durationinframes), [`name`](/docs/sequence#name), [`className`](/docs/sequence#classname), [`style`](/docs/sequence#style), [`premountFor`](/docs/sequence#premountfor), [`postmountFor`](/docs/sequence#postmountfor) and [`layout`](/docs/sequence#layout) props from [`<Sequence>`](/docs/sequence).
As children, put the contents of your scene.