Skip to content

🎥 Make videos programmatically with React

Elements: Simplify caption Elements for visual editing

Jonny Burger289f9fbb8598
diff --git a/packages/docs/elements/captions/basic-captions/basic-captions.tsx b/packages/docs/elements/captions/basic-captions/basic-captions.tsx
index 112ce08987..f21b2a6a56 100644
--- a/packages/docs/elements/captions/basic-captions/basic-captions.tsx
+++ b/packages/docs/elements/captions/basic-captions/basic-captions.tsx
@@ -16,15 +16,10 @@ import {
type BasicCaptionsProps = InteractiveBaseProps &
InteractiveTransformProps &
Pick<SequenceProps, 'width' | 'height'> & {
- readonly captions?: Caption[];
+ readonly captions: Caption[];
readonly combineTokensWithinMilliseconds?: number;
};
-type BasicCaptionsLayerProps = Omit<BasicCaptionsProps, 'captions'> & {
- readonly callerStyle: React.CSSProperties | null;
- readonly captions: Caption[];
-};
-
const defaultCombineTokensWithinMilliseconds = 2000;
const maximumTextWidth = 800;
@@ -55,7 +50,6 @@ const basicCaptionsSchema = {
description: 'Time between caption pages',
hiddenFromList: false,
},
- callerStyle: {type: 'hidden'},
...Interactive.transformSchema,
} as const satisfies InteractivitySchema;
@@ -118,17 +112,15 @@ const BasicCaptionsContent: React.FC<{
const BasicCaptionsInner = forwardRef<
HTMLDivElement,
- BasicCaptionsLayerProps & {
+ BasicCaptionsProps & {
readonly controls: SequenceControls | undefined;
}
>(
(
{
- callerStyle,
captions,
combineTokensWithinMilliseconds = defaultCombineTokensWithinMilliseconds,
controls,
- height,
name,
style,
width,
@@ -137,16 +129,6 @@ const BasicCaptionsInner = forwardRef<
ref,
) => {
const outlineRef = useRef<HTMLDivElement>(null);
- const {
- rotate: callerRotate,
- scale: callerScale,
- transform: callerTransform,
- transformBox: callerTransformBox,
- transformOrigin: callerTransformOrigin,
- transformStyle: callerTransformStyle,
- translate: callerTranslate,
- ...callerContentStyle
- } = callerStyle ?? {};
useImperativeHandle(ref, () => outlineRef.current as HTMLDivElement, []);
@@ -159,36 +141,21 @@ const BasicCaptionsInner = forwardRef<
outlineRef={outlineRef}
>
<div
+ ref={outlineRef}
style={{
- height: height ?? '100%',
- rotate: callerRotate,
- scale: callerScale,
- transform: callerTransform,
- transformBox: callerTransformBox,
- transformOrigin: callerTransformOrigin,
- transformStyle: callerTransformStyle,
- translate: callerTranslate,
- width: width ?? '100%',
+ alignItems: 'center',
+ display: 'flex',
+ height: '100%',
+ justifyContent: 'center',
+ width: '100%',
+ ...style,
}}
>
- <div
- ref={outlineRef}
- style={{
- alignItems: 'center',
- display: 'flex',
- height: '100%',
- justifyContent: 'center',
- width: '100%',
- ...style,
- ...callerContentStyle,
- }}
- >
- <BasicCaptionsContent
- captionAreaWidth={width ?? null}
- captions={captions}
- combineTokensWithinMilliseconds={combineTokensWithinMilliseconds}
- />
- </div>
+ <BasicCaptionsContent
+ captionAreaWidth={width ?? null}
+ captions={captions}
+ combineTokensWithinMilliseconds={combineTokensWithinMilliseconds}
+ />
</div>
</Sequence>
);
@@ -201,66 +168,38 @@ const BasicCaptionsLayer = Interactive.withSchema({
componentIdentity: null,
schema: basicCaptionsSchema,
supportsEffects: false,
-}) as React.FC<BasicCaptionsLayerProps>;
-
-export const BasicCaptions: React.FC<BasicCaptionsProps> = ({
- captions,
- style,
- ...props
-}) => {
- if (captions) {
- return (
- <BasicCaptionsLayer
- {...props}
- callerStyle={style ?? null}
- captions={captions}
- style={{translate: '0px 0px'}}
- />
- );
- }
+}) as React.FC<BasicCaptionsProps>;
+export const BasicCaptions: React.FC = () => {
return (
- <div
- style={{
- alignItems: 'center',
- display: 'flex',
- height: 220,
- justifyContent: 'center',
- width: 900,
- }}
- >
- <BasicCaptionsLayer
- {...props}
- callerStyle={style ?? null}
- captions={[
- {
- text: 'Simple captions,\nready for every video.',
- startMs: 0,
- endMs: 2200,
- timestampMs: 1100,
- confidence: null,
- pageBreakAfter: true,
- },
- {
- text: 'No animation,\njust clear text.',
- startMs: 2200,
- endMs: 4400,
- timestampMs: 3300,
- confidence: null,
- pageBreakAfter: true,
- },
- {
- text: 'Easy to read,\nand easy to customize.',
- startMs: 4400,
- endMs: 7000,
- timestampMs: 5700,
- confidence: null,
- },
- ]}
- height={props.height ?? 220}
- width={props.width ?? 900}
- style={{translate: '0px 0px'}}
- />
- </div>
+ <BasicCaptionsLayer
+ captions={[
+ {
+ text: 'Simple captions,ready for every video.',
+ startMs: 0,
+ endMs: 2200,
+ timestampMs: 1100,
+ confidence: null,
+ pageBreakAfter: true,
+ },
+ {
+ text: 'No animation,\njust clear text.',
+ startMs: 2200,
+ endMs: 4400,
+ timestampMs: 3300,
+ confidence: null,
+ pageBreakAfter: true,
+ },
+ {
+ text: 'Easy to read,\nand easy to customize.',
+ startMs: 4400,
+ endMs: 7000,
+ timestampMs: 5700,
+ confidence: null,
+ },
+ ]}
+ height={220}
+ width={900}
+ />
);
};
diff --git a/packages/docs/elements/captions/moving-pill-captions/moving-pill-captions.tsx b/packages/docs/elements/captions/moving-pill-captions/moving-pill-captions.tsx
index fdc3f69981..c434e18b9c 100644
--- a/packages/docs/elements/captions/moving-pill-captions/moving-pill-captions.tsx
+++ b/packages/docs/elements/captions/moving-pill-captions/moving-pill-captions.tsx
@@ -29,18 +29,10 @@ import {
type MovingPillCaptionsProps = InteractiveBaseProps &
InteractiveTransformProps &
Pick<SequenceProps, 'width' | 'height'> & {
- readonly captions?: Caption[];
+ readonly captions: Caption[];
readonly combineTokensWithinMilliseconds?: number;
};
-type MovingPillCaptionsLayerProps = Omit<
- MovingPillCaptionsProps,
- 'captions'
-> & {
- readonly callerStyle: React.CSSProperties | null;
- readonly captions: Caption[];
-};
-
const desiredFontSize = 80;
const maximumTextWidth = 800;
const fontWeight = '700';
@@ -79,7 +71,6 @@ const movingPillCaptionsSchema = {
description: 'Time between caption pages',
hiddenFromList: false,
},
- callerStyle: {type: 'hidden'},
...Interactive.transformSchema,
} as const satisfies InteractivitySchema;
@@ -388,17 +379,15 @@ const MovingPillCaptionsContent: React.FC<{
const MovingPillCaptionsInner = forwardRef<
HTMLDivElement,
- MovingPillCaptionsLayerProps & {
+ MovingPillCaptionsProps & {
readonly controls: SequenceControls | undefined;
}
>(
(
{
- callerStyle,
captions,
combineTokensWithinMilliseconds = defaultCombineTokensWithinMilliseconds,
controls,
- height,
name,
style,
width,
@@ -408,16 +397,6 @@ const MovingPillCaptionsInner = forwardRef<
) => {
const outlineRef = useRef<HTMLDivElement>(null);
const [fontLoaded, setFontLoaded] = useState(false);
- const {
- rotate: callerRotate,
- scale: callerScale,
- transform: callerTransform,
- transformBox: callerTransformBox,
- transformOrigin: callerTransformOrigin,
- transformStyle: callerTransformStyle,
- translate: callerTranslate,
- ...callerContentStyle
- } = callerStyle ?? {};
useImperativeHandle(ref, () => outlineRef.current as HTMLDivElement, []);
@@ -442,34 +421,19 @@ const MovingPillCaptionsInner = forwardRef<
outlineRef={outlineRef}
>
<div
+ ref={outlineRef}
style={{
- height: height ?? '100%',
- rotate: callerRotate,
- scale: callerScale,
- transform: callerTransform,
- transformBox: callerTransformBox,
- transformOrigin: callerTransformOrigin,
- transformStyle: callerTransformStyle,
- translate: callerTranslate,
- width: width ?? '100%',
+ height: '100%',
+ width: '100%',
+ ...style,
}}
>
- <div
- ref={outlineRef}
- style={{
- height: '100%',
- width: '100%',
- ...style,
- ...callerContentStyle,
- }}
- >
- <MovingPillCaptionsContent
- captionAreaWidth={width ?? null}
- captions={captions}
- combineTokensWithinMilliseconds={combineTokensWithinMilliseconds}
- fontLoaded={fontLoaded}
- />
- </div>
+ <MovingPillCaptionsContent
+ captionAreaWidth={width ?? null}
+ captions={captions}
+ combineTokensWithinMilliseconds={combineTokensWithinMilliseconds}
+ fontLoaded={fontLoaded}
+ />
</div>
</Sequence>
);
@@ -482,92 +446,64 @@ const MovingPillCaptionsLayer = Interactive.withSchema({
componentIdentity: null,
schema: movingPillCaptionsSchema,
supportsEffects: false,
-}) as React.FC<MovingPillCaptionsLayerProps>;
-
-export const MovingPillCaptions: React.FC<MovingPillCaptionsProps> = ({
- captions,
- style,
- ...props
-}) => {
- if (captions) {
- return (
- <MovingPillCaptionsLayer
- {...props}
- callerStyle={style ?? null}
- captions={captions}
- style={{translate: '0px 0px'}}
- />
- );
- }
+}) as React.FC<MovingPillCaptionsProps>;
+export const MovingPillCaptions: React.FC = () => {
return (
- <div
- style={{
- alignItems: 'center',
- display: 'flex',
- height: 180,
- justifyContent: 'center',
- width: 900,
- }}
- >
- <MovingPillCaptionsLayer
- {...props}
- callerStyle={style ?? null}
- captions={[
- {
- text: 'Captions',
- startMs: 0,
- endMs: 800,
- timestampMs: 400,
- confidence: null,
- },
- {
- text: ' can',
- startMs: 800,
- endMs: 1500,
- timestampMs: 1150,
- confidence: null,
- },
- {
- text: ' move',
- startMs: 1500,
- endMs: 2300,
- timestampMs: 1900,
- confidence: null,
- },
- {
- text: ' with',
- startMs: 2300,
- endMs: 3100,
- timestampMs: 2700,
- confidence: null,
- },
- {
- text: ' every',
- startMs: 3100,
- endMs: 4000,
- timestampMs: 3550,
- confidence: null,
- },
- {
- text: ' spoken',
- startMs: 4000,
- endMs: 5100,
- timestampMs: 4550,
- confidence: null,
- },
- {
- text: ' word.',
- startMs: 5100,
- endMs: 6500,
- timestampMs: 5800,
- confidence: null,
- },
- ]}
- width={props.width ?? 681}
- height={props.height ?? 252}
- style={{translate: '0px 0px'}}
- />
- </div>
+ <MovingPillCaptionsLayer
+ captions={[
+ {
+ text: 'Captions',
+ startMs: 0,
+ endMs: 800,
+ timestampMs: 400,
+ confidence: null,
+ },
+ {
+ text: ' can',
+ startMs: 800,
+ endMs: 1500,
+ timestampMs: 1150,
+ confidence: null,
+ },
+ {
+ text: ' move',
+ startMs: 1500,
+ endMs: 2300,
+ timestampMs: 1900,
+ confidence: null,
+ },
+ {
+ text: ' with',
+ startMs: 2300,
+ endMs: 3100,
+ timestampMs: 2700,
+ confidence: null,
+ },
+ {
+ text: ' every',
+ startMs: 3100,
+ endMs: 4000,
+ timestampMs: 3550,
+ confidence: null,
+ },
+ {
+ text: ' spoken',
+ startMs: 4000,
+ endMs: 5100,
+ timestampMs: 4550,
+ confidence: null,
+ },
+ {
+ text: ' word.',
+ startMs: 5100,
+ endMs: 6500,
+ timestampMs: 5800,
+ confidence: null,
+ },
+ ]}
+ width={681}
+ height={252}
+ />
);
};
diff --git a/packages/docs/elements/captions/popping-word-captions/popping-word-captions.tsx b/packages/docs/elements/captions/popping-word-captions/popping-word-captions.tsx
index 2e1670b6b9..c5524f928e 100644
--- a/packages/docs/elements/captions/popping-word-captions/popping-word-captions.tsx
+++ b/packages/docs/elements/captions/popping-word-captions/popping-word-captions.tsx
@@ -28,18 +28,10 @@ import {
type PoppingWordCaptionsProps = InteractiveBaseProps &
InteractiveTransformProps &
Pick<SequenceProps, 'width' | 'height'> & {
- readonly captions?: Caption[];
+ readonly captions: Caption[];
readonly combineTokensWithinMilliseconds?: number;
};
-type PoppingWordCaptionsLayerProps = Omit<
- PoppingWordCaptionsProps,
- 'captions'
-> & {
- readonly callerStyle: React.CSSProperties | null;
- readonly captions: Caption[];
-};
-
const desiredFontSize = 80;
const maximumTextWidth = 800;
const fontWeight = '700';
@@ -75,7 +67,6 @@ const poppingWordCaptionsSchema = {
description: 'Time between caption pages',
hiddenFromList: false,
},
- callerStyle: {type: 'hidden'},
...Interactive.transformSchema,
} as const satisfies InteractivitySchema;
@@ -298,17 +289,15 @@ const PoppingWordCaptionsContent: React.FC<{
const PoppingWordCaptionsInner = forwardRef<
HTMLDivElement,
- PoppingWordCaptionsLayerProps & {
+ PoppingWordCaptionsProps & {
readonly controls: SequenceControls | undefined;
}
>(
(
{
- callerStyle,
captions,
combineTokensWithinMilliseconds = defaultCombineTokensWithinMilliseconds,
controls,
- height,
name,
style,
width,
@@ -318,16 +307,6 @@ const PoppingWordCaptionsInner = forwardRef<
) => {
const outlineRef = useRef<HTMLDivElement>(null);
const [fontLoaded, setFontLoaded] = useState(false);
- const {
- rotate: callerRotate,
- scale: callerScale,
- transform: callerTransform,
- transformBox: callerTransformBox,
- transformOrigin: callerTransformOrigin,
- transformStyle: callerTransformStyle,
- translate: callerTranslate,
- ...callerContentStyle
- } = callerStyle ?? {};
useImperativeHandle(ref, () => outlineRef.current as HTMLDivElement, []);
@@ -352,34 +331,19 @@ const PoppingWordCaptionsInner = forwardRef<
outlineRef={outlineRef}
>
<div
+ ref={outlineRef}
style={{
- height: height ?? '100%',
- rotate: callerRotate,
- scale: callerScale,
- transform: callerTransform,
- transformBox: callerTransformBox,
- transformOrigin: callerTransformOrigin,
- transformStyle: callerTransformStyle,
- translate: callerTranslate,
- width: width ?? '100%',
+ height: '100%',
+ width: '100%',
+ ...style,
}}
>
- <div
- ref={outlineRef}
- style={{
- height: '100%',
- width: '100%',
- ...style,
- ...callerContentStyle,
- }}
- >
- <PoppingWordCaptionsContent
- captionAreaWidth={width ?? null}
- captions={captions}
- combineTokensWithinMilliseconds={combineTokensWithinMilliseconds}
- fontLoaded={fontLoaded}
- />
- </div>
+ <PoppingWordCaptionsContent
+ captionAreaWidth={width ?? null}
+ captions={captions}
+ combineTokensWithinMilliseconds={combineTokensWithinMilliseconds}
+ fontLoaded={fontLoaded}
+ />
</div>
</Sequence>
);
@@ -392,92 +356,64 @@ const PoppingWordCaptionsLayer = Interactive.withSchema({
componentIdentity: null,
schema: poppingWordCaptionsSchema,
supportsEffects: false,
-}) as React.FC<PoppingWordCaptionsLayerProps>;
-
-export const PoppingWordCaptions: React.FC<PoppingWordCaptionsProps> = ({
- captions,
- style,
- ...props
-}) => {
- if (captions) {
- return (
- <PoppingWordCaptionsLayer
- {...props}
- callerStyle={style ?? null}
- captions={captions}
- style={{translate: '0px 0px'}}
- />
- );
- }
+}) as React.FC<PoppingWordCaptionsProps>;
+export const PoppingWordCaptions: React.FC = () => {
return (
- <div
- style={{
- alignItems: 'center',
- display: 'flex',
- height: 180,
- justifyContent: 'center',
- width: 900,
- }}
- >
- <PoppingWordCaptionsLayer
- {...props}
- callerStyle={style ?? null}
- captions={[
- {
- text: 'Captions',
- startMs: 0,
- endMs: 800,
- timestampMs: 400,
- confidence: null,
- },
- {
- text: ' can',
- startMs: 800,
- endMs: 1500,
- timestampMs: 1150,
- confidence: null,
- },
- {
- text: ' move',
- startMs: 1500,
- endMs: 2300,
- timestampMs: 1900,
- confidence: null,
- },
- {
- text: ' with',
- startMs: 2300,
- endMs: 3100,
- timestampMs: 2700,
- confidence: null,
- },
- {
- text: ' every',
- startMs: 3100,
- endMs: 4000,
- timestampMs: 3550,
- confidence: null,
- },
- {
- text: ' spoken',
- startMs: 4000,
- endMs: 5100,
- timestampMs: 4550,
- confidence: null,
- },
- {
- text: ' word.',
- startMs: 5100,
- endMs: 6500,
- timestampMs: 5800,
- confidence: null,
- },
- ]}
- width={props.width ?? 681}
- height={props.height ?? 252}
- style={{translate: '0px 0px'}}
- />
- </div>
+ <PoppingWordCaptionsLayer
+ captions={[
+ {
+ text: 'Captions',
+ startMs: 0,
+ endMs: 800,
+ timestampMs: 400,
+ confidence: null,
+ },
+ {
+ text: ' can',
+ startMs: 800,
+ endMs: 1500,
+ timestampMs: 1150,
+ confidence: null,
+ },
+ {
+ text: ' move',
+ startMs: 1500,
+ endMs: 2300,
+ timestampMs: 1900,
+ confidence: null,
+ },
+ {
+ text: ' with',
+ startMs: 2300,
+ endMs: 3100,
+ timestampMs: 2700,
+ confidence: null,
+ },
+ {
+ text: ' every',
+ startMs: 3100,
+ endMs: 4000,
+ timestampMs: 3550,
+ confidence: null,
+ },
+ {
+ text: ' spoken',
+ startMs: 4000,
+ endMs: 5100,
+ timestampMs: 4550,
+ confidence: null,
+ },
+ {
+ text: ' word.',
+ startMs: 5100,
+ endMs: 6500,
+ timestampMs: 5800,
+ confidence: null,
+ },
+ ]}
+ width={681}
+ height={252}
+ />
);
};
diff --git a/packages/docs/elements/captions/word-highlight-captions/word-highlight-captions.tsx b/packages/docs/elements/captions/word-highlight-captions/word-highlight-captions.tsx
index afec7c408e..bf796efe7d 100644
--- a/packages/docs/elements/captions/word-highlight-captions/word-highlight-captions.tsx
+++ b/packages/docs/elements/captions/word-highlight-captions/word-highlight-captions.tsx
@@ -26,18 +26,10 @@ import {
type WordHighlightCaptionsProps = InteractiveBaseProps &
InteractiveTransformProps &
Pick<SequenceProps, 'width' | 'height'> & {
- readonly captions?: Caption[];
+ readonly captions: Caption[];
readonly combineTokensWithinMilliseconds?: number;
};
-type WordHighlightCaptionsLayerProps = Omit<
- WordHighlightCaptionsProps,
- 'captions'
-> & {
- readonly callerStyle: React.CSSProperties | null;
- readonly captions: Caption[];
-};
-
const desiredFontSize = 80;
const maximumTextWidth = 800;
const fontWeight = '700';
@@ -72,7 +64,6 @@ const wordHighlightCaptionsSchema = {
description: 'Time between caption pages',
hiddenFromList: false,
},
- callerStyle: {type: 'hidden'},
...Interactive.transformSchema,
} as const satisfies InteractivitySchema;
@@ -256,17 +247,15 @@ const WordHighlightCaptionsContent: React.FC<{
const WordHighlightCaptionsInner = forwardRef<
HTMLDivElement,
- WordHighlightCaptionsLayerProps & {
+ WordHighlightCaptionsProps & {
readonly controls: SequenceControls | undefined;
}
>(
(
{
- callerStyle,
captions,
combineTokensWithinMilliseconds = defaultCombineTokensWithinMilliseconds,
controls,
- height,
name,
style,
width,
@@ -276,16 +265,6 @@ const WordHighlightCaptionsInner = forwardRef<
) => {
const outlineRef = useRef<HTMLDivElement>(null);
const [fontLoaded, setFontLoaded] = useState(false);
- const {
- rotate: callerRotate,
- scale: callerScale,
- transform: callerTransform,
- transformBox: callerTransformBox,
- transformOrigin: callerTransformOrigin,
- transformStyle: callerTransformStyle,
- translate: callerTranslate,
- ...callerContentStyle
- } = callerStyle ?? {};
useImperativeHandle(ref, () => outlineRef.current as HTMLDivElement, []);
@@ -310,34 +289,19 @@ const WordHighlightCaptionsInner = forwardRef<
outlineRef={outlineRef}
>
<div
+ ref={outlineRef}
style={{
- height: height ?? '100%',
- rotate: callerRotate,
- scale: callerScale,
- transform: callerTransform,
- transformBox: callerTransformBox,
- transformOrigin: callerTransformOrigin,
- transformStyle: callerTransformStyle,
- translate: callerTranslate,
- width: width ?? '100%',
+ height: '100%',
+ width: '100%',
+ ...style,
}}
>
- <div
- ref={outlineRef}
- style={{
- height: '100%',
- width: '100%',
- ...style,
- ...callerContentStyle,
- }}
- >
- <WordHighlightCaptionsContent
- captionAreaWidth={width ?? null}
- captions={captions}
- combineTokensWithinMilliseconds={combineTokensWithinMilliseconds}
- fontLoaded={fontLoaded}
- />
- </div>
+ <WordHighlightCaptionsContent
+ captionAreaWidth={width ?? null}
+ captions={captions}
+ combineTokensWithinMilliseconds={combineTokensWithinMilliseconds}
+ fontLoaded={fontLoaded}
+ />
</div>
</Sequence>
);
@@ -350,92 +314,64 @@ const WordHighlightCaptionsLayer = Interactive.withSchema({
componentIdentity: null,
schema: wordHighlightCaptionsSchema,
supportsEffects: false,
-}) as React.FC<WordHighlightCaptionsLayerProps>;
-
-export const WordHighlightCaptions: React.FC<WordHighlightCaptionsProps> = ({
- captions,
- style,
- ...props
-}) => {
- if (captions) {
- return (
- <WordHighlightCaptionsLayer
- {...props}
- callerStyle={style ?? null}
- captions={captions}
- style={{translate: '0px 0px'}}
- />
- );
- }
+}) as React.FC<WordHighlightCaptionsProps>;
+export const WordHighlightCaptions: React.FC = () => {
return (
- <div
- style={{
- alignItems: 'center',
- display: 'flex',
- height: 180,
- justifyContent: 'center',
- width: 900,
- }}
- >
- <WordHighlightCaptionsLayer
- {...props}
- callerStyle={style ?? null}
- captions={[
- {
- text: 'Captions',
- startMs: 0,
- endMs: 800,
- timestampMs: 400,
- confidence: null,
- },
- {
- text: ' can',
- startMs: 800,
- endMs: 1500,
- timestampMs: 1150,
- confidence: null,
- },
- {
- text: ' move',
- startMs: 1500,
- endMs: 2300,
- timestampMs: 1900,
- confidence: null,
- },
- {
- text: ' with',
- startMs: 2300,
- endMs: 3100,
- timestampMs: 2700,
- confidence: null,
- },
- {
- text: ' every',
- startMs: 3100,
- endMs: 4000,
- timestampMs: 3550,
- confidence: null,
- },
- {
- text: ' spoken',
- startMs: 4000,
- endMs: 5100,
- timestampMs: 4550,
- confidence: null,
- },
- {
- text: ' word.',
- startMs: 5100,
- endMs: 6500,
- timestampMs: 5800,
- confidence: null,
- },
- ]}
- width={props.width ?? 681}
- height={props.height ?? 252}
- style={{translate: '0px 0px'}}
- />
- </div>
+ <WordHighlightCaptionsLayer
+ captions={[
+ {
+ text: 'Captions',
+ startMs: 0,
+ endMs: 800,
+ timestampMs: 400,
+ confidence: null,
+ },
+ {
+ text: ' can',
+ startMs: 800,
+ endMs: 1500,
+ timestampMs: 1150,
+ confidence: null,
+ },
+ {
+ text: ' move',
+ startMs: 1500,
+ endMs: 2300,
+ timestampMs: 1900,
+ confidence: null,
+ },
+ {
+ text: ' with',
+ startMs: 2300,
+ endMs: 3100,
+ timestampMs: 2700,
+ confidence: null,
+ },
+ {
+ text: ' every',
+ startMs: 3100,
+ endMs: 4000,
+ timestampMs: 3550,
+ confidence: null,
+ },
+ {
+ text: ' spoken',
+ startMs: 4000,
+ endMs: 5100,
+ timestampMs: 4550,
+ confidence: null,
+ },
+ {
+ text: ' word.',
+ startMs: 5100,
+ endMs: 6500,
+ timestampMs: 5800,
+ confidence: null,
+ },
+ ]}
+ width={681}
+ height={252}
+ />
);
};