Skip to content

🎥 Make videos programmatically with React

Merge pull request #10857 from remotion-dev/captions-eye

Igor Samokhovets11d976db7d39
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 cffc69a941..a80f5808fc 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
@@ -476,25 +476,16 @@ const MovingPillCaptionsInner = forwardRef<
},
);
-const MovingPillCaptionsLayer = Interactive.withSchema({
- Component: MovingPillCaptionsInner,
- componentName: '<MovingPillCaptions>',
- componentIdentity: null,
- schema: movingPillCaptionsSchema,
- supportsEffects: false,
-}) as React.FC<MovingPillCaptionsLayerProps>;
-
-export const MovingPillCaptions: React.FC<MovingPillCaptionsProps> = ({
- captions,
- style,
- ...props
-}) => {
+const MovingPillCaptionsWithControls: React.FC<
+ MovingPillCaptionsProps & {readonly controls: SequenceControls | undefined}
+> = ({captions, controls, style, ...props}) => {
if (captions) {
return (
- <MovingPillCaptionsLayer
+ <MovingPillCaptionsInner
{...props}
callerStyle={style ?? null}
captions={captions}
+ controls={controls}
style={{translate: '0px 0px'}}
/>
);
@@ -510,7 +501,7 @@ export const MovingPillCaptions: React.FC<MovingPillCaptionsProps> = ({
width: 900,
}}
>
- <MovingPillCaptionsLayer
+ <MovingPillCaptionsInner
{...props}
callerStyle={style ?? null}
captions={[
@@ -564,10 +555,19 @@ export const MovingPillCaptions: React.FC<MovingPillCaptionsProps> = ({
confidence: null,
},
]}
- width={681}
- height={252}
+ controls={controls}
+ width={props.width ?? 681}
+ height={props.height ?? 252}
style={{translate: '0px 0px'}}
/>
</div>
);
};
+
+export const MovingPillCaptions = Interactive.withSchema({
+ Component: MovingPillCaptionsWithControls,
+ componentName: '<MovingPillCaptions>',
+ componentIdentity: null,
+ schema: movingPillCaptionsSchema,
+ supportsEffects: false,
+}) as React.FC<MovingPillCaptionsProps>;
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 c73e077110..b5a4a5f704 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
@@ -386,25 +386,16 @@ const PoppingWordCaptionsInner = forwardRef<
},
);
-const PoppingWordCaptionsLayer = Interactive.withSchema({
- Component: PoppingWordCaptionsInner,
- componentName: '<PoppingWordCaptions>',
- componentIdentity: null,
- schema: poppingWordCaptionsSchema,
- supportsEffects: false,
-}) as React.FC<PoppingWordCaptionsLayerProps>;
-
-export const PoppingWordCaptions: React.FC<PoppingWordCaptionsProps> = ({
- captions,
- style,
- ...props
-}) => {
+const PoppingWordCaptionsWithControls: React.FC<
+ PoppingWordCaptionsProps & {readonly controls: SequenceControls | undefined}
+> = ({captions, controls, style, ...props}) => {
if (captions) {
return (
- <PoppingWordCaptionsLayer
+ <PoppingWordCaptionsInner
{...props}
callerStyle={style ?? null}
captions={captions}
+ controls={controls}
style={{translate: '0px 0px'}}
/>
);
@@ -420,7 +411,7 @@ export const PoppingWordCaptions: React.FC<PoppingWordCaptionsProps> = ({
width: 900,
}}
>
- <PoppingWordCaptionsLayer
+ <PoppingWordCaptionsInner
{...props}
callerStyle={style ?? null}
captions={[
@@ -474,10 +465,19 @@ export const PoppingWordCaptions: React.FC<PoppingWordCaptionsProps> = ({
confidence: null,
},
]}
- width={681}
- height={252}
+ controls={controls}
+ width={props.width ?? 681}
+ height={props.height ?? 252}
style={{translate: '0px 0px'}}
/>
</div>
);
};
+
+export const PoppingWordCaptions = Interactive.withSchema({
+ Component: PoppingWordCaptionsWithControls,
+ componentName: '<PoppingWordCaptions>',
+ componentIdentity: null,
+ schema: poppingWordCaptionsSchema,
+ supportsEffects: false,
+}) as React.FC<PoppingWordCaptionsProps>;
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 adac3d873b..d6b54bfa01 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
@@ -344,25 +344,16 @@ const WordHighlightCaptionsInner = forwardRef<
},
);
-const WordHighlightCaptionsLayer = Interactive.withSchema({
- Component: WordHighlightCaptionsInner,
- componentName: '<WordHighlightCaptions>',
- componentIdentity: null,
- schema: wordHighlightCaptionsSchema,
- supportsEffects: false,
-}) as React.FC<WordHighlightCaptionsLayerProps>;
-
-export const WordHighlightCaptions: React.FC<WordHighlightCaptionsProps> = ({
- captions,
- style,
- ...props
-}) => {
+const WordHighlightCaptionsWithControls: React.FC<
+ WordHighlightCaptionsProps & {readonly controls: SequenceControls | undefined}
+> = ({captions, controls, style, ...props}) => {
if (captions) {
return (
- <WordHighlightCaptionsLayer
+ <WordHighlightCaptionsInner
{...props}
callerStyle={style ?? null}
captions={captions}
+ controls={controls}
style={{translate: '0px 0px'}}
/>
);
@@ -378,7 +369,7 @@ export const WordHighlightCaptions: React.FC<WordHighlightCaptionsProps> = ({
width: 900,
}}
>
- <WordHighlightCaptionsLayer
+ <WordHighlightCaptionsInner
{...props}
callerStyle={style ?? null}
captions={[
@@ -432,10 +423,19 @@ export const WordHighlightCaptions: React.FC<WordHighlightCaptionsProps> = ({
confidence: null,
},
]}
- width={681}
- height={252}
+ controls={controls}
+ width={props.width ?? 681}
+ height={props.height ?? 252}
style={{translate: '0px 0px'}}
/>
</div>
);
};
+
+export const WordHighlightCaptions = Interactive.withSchema({
+ Component: WordHighlightCaptionsWithControls,
+ componentName: '<WordHighlightCaptions>',
+ componentIdentity: null,
+ schema: wordHighlightCaptionsSchema,
+ supportsEffects: false,
+}) as React.FC<WordHighlightCaptionsProps>;