Skip to content

🎥 Make videos programmatically with React

Elements: Add captions category (#10089)

Igor Samokhovets8a79dcc67056
diff --git a/packages/docs/elements-sidebars.ts b/packages/docs/elements-sidebars.ts
index 0c6ed31b8b..ac1b4d3988 100644
--- a/packages/docs/elements-sidebars.ts
+++ b/packages/docs/elements-sidebars.ts
@@ -24,6 +24,17 @@ const sidebars: SidebarsConfig = {
'backgrounds/rotating-starburst/index',
],
},
+ {
+ type: 'category',
+ label: 'Captions',
+ link: {type: 'doc', id: 'captions/index'},
+ collapsed: false,
+ items: [
+ 'captions/moving-pill-captions/index',
+ 'captions/popping-word-captions/index',
+ 'captions/word-highlight-captions/index',
+ ],
+ },
{
type: 'category',
label: 'Data',
@@ -56,9 +67,6 @@ const sidebars: SidebarsConfig = {
'text/news-article-headline-highlight/index',
'text/strike-through/index',
'text/text-marker/index',
- 'text/timed-captions-background/index',
- 'text/timed-captions-highlight/index',
- 'text/timed-captions-scale/index',
],
},
],
diff --git a/packages/docs/elements/captions/index.mdx b/packages/docs/elements/captions/index.mdx
new file mode 100644
index 0000000000..1280cdd7c3
--- /dev/null
+++ b/packages/docs/elements/captions/index.mdx
@@ -0,0 +1,10 @@
+---
+title: Captions
+description: Drop-in synchronized caption Elements for Remotion videos.
+---
+
+import {ElementLibrary} from '@site/src/components/Elements/ElementLibrary';
+
+# Captions
+
+<ElementLibrary category="captions" />
diff --git a/packages/docs/elements/captions/moving-pill-captions/index.mdx b/packages/docs/elements/captions/moving-pill-captions/index.mdx
new file mode 100644
index 0000000000..ca3cc8df24
--- /dev/null
+++ b/packages/docs/elements/captions/moving-pill-captions/index.mdx
@@ -0,0 +1,12 @@
+---
+title: Moving Pill Captions
+description: Synchronized captions with a pill that moves between spoken words.
+image: https://remotion.media/elements/captions-moving-pill-captions-preview.png
+---
+
+import {ElementPage} from '@site/src/components/Elements/ElementPage';
+import {elementDefinitions} from '@site/src/components/Elements/element-definitions';
+
+# Moving Pill Captions
+
+<ElementPage definition={elementDefinitions['captions/moving-pill-captions']} sourceFile="./moving-pill-captions.tsx" />
diff --git a/packages/docs/elements/text/timed-captions-background/timed-captions-background.tsx b/packages/docs/elements/captions/moving-pill-captions/moving-pill-captions.tsx
similarity index 93%
rename from packages/docs/elements/text/timed-captions-background/timed-captions-background.tsx
rename to packages/docs/elements/captions/moving-pill-captions/moving-pill-captions.tsx
index 85fe637c88..bf39e80928 100644
--- a/packages/docs/elements/text/timed-captions-background/timed-captions-background.tsx
+++ b/packages/docs/elements/captions/moving-pill-captions/moving-pill-captions.tsx
@@ -26,15 +26,15 @@ import {
type SequenceProps,
} from 'remotion';
-type TimedCaptionsBackgroundProps = InteractiveBaseProps &
+type MovingPillCaptionsProps = InteractiveBaseProps &
InteractiveTransformProps &
Pick<SequenceProps, 'width' | 'height'> & {
readonly captions?: Caption[];
readonly combineTokensWithinMilliseconds?: number;
};
-type TimedCaptionsBackgroundLayerProps = Omit<
- TimedCaptionsBackgroundProps,
+type MovingPillCaptionsLayerProps = Omit<
+ MovingPillCaptionsProps,
'captions'
> & {
readonly captions: Caption[];
@@ -51,7 +51,7 @@ const pillBorderRadius = 10;
const pillMoveDurationInFrames = 5;
const defaultCombineTokensWithinMilliseconds = 800;
-const timedCaptionsBackgroundSchema = {
+const movingPillCaptionsSchema = {
...Interactive.baseSchema,
...Interactive.captionsSchema,
width: {
@@ -343,7 +343,7 @@ const CaptionPage: React.FC<{
);
};
-const TimedCaptionsBackgroundContent: React.FC<{
+const MovingPillCaptionsContent: React.FC<{
readonly captionAreaWidth: number | null;
readonly captions: Caption[];
readonly combineTokensWithinMilliseconds: number;
@@ -384,9 +384,9 @@ const TimedCaptionsBackgroundContent: React.FC<{
);
};
-const TimedCaptionsBackgroundInner = forwardRef<
+const MovingPillCaptionsInner = forwardRef<
HTMLDivElement,
- TimedCaptionsBackgroundLayerProps & {
+ MovingPillCaptionsLayerProps & {
readonly controls: SequenceControls | undefined;
}
>(
@@ -425,7 +425,7 @@ const TimedCaptionsBackgroundInner = forwardRef<
layout="none"
{...interactiveProps}
controls={controls}
- name={name ?? '<TimedCaptionsBackground>'}
+ name={name ?? '<MovingPillCaptions>'}
outlineRef={outlineRef}
>
<div
@@ -436,7 +436,7 @@ const TimedCaptionsBackgroundInner = forwardRef<
...style,
}}
>
- <TimedCaptionsBackgroundContent
+ <MovingPillCaptionsContent
captionAreaWidth={width ?? null}
captions={captions}
combineTokensWithinMilliseconds={combineTokensWithinMilliseconds}
@@ -448,19 +448,20 @@ const TimedCaptionsBackgroundInner = forwardRef<
},
);
-const TimedCaptionsBackgroundLayer = Interactive.withSchema({
- Component: TimedCaptionsBackgroundInner,
- componentName: '<TimedCaptionsBackground>',
+const MovingPillCaptionsLayer = Interactive.withSchema({
+ Component: MovingPillCaptionsInner,
+ componentName: '<MovingPillCaptions>',
componentIdentity: null,
- schema: timedCaptionsBackgroundSchema,
+ schema: movingPillCaptionsSchema,
supportsEffects: false,
-}) as React.FC<TimedCaptionsBackgroundLayerProps>;
+}) as React.FC<MovingPillCaptionsLayerProps>;
-export const TimedCaptionsBackground: React.FC<
- TimedCaptionsBackgroundProps
-> = ({captions, ...props}) => {
+export const MovingPillCaptions: React.FC<MovingPillCaptionsProps> = ({
+ captions,
+ ...props
+}) => {
if (captions) {
- return <TimedCaptionsBackgroundLayer {...props} captions={captions} />;
+ return <MovingPillCaptionsLayer {...props} captions={captions} />;
}
return (
@@ -473,7 +474,7 @@ export const TimedCaptionsBackground: React.FC<
width: 900,
}}
>
- <TimedCaptionsBackgroundLayer
+ <MovingPillCaptionsLayer
{...props}
captions={[
{
diff --git a/packages/docs/elements/captions/popping-word-captions/index.mdx b/packages/docs/elements/captions/popping-word-captions/index.mdx
new file mode 100644
index 0000000000..23ba4878b1
--- /dev/null
+++ b/packages/docs/elements/captions/popping-word-captions/index.mdx
@@ -0,0 +1,12 @@
+---
+title: Popping Word Captions
+description: Synchronized captions that pop each spoken word into focus.
+image: https://remotion.media/elements/captions-popping-word-captions-preview.png
+---
+
+import {ElementPage} from '@site/src/components/Elements/ElementPage';
+import {elementDefinitions} from '@site/src/components/Elements/element-definitions';
+
+# Popping Word Captions
+
+<ElementPage definition={elementDefinitions['captions/popping-word-captions']} sourceFile="./popping-word-captions.tsx" />
diff --git a/packages/docs/elements/text/timed-captions-scale/timed-captions-scale.tsx b/packages/docs/elements/captions/popping-word-captions/popping-word-captions.tsx
similarity index 92%
rename from packages/docs/elements/text/timed-captions-scale/timed-captions-scale.tsx
rename to packages/docs/elements/captions/popping-word-captions/popping-word-captions.tsx
index c65d475b24..1f600d4fbc 100644
--- a/packages/docs/elements/text/timed-captions-scale/timed-captions-scale.tsx
+++ b/packages/docs/elements/captions/popping-word-captions/popping-word-captions.tsx
@@ -25,15 +25,15 @@ import {
type SequenceProps,
} from 'remotion';
-type TimedCaptionsScaleProps = InteractiveBaseProps &
+type PoppingWordCaptionsProps = InteractiveBaseProps &
InteractiveTransformProps &
Pick<SequenceProps, 'width' | 'height'> & {
readonly captions?: Caption[];
readonly combineTokensWithinMilliseconds?: number;
};
-type TimedCaptionsScaleLayerProps = Omit<
- TimedCaptionsScaleProps,
+type PoppingWordCaptionsLayerProps = Omit<
+ PoppingWordCaptionsProps,
'captions'
> & {
readonly captions: Caption[];
@@ -47,7 +47,7 @@ const highlightColor = '#18ff0e';
const activeWordScale = 1.03;
const defaultCombineTokensWithinMilliseconds = 800;
-const timedCaptionsScaleSchema = {
+const poppingWordCaptionsSchema = {
...Interactive.baseSchema,
...Interactive.captionsSchema,
width: {
@@ -253,7 +253,7 @@ const CaptionPage: React.FC<{
);
};
-const TimedCaptionsScaleContent: React.FC<{
+const PoppingWordCaptionsContent: React.FC<{
readonly captionAreaWidth: number | null;
readonly captions: Caption[];
readonly combineTokensWithinMilliseconds: number;
@@ -294,9 +294,9 @@ const TimedCaptionsScaleContent: React.FC<{
);
};
-const TimedCaptionsScaleInner = forwardRef<
+const PoppingWordCaptionsInner = forwardRef<
HTMLDivElement,
- TimedCaptionsScaleLayerProps & {
+ PoppingWordCaptionsLayerProps & {
readonly controls: SequenceControls | undefined;
}
>(
@@ -335,7 +335,7 @@ const TimedCaptionsScaleInner = forwardRef<
layout="none"
{...interactiveProps}
controls={controls}
- name={name ?? '<TimedCaptionsScale>'}
+ name={name ?? '<PoppingWordCaptions>'}
outlineRef={outlineRef}
>
<div
@@ -346,7 +346,7 @@ const TimedCaptionsScaleInner = forwardRef<
...style,
}}
>
- <TimedCaptionsScaleContent
+ <PoppingWordCaptionsContent
captionAreaWidth={width ?? null}
captions={captions}
combineTokensWithinMilliseconds={combineTokensWithinMilliseconds}
@@ -358,20 +358,20 @@ const TimedCaptionsScaleInner = forwardRef<
},
);
-const TimedCaptionsScaleLayer = Interactive.withSchema({
- Component: TimedCaptionsScaleInner,
- componentName: '<TimedCaptionsScale>',
+const PoppingWordCaptionsLayer = Interactive.withSchema({
+ Component: PoppingWordCaptionsInner,
+ componentName: '<PoppingWordCaptions>',
componentIdentity: null,
- schema: timedCaptionsScaleSchema,
+ schema: poppingWordCaptionsSchema,
supportsEffects: false,
-}) as React.FC<TimedCaptionsScaleLayerProps>;
+}) as React.FC<PoppingWordCaptionsLayerProps>;
-export const TimedCaptionsScale: React.FC<TimedCaptionsScaleProps> = ({
+export const PoppingWordCaptions: React.FC<PoppingWordCaptionsProps> = ({
captions,
...props
}) => {
if (captions) {
- return <TimedCaptionsScaleLayer {...props} captions={captions} />;
+ return <PoppingWordCaptionsLayer {...props} captions={captions} />;
}
return (
@@ -384,7 +384,7 @@ export const TimedCaptionsScale: React.FC<TimedCaptionsScaleProps> = ({
width: 900,
}}
>
- <TimedCaptionsScaleLayer
+ <PoppingWordCaptionsLayer
{...props}
captions={[
{
diff --git a/packages/docs/elements/captions/word-highlight-captions/index.mdx b/packages/docs/elements/captions/word-highlight-captions/index.mdx
new file mode 100644
index 0000000000..70e194b6c8
--- /dev/null
+++ b/packages/docs/elements/captions/word-highlight-captions/index.mdx
@@ -0,0 +1,12 @@
+---
+title: Word Highlight Captions
+description: Synchronized captions that highlight each spoken word.
+image: https://remotion.media/elements/captions-word-highlight-captions-preview.png
+---
+
+import {ElementPage} from '@site/src/components/Elements/ElementPage';
+import {elementDefinitions} from '@site/src/components/Elements/element-definitions';
+
+# Word Highlight Captions
+
+<ElementPage definition={elementDefinitions['captions/word-highlight-captions']} sourceFile="./word-highlight-captions.tsx" />
diff --git a/packages/docs/elements/text/timed-captions-highlight/timed-captions-highlight.tsx b/packages/docs/elements/captions/word-highlight-captions/word-highlight-captions.tsx
similarity index 91%
rename from packages/docs/elements/text/timed-captions-highlight/timed-captions-highlight.tsx
rename to packages/docs/elements/captions/word-highlight-captions/word-highlight-captions.tsx
index 84f9ce433d..addf90d697 100644
--- a/packages/docs/elements/text/timed-captions-highlight/timed-captions-highlight.tsx
+++ b/packages/docs/elements/captions/word-highlight-captions/word-highlight-captions.tsx
@@ -23,15 +23,15 @@ import {
type SequenceProps,
} from 'remotion';
-type TimedCaptionsHighlightProps = InteractiveBaseProps &
+type WordHighlightCaptionsProps = InteractiveBaseProps &
InteractiveTransformProps &
Pick<SequenceProps, 'width' | 'height'> & {
readonly captions?: Caption[];
readonly combineTokensWithinMilliseconds?: number;
};
-type TimedCaptionsHighlightLayerProps = Omit<
- TimedCaptionsHighlightProps,
+type WordHighlightCaptionsLayerProps = Omit<
+ WordHighlightCaptionsProps,
'captions'
> & {
readonly captions: Caption[];
@@ -44,7 +44,7 @@ const textColor = '#ffffff';
const highlightColor = '#18ff0e';
const defaultCombineTokensWithinMilliseconds = 800;
-const timedCaptionsHighlightSchema = {
+const wordHighlightCaptionsSchema = {
...Interactive.baseSchema,
...Interactive.captionsSchema,
width: {
@@ -212,7 +212,7 @@ const CaptionPage: React.FC<{
);
};
-const TimedCaptionsHighlightContent: React.FC<{
+const WordHighlightCaptionsContent: React.FC<{
readonly captionAreaWidth: number | null;
readonly captions: Caption[];
readonly combineTokensWithinMilliseconds: number;
@@ -252,9 +252,9 @@ const TimedCaptionsHighlightContent: React.FC<{
);
};
-const TimedCaptionsHighlightInner = forwardRef<
+const WordHighlightCaptionsInner = forwardRef<
HTMLDivElement,
- TimedCaptionsHighlightLayerProps & {
+ WordHighlightCaptionsLayerProps & {
readonly controls: SequenceControls | undefined;
}
>(
@@ -293,7 +293,7 @@ const TimedCaptionsHighlightInner = forwardRef<
layout="none"
{...interactiveProps}
controls={controls}
- name={name ?? '<TimedCaptionsHighlight>'}
+ name={name ?? '<WordHighlightCaptions>'}
outlineRef={outlineRef}
>
<div
@@ -304,7 +304,7 @@ const TimedCaptionsHighlightInner = forwardRef<
...style,
}}
>
- <TimedCaptionsHighlightContent
+ <WordHighlightCaptionsContent
captionAreaWidth={width ?? null}
captions={captions}
combineTokensWithinMilliseconds={combineTokensWithinMilliseconds}
@@ -316,20 +316,20 @@ const TimedCaptionsHighlightInner = forwardRef<
},
);
-const TimedCaptionsHighlightLayer = Interactive.withSchema({
- Component: TimedCaptionsHighlightInner,
- componentName: '<TimedCaptionsHighlight>',
+const WordHighlightCaptionsLayer = Interactive.withSchema({
+ Component: WordHighlightCaptionsInner,
+ componentName: '<WordHighlightCaptions>',
componentIdentity: null,
- schema: timedCaptionsHighlightSchema,
+ schema: wordHighlightCaptionsSchema,
supportsEffects: false,
-}) as React.FC<TimedCaptionsHighlightLayerProps>;
+}) as React.FC<WordHighlightCaptionsLayerProps>;
-export const TimedCaptionsHighlight: React.FC<TimedCaptionsHighlightProps> = ({
+export const WordHighlightCaptions: React.FC<WordHighlightCaptionsProps> = ({
captions,
...props
}) => {
if (captions) {
- return <TimedCaptionsHighlightLayer {...props} captions={captions} />;
+ return <WordHighlightCaptionsLayer {...props} captions={captions} />;
}
return (
@@ -342,7 +342,7 @@ export const TimedCaptionsHighlight: React.FC<TimedCaptionsHighlightProps> = ({
width: 900,
}}
>
- <TimedCaptionsHighlightLayer
+ <WordHighlightCaptionsLayer
{...props}
captions={[
{
diff --git a/packages/docs/elements/text/timed-captions-background/index.mdx b/packages/docs/elements/text/timed-captions-background/index.mdx
deleted file mode 100644
index 13ff0322d1..0000000000
--- a/packages/docs/elements/text/timed-captions-background/index.mdx
+++ /dev/null
@@ -1,12 +0,0 @@
----
-title: Background Timed Captions
-description: Animated captions with word-level moving background styling.
-image: https://remotion.media/elements/text-timed-captions-background-preview.png
----
-
-import {ElementPage} from '@site/src/components/Elements/ElementPage';
-import {elementDefinitions} from '@site/src/components/Elements/element-definitions';
-
-# Background Timed Captions
-
-<ElementPage definition={elementDefinitions['text/timed-captions-background']} sourceFile="./timed-captions-background.tsx" />
diff --git a/packages/docs/elements/text/timed-captions-highlight/index.mdx b/packages/docs/elements/text/timed-captions-highlight/index.mdx
deleted file mode 100644
index 93a39b4f4e..0000000000
--- a/packages/docs/elements/text/timed-captions-highlight/index.mdx
+++ /dev/null
@@ -1,12 +0,0 @@
----
-title: Highlight Timed Captions
-description: Animated captions with word-level highlight styling.
-image: https://remotion.media/elements/text-timed-captions-highlight-preview.png
----
-
-import {ElementPage} from '@site/src/components/Elements/ElementPage';
-import {elementDefinitions} from '@site/src/components/Elements/element-definitions';
-
-# Highlight Timed Captions
-
-<ElementPage definition={elementDefinitions['text/timed-captions-highlight']} sourceFile="./timed-captions-highlight.tsx" />
diff --git a/packages/docs/elements/text/timed-captions-scale/index.mdx b/packages/docs/elements/text/timed-captions-scale/index.mdx
deleted file mode 100644
index 71c53f96d7..0000000000
--- a/packages/docs/elements/text/timed-captions-scale/index.mdx
+++ /dev/null
@@ -1,12 +0,0 @@
----
-title: Scale Timed Captions
-description: Animated captions with word-level scale styling.
-image: https://remotion.media/elements/text-timed-captions-scale-preview.png
----
-
-import {ElementPage} from '@site/src/components/Elements/ElementPage';
-import {elementDefinitions} from '@site/src/components/Elements/element-definitions';
-
-# Scale Timed Captions
-
-<ElementPage definition={elementDefinitions['text/timed-captions-scale']} sourceFile="./timed-captions-scale.tsx" />
diff --git a/packages/docs/src/components/Elements/element-definitions.ts b/packages/docs/src/components/Elements/element-definitions.ts
index d0b7598998..a011af10e4 100644
--- a/packages/docs/src/components/Elements/element-definitions.ts
+++ b/packages/docs/src/components/Elements/element-definitions.ts
@@ -4,6 +4,9 @@ import {LiquidContours} from '../../../elements/backgrounds/liquid-contours/liqu
import {NotebookPaper} from '../../../elements/backgrounds/notebook-paper/notebook-paper';
import {PaperTexture} from '../../../elements/backgrounds/paper-texture/paper-texture';
import {RotatingStarburst} from '../../../elements/backgrounds/rotating-starburst/rotating-starburst';
+import {MovingPillCaptions} from '../../../elements/captions/moving-pill-captions/moving-pill-captions';
+import {PoppingWordCaptions} from '../../../elements/captions/popping-word-captions/popping-word-captions';
+import {WordHighlightCaptions} from '../../../elements/captions/word-highlight-captions/word-highlight-captions';
import {HorizontalBarChart} from '../../../elements/data/horizontal-bar-chart/horizontal-bar-chart';
import {NumberCounter} from '../../../elements/data/number-counter/number-counter';
import {ProductOffer} from '../../../elements/data/product-offer/product-offer';
@@ -14,9 +17,6 @@ import {CrossedOffText} from '../../../elements/text/crossed-off/crossed-off';
import {NewsArticleHeadlineHighlight} from '../../../elements/text/news-article-headline-highlight/news-article-headline-highlight';
import {StrikeThroughText} from '../../../elements/text/strike-through/strike-through';
import {TextMarker} from '../../../elements/text/text-marker/text-marker';
-import {TimedCaptionsBackground} from '../../../elements/text/timed-captions-background/timed-captions-background';
-import {TimedCaptionsHighlight} from '../../../elements/text/timed-captions-highlight/timed-captions-highlight';
-import {TimedCaptionsScale} from '../../../elements/text/timed-captions-scale/timed-captions-scale';
import type {Contributor} from '../Credits';
export type ElementPreviewMetadata = {
@@ -390,17 +390,18 @@ export const elementDefinitions = {
slug: 'text/text-marker',
width: 1920,
},
- 'text/timed-captions-background': {
- category: 'text',
- component: TimedCaptionsBackground,
+ 'captions/moving-pill-captions': {
+ category: 'captions',
+ component: MovingPillCaptions,
contributors: [{username: 'JonnyBurger', contribution: null}],
- description: 'Animated captions with word-level moving background styling.',
+ description:
+ 'Synchronized captions with a pill that moves between spoken words.',
dependencies: [
{name: '@remotion/captions', version: null},
{name: '@remotion/google-fonts', version: null},
{name: '@remotion/layout-utils', version: null},
],
- displayName: 'Background Timed Captions',
+ displayName: 'Moving Pill Captions',
durationInFrames: 210,
elementHeight: 180,
elementWidth: 900,
@@ -409,25 +410,25 @@ export const elementDefinitions = {
posterFrame: 75,
preview: {
posterUrl:
- 'https://remotion.media/elements/text-timed-captions-background-preview.png',
+ 'https://remotion.media/elements/captions-moving-pill-captions-preview.png',
videoUrl:
- 'https://remotion.media/elements/text-timed-captions-background-preview.mp4',
+ 'https://remotion.media/elements/captions-moving-pill-captions-preview.mp4',
},
previewPadding: 120,
- slug: 'text/timed-captions-background',
+ slug: 'captions/moving-pill-captions',
width: 1920,
},
- 'text/timed-captions-highlight': {
- category: 'text',
- component: TimedCaptionsHighlight,
+ 'captions/popping-word-captions': {
+ category: 'captions',
+ component: PoppingWordCaptions,
contributors: [{username: 'JonnyBurger', contribution: null}],
- description: 'Animated captions with word-level highlight styling.',
+ description: 'Synchronized captions that pop each spoken word into focus.',
dependencies: [
{name: '@remotion/captions', version: null},
{name: '@remotion/google-fonts', version: null},
{name: '@remotion/layout-utils', version: null},
],
- displayName: 'Highlight Timed Captions',
+ displayName: 'Popping Word Captions',
durationInFrames: 210,
elementHeight: 180,
elementWidth: 900,
@@ -436,25 +437,25 @@ export const elementDefinitions = {
posterFrame: 75,
preview: {
posterUrl:
- 'https://remotion.media/elements/text-timed-captions-highlight-preview.png',
+ 'https://remotion.media/elements/captions-popping-word-captions-preview.png',
videoUrl:
- 'https://remotion.media/elements/text-timed-captions-highlight-preview.mp4',
+ 'https://remotion.media/elements/captions-popping-word-captions-preview.mp4',
},
previewPadding: 120,
- slug: 'text/timed-captions-highlight',
+ slug: 'captions/popping-word-captions',
width: 1920,
},
- 'text/timed-captions-scale': {
- category: 'text',
- component: TimedCaptionsScale,
+ 'captions/word-highlight-captions': {
+ category: 'captions',
+ component: WordHighlightCaptions,
contributors: [{username: 'JonnyBurger', contribution: null}],
- description: 'Animated captions with word-level scale styling.',
+ description: 'Synchronized captions that highlight each spoken word.',
dependencies: [
{name: '@remotion/captions', version: null},
{name: '@remotion/google-fonts', version: null},
{name: '@remotion/layout-utils', version: null},
],
- displayName: 'Scale Timed Captions',
+ displayName: 'Word Highlight Captions',
durationInFrames: 210,
elementHeight: 180,
elementWidth: 900,
@@ -463,12 +464,12 @@ export const elementDefinitions = {
posterFrame: 75,
preview: {
posterUrl:
- 'https://remotion.media/elements/text-timed-captions-scale-preview.png',
+ 'https://remotion.media/elements/captions-word-highlight-captions-preview.png',
videoUrl:
- 'https://remotion.media/elements/text-timed-captions-scale-preview.mp4',
+ 'https://remotion.media/elements/captions-word-highlight-captions-preview.mp4',
},
previewPadding: 120,
- slug: 'text/timed-captions-scale',
+ slug: 'captions/word-highlight-captions',
width: 1920,
},
} satisfies Record<string, ElementDefinition>;
diff --git a/packages/docs/src/test/elements.test.ts b/packages/docs/src/test/elements.test.ts
index e7a66b96a4..c4cac0144d 100644
--- a/packages/docs/src/test/elements.test.ts
+++ b/packages/docs/src/test/elements.test.ts
@@ -309,22 +309,22 @@ describe('Element preview definitions', () => {
}
});
- test('publishes timed caption styles as separate Elements', () => {
- const timedCaptionSlugs = elementDefinitionList
+ test('publishes caption treatments as separate Elements', () => {
+ const captionSlugs = elementDefinitionList
.map((definition) => definition.slug)
- .filter((slug) => slug.startsWith('text/timed-captions'))
+ .filter((slug) => slug.startsWith('captions/'))
.sort();
- expect(timedCaptionSlugs).toEqual([
- 'text/timed-captions-background',
- 'text/timed-captions-highlight',
- 'text/timed-captions-scale',
+ expect(captionSlugs).toEqual([
+ 'captions/moving-pill-captions',
+ 'captions/popping-word-captions',
+ 'captions/word-highlight-captions',
]);
- for (const slug of timedCaptionSlugs) {
+ for (const slug of captionSlugs) {
const element = productionElements.find((entry) => entry.name === slug);
if (!element) {
- throw new Error(`Missing timed caption Element for ${slug}`);
+ throw new Error(`Missing caption Element for ${slug}`);
}
const source = readFileSync(element.tsxPath, 'utf8');