Skip to content

🎥 Make videos programmatically with React

Remove loop from shared interactivity schemas

JonnyBurgere7635847f241
diff --git a/packages/core/src/animated-image/AnimatedImage.tsx b/packages/core/src/animated-image/AnimatedImage.tsx
index e3c70d9a1e..e4695895d8 100644
--- a/packages/core/src/animated-image/AnimatedImage.tsx
+++ b/packages/core/src/animated-image/AnimatedImage.tsx
@@ -22,6 +22,7 @@ import {
borderRadiusSchema,
borderSchema,
cropSchema,
+ loopField,
premountSchema,
transformSchema,
type InteractivitySchema,
@@ -57,6 +58,7 @@ export const animatedImageSchema = {
keyframable: false,
},
...baseSchema,
+ loop: loopField,
...cropSchema,
...premountSchema,
...transformSchema,
diff --git a/packages/core/src/interactivity-schema.ts b/packages/core/src/interactivity-schema.ts
index cee220148b..0a0f741e96 100644
--- a/packages/core/src/interactivity-schema.ts
+++ b/packages/core/src/interactivity-schema.ts
@@ -648,7 +648,6 @@ export const baseSchema = {
from: fromField,
trimBefore: trimBeforeField,
playbackRate: playbackRateField,
- loop: loopField,
freeze: freezeField,
hidden: hiddenField,
name: sequenceNameField,
@@ -660,7 +659,6 @@ export const baseSchemaWithoutPlaybackRate = {
durationInFrames: durationInFramesField,
from: fromField,
trimBefore: trimBeforeField,
- loop: loopField,
freeze: freezeField,
hidden: hiddenField,
name: sequenceNameField,
@@ -684,7 +682,6 @@ export const baseSchemaWithoutFrom = {
durationInFrames: durationInFramesField,
trimBefore: trimBeforeField,
playbackRate: playbackRateField,
- loop: loopField,
freeze: freezeField,
hidden: hiddenField,
name: sequenceNameField,
diff --git a/packages/core/src/series/index.tsx b/packages/core/src/series/index.tsx
index e5f24d2647..31445dfb7c 100644
--- a/packages/core/src/series/index.tsx
+++ b/packages/core/src/series/index.tsx
@@ -66,7 +66,6 @@ const seriesSequenceSchema = {
freeze: Interactive.baseSchema.freeze,
trimBefore: Interactive.sequenceSchema.trimBefore,
playbackRate: Interactive.sequenceSchema.playbackRate,
- loop: {type: 'hidden'},
layout: Interactive.sequenceSchema.layout,
} as const satisfies InteractivitySchema;
diff --git a/packages/core/src/test/with-interactivity-schema-helpers.test.ts b/packages/core/src/test/with-interactivity-schema-helpers.test.ts
index bd1a0a4dcb..4ec9be2cb7 100644
--- a/packages/core/src/test/with-interactivity-schema-helpers.test.ts
+++ b/packages/core/src/test/with-interactivity-schema-helpers.test.ts
@@ -20,6 +20,7 @@ import {
captionsSchema,
cropSchema,
extendSchemaWithSequenceName,
+ loopField,
premountSchema,
sequenceCropSchema,
sequencePremountSchema,
@@ -150,17 +151,13 @@ test('baseSchema exposes common timeline fields', () => {
'showInTimeline',
'trimBefore',
'playbackRate',
- 'loop',
].sort(),
);
- for (const schema of [
- imgSchema,
- animatedImageSchema,
- canvasImageSchema,
- solidSchema,
- ]) {
- expect(schema.loop).toBe(baseSchema.loop);
+ for (const schema of [imgSchema, canvasImageSchema, solidSchema]) {
+ expect('loop' in schema).toBe(false);
}
+
+ expect(animatedImageSchema.loop).toBe(loopField);
});
test('pixelDensity is exposed only by canvas-backed component schemas', () => {
@@ -251,7 +248,6 @@ test('getFlatSchema(sequenceSchema) exposes every variant key', () => {
'freeze',
'trimBefore',
'playbackRate',
- 'loop',
].sort(),
);
});
@@ -573,7 +569,6 @@ test('selectActiveKeys returns only the hidden + layout keys when layout=none',
'from',
'trimBefore',
'playbackRate',
- 'loop',
'freeze',
].sort(),
);
@@ -596,7 +591,6 @@ test('selectActiveKeys exposes style.* keys when layout=absolute-fill', () => {
'from',
'trimBefore',
'playbackRate',
- 'loop',
'freeze',
'style.translate',
'style.scale',
@@ -629,7 +623,6 @@ test('selectActiveKeys exposes style.* keys when layout=absolute-fill', () => {
'from',
'trimBefore',
'playbackRate',
- 'loop',
'freeze',
].sort(),
);
@@ -682,7 +675,6 @@ test('end-to-end: layout=none drops style.scale from active props', () => {
'from',
'trimBefore',
'playbackRate',
- 'loop',
'freeze',
].sort(),
);
diff --git a/packages/docs/docs/interactive.mdx b/packages/docs/docs/interactive.mdx
index b7e825d3e2..ba8e294f59 100644
--- a/packages/docs/docs/interactive.mdx
+++ b/packages/docs/docs/interactive.mdx
@@ -72,7 +72,9 @@ Use them with [`Interactive.withSchema()`](/docs/interactive-with-schema).
Controls inherited from [`<Sequence>`](/docs/sequence):
-`durationInFrames`, `from`, `trimBefore`, `playbackRate`, `loop`, `freeze`, `hidden`, `name` and `showInTimeline`.
+`durationInFrames`, `from`, `trimBefore`, `playbackRate`, `freeze`, `hidden`, `name` and `showInTimeline`.
+
+Timed components also accept [`loop`](/docs/sequence#loop), but it is not included in the shared schema. Components with an intrinsic duration, such as [`<Video>`](/docs/video), can expose their own `loop` control.
[`Interactive.withSchema()`](/docs/interactive-with-schema) includes this schema and uses it for its [`<Sequence>`](/docs/sequence).
@@ -167,7 +169,7 @@ See [`Interactive.withSchema()`](/docs/interactive-with-schema).
### `InteractiveBaseProps`<AvailableFrom v="4.0.479" />
-The prop type matching `Interactive.baseSchema`.
+The timing props accepted by interactive components. It includes the props in `Interactive.baseSchema` and `loop`.
### `InteractiveTransformProps`<AvailableFrom v="4.0.479" />
diff --git a/packages/docs/docs/interactivity-schema.mdx b/packages/docs/docs/interactivity-schema.mdx
index 019785fe4a..7c01b4756f 100644
--- a/packages/docs/docs/interactivity-schema.mdx
+++ b/packages/docs/docs/interactivity-schema.mdx
@@ -35,7 +35,9 @@ Keys may use dot notation. For example, a key named `style.opacity` reads from a
### `Interactive.baseSchema`
-Timeline props inherited from [`<Sequence>`](/docs/sequence): [`durationInFrames`](/docs/sequence#durationinframes), [`from`](/docs/sequence#from), [`trimBefore`](/docs/sequence#trimbefore), [`playbackRate`](/docs/sequence#playbackrate), [`loop`](/docs/sequence#loop), [`freeze`](/docs/sequence#freeze), [`hidden`](/docs/sequence#hidden), [`name`](/docs/sequence#name) and [`showInTimeline`](/docs/sequence#showintimeline).
+Timeline props inherited from [`<Sequence>`](/docs/sequence): [`durationInFrames`](/docs/sequence#durationinframes), [`from`](/docs/sequence#from), [`trimBefore`](/docs/sequence#trimbefore), [`playbackRate`](/docs/sequence#playbackrate), [`freeze`](/docs/sequence#freeze), [`hidden`](/docs/sequence#hidden), [`name`](/docs/sequence#name) and [`showInTimeline`](/docs/sequence#showintimeline).
+
+Timed components also accept [`loop`](/docs/sequence#loop), but it is omitted from the shared schema. Components with an intrinsic duration may expose their own `loop` field.
[`Interactive.withSchema()`](/docs/interactive-with-schema) includes this fragment and uses it for its [`<Sequence>`](/docs/sequence).
diff --git a/packages/docs/docs/studio/make-component-interactive.mdx b/packages/docs/docs/studio/make-component-interactive.mdx
index cd5c802bf5..afba2ae995 100644
--- a/packages/docs/docs/studio/make-component-interactive.mdx
+++ b/packages/docs/docs/studio/make-component-interactive.mdx
@@ -70,7 +70,7 @@ const badgeSchema = {
`Interactive.withSchema()` includes these schemas:
-- [`Interactive.baseSchema`](/docs/interactive#interactivebaseschema): [`durationInFrames`](/docs/sequence#durationinframes), [`from`](/docs/sequence#from), [`trimBefore`](/docs/sequence#trimbefore), [`playbackRate`](/docs/sequence#playbackrate), [`loop`](/docs/sequence#loop), [`freeze`](/docs/sequence#freeze), [`hidden`](/docs/sequence#hidden), [`name`](/docs/sequence#name) and [`showInTimeline`](/docs/sequence#showintimeline).
+- [`Interactive.baseSchema`](/docs/interactive#interactivebaseschema): [`durationInFrames`](/docs/sequence#durationinframes), [`from`](/docs/sequence#from), [`trimBefore`](/docs/sequence#trimbefore), [`playbackRate`](/docs/sequence#playbackrate), [`freeze`](/docs/sequence#freeze), [`hidden`](/docs/sequence#hidden), [`name`](/docs/sequence#name) and [`showInTimeline`](/docs/sequence#showintimeline).
- [`Interactive.premountSchema`](/docs/interactive#interactivepremountschema): [`premountFor`](/docs/sequence#premountfor) and [`postmountFor`](/docs/sequence#postmountfor).
- [`Interactive.cropSchema`](/docs/interactive#interactivecropschema): [`cropLeft`](/docs/sequence#cropleft), [`cropRight`](/docs/sequence#cropright), [`cropTop`](/docs/sequence#croptop) and [`cropBottom`](/docs/sequence#cropbottom).
- [`Interactive.transformSchema`](/docs/interactive#interactivetransformschema): [`style.transformOrigin`](https://developer.mozilla.org/en-US/docs/Web/CSS/transform-origin), [`style.translate`](/docs/transforms#translate), [`style.scale`](/docs/transforms#scale), [`style.rotate`](/docs/transforms#rotate) and [`style.opacity`](/docs/transforms#opacity).
diff --git a/packages/gif/src/Gif.tsx b/packages/gif/src/Gif.tsx
index be542902ec..05ffdf311e 100644
--- a/packages/gif/src/Gif.tsx
+++ b/packages/gif/src/Gif.tsx
@@ -38,6 +38,12 @@ export type GifProps = InteractiveBaseProps &
*/
export const gifSchema: InteractivitySchema = {
...Internals.baseSchema,
+ loop: {
+ type: 'boolean',
+ default: false,
+ description: 'Loop',
+ keyframable: false,
+ },
...Internals.premountSchema,
...Internals.transformSchema,
...Interactive.backgroundSchema,
diff --git a/packages/gif/src/test/Gif.test.tsx b/packages/gif/src/test/Gif.test.tsx
index 88be166da2..160f0b4e4a 100644
--- a/packages/gif/src/test/Gif.test.tsx
+++ b/packages/gif/src/test/Gif.test.tsx
@@ -23,7 +23,12 @@ test('Gif exposes background, border, and crop controls', () => {
expect('cropRight' in gifSchema).toBe(true);
expect('cropTop' in gifSchema).toBe(true);
expect('cropBottom' in gifSchema).toBe(true);
- expect(gifSchema.loop).toBe(Internals.baseSchema.loop);
+ expect(gifSchema.loop).toEqual({
+ type: 'boolean',
+ default: false,
+ description: 'Loop',
+ keyframable: false,
+ });
});
class MockWorker {
diff --git a/packages/mac-cursors/src/test/resolve-cursor.test.ts b/packages/mac-cursors/src/test/resolve-cursor.test.ts
index 2d31f14a40..0424c92d26 100644
--- a/packages/mac-cursors/src/test/resolve-cursor.test.ts
+++ b/packages/mac-cursors/src/test/resolve-cursor.test.ts
@@ -65,7 +65,7 @@ test('cursor schema exposes named cursors as a keyframable enum', () => {
expect(macOSCursorSchema['style.translate'].type).toBe('translate');
expect(macOSCursorSchema['style.scale'].type).toBe('scale');
expect(macOSCursorSchema['style.rotate'].type).toBe('rotation-css');
- expect(macOSCursorSchema.loop).toBe(Internals.baseSchema.loop);
+ expect('loop' in macOSCursorSchema).toBe(false);
});
test('<MacOSCursor> renders the default cursor when the cursor prop is omitted', () => {
diff --git a/packages/rough-notation/src/test/annotation-schema.test.ts b/packages/rough-notation/src/test/annotation-schema.test.ts
index fed02aa889..ec75f27890 100644
--- a/packages/rough-notation/src/test/annotation-schema.test.ts
+++ b/packages/rough-notation/src/test/annotation-schema.test.ts
@@ -69,7 +69,7 @@ test('all named annotations expose text, font, border, and seed controls', () =>
expect(keys(schema)).toContain('style.borderWidth');
expect(keys(schema)).toContain('style.borderStyle');
expect(keys(schema)).toContain('style.borderColor');
- expect(schema.loop).toBe(Internals.baseSchema.loop);
+ expect(keys(schema)).not.toContain('loop');
expect(schema.seed).not.toHaveProperty('keyframable', false);
}
});
diff --git a/packages/shapes/src/test/schema.test.ts b/packages/shapes/src/test/schema.test.ts
index 9701f87726..d9bdfec06c 100644
--- a/packages/shapes/src/test/schema.test.ts
+++ b/packages/shapes/src/test/schema.test.ts
@@ -1,5 +1,4 @@
import {expect, test} from 'bun:test';
-import {Internals} from 'remotion';
import {makeShapeSchema} from '../components/schema';
test('adds a fill control to shape schemas', () => {
@@ -13,5 +12,5 @@ test('adds a fill control to shape schemas', () => {
expect('style.borderWidth' in schema).toBe(true);
expect('style.borderStyle' in schema).toBe(true);
expect('style.borderColor' in schema).toBe(true);
- expect(schema.loop).toBe(Internals.baseSchema.loop);
+ expect('loop' in schema).toBe(false);
});
diff --git a/packages/studio-server/src/test/discriminated-union-update.test.ts b/packages/studio-server/src/test/discriminated-union-update.test.ts
index e02c3fb2f7..77dd2df7e5 100644
--- a/packages/studio-server/src/test/discriminated-union-update.test.ts
+++ b/packages/studio-server/src/test/discriminated-union-update.test.ts
@@ -25,11 +25,7 @@ test('Should correctly separate discriminated union for layout', () => {
propStatuses: {},
getDragOverrides: () => ({}),
});
- expect(schemaFields?.map((s) => s.key)).toEqual([
- 'playbackRate',
- 'loop',
- 'layout',
- ]);
+ expect(schemaFields?.map((s) => s.key)).toEqual(['playbackRate', 'layout']);
});
test('Should expose absolute-fill variant fields when active', () => {
@@ -50,7 +46,6 @@ test('Should expose absolute-fill variant fields when active', () => {
});
expect(schemaFields?.map((s) => s.key)).toEqual([
'playbackRate',
- 'loop',
'style.transformOrigin',
'style.translate',
'style.scale',
diff --git a/packages/studio-server/src/test/get-all-schema-keys.test.ts b/packages/studio-server/src/test/get-all-schema-keys.test.ts
index 5189dec471..0df7cc84ff 100644
--- a/packages/studio-server/src/test/get-all-schema-keys.test.ts
+++ b/packages/studio-server/src/test/get-all-schema-keys.test.ts
@@ -38,7 +38,6 @@ test('getAllSchemaKeys returns every key across all enum variants', () => {
'from',
'trimBefore',
'playbackRate',
- 'loop',
'freeze',
].sort(),
);
diff --git a/packages/studio-server/src/test/update-sequence-props.test.ts b/packages/studio-server/src/test/update-sequence-props.test.ts
index c437553e89..93d9295150 100644
--- a/packages/studio-server/src/test/update-sequence-props.test.ts
+++ b/packages/studio-server/src/test/update-sequence-props.test.ts
@@ -490,7 +490,10 @@ test('updateSequenceProps should set boolean true as shorthand', async () => {
input: lightLeakInput,
nodePath: lineColumnToNodePath(lightLeakInput, 8),
updates: [{key: 'loop', value: true, defaultValue: false}],
- schema: NoReactInternals.sequenceSchema,
+ schema: {
+ ...NoReactInternals.sequenceSchema,
+ loop: {type: 'boolean', default: false},
+ },
prettierConfigOverride: null,
});
diff --git a/packages/transitions/src/TransitionSeries.tsx b/packages/transitions/src/TransitionSeries.tsx
index a314cababa..e7c6bbad9f 100644
--- a/packages/transitions/src/TransitionSeries.tsx
+++ b/packages/transitions/src/TransitionSeries.tsx
@@ -156,7 +156,6 @@ const transitionSeriesSequenceSchema = {
freeze: Internals.freezeField,
trimBefore: Internals.sequenceSchema.trimBefore,
playbackRate: Internals.sequenceSchema.playbackRate,
- loop: {type: 'hidden'},
layout: Internals.sequenceSchema.layout,
} as const satisfies InteractivitySchema;