remotion 4.0.520 → 4.0.522

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -71,22 +71,10 @@ export declare const absoluteFillSchema: {
71
71
  readonly hiddenFromList: false;
72
72
  };
73
73
  readonly 'style.fontWeight': {
74
- readonly type: "enum";
75
- readonly default: "400";
74
+ readonly type: "font-weight";
75
+ readonly default: 400;
76
76
  readonly description: "Font weight";
77
- readonly variants: {
78
- readonly '100': {};
79
- readonly '200': {};
80
- readonly '300': {};
81
- readonly '400': {};
82
- readonly '500': {};
83
- readonly '600': {};
84
- readonly '700': {};
85
- readonly '800': {};
86
- readonly '900': {};
87
- readonly normal: {};
88
- readonly bold: {};
89
- };
77
+ readonly keyframable: false;
90
78
  };
91
79
  readonly 'style.fontStyle': {
92
80
  readonly type: "enum";
@@ -7,6 +7,7 @@ import type { EffectDefinition } from './effects/effect-types.js';
7
7
  import type { InteractivitySchema } from './interactivity-schema.js';
8
8
  import type { InferProps, PropsIfHasProps } from './props-if-has-props.js';
9
9
  import type { RuntimeValueSnapshot, RuntimeValueStore } from './runtime-value-store.js';
10
+ import type { VideoConfigValues } from './video-config.js';
10
11
  export type TComposition<Schema extends AnyZodObject, Props extends Record<string, unknown>> = {
11
12
  width: number | undefined;
12
13
  height: number | undefined;
@@ -61,6 +62,7 @@ export type JsxComponentIdentity = string;
61
62
  export type SequenceRegistrationControls = {
62
63
  schema: InteractivitySchema;
63
64
  runtimeValues: RuntimeValueStore;
65
+ videoConfigValues: VideoConfigValues | null;
64
66
  overrideId: string;
65
67
  supportsEffects: boolean;
66
68
  componentIdentity: JsxComponentIdentity | null;
package/dist/cjs/Img.d.ts CHANGED
@@ -213,6 +213,7 @@ export declare const imgSchema: {
213
213
  readonly showInTimeline: import("./interactivity-schema.js").HiddenFieldSchema;
214
214
  readonly src: {
215
215
  readonly type: "asset";
216
+ readonly assetType: "image";
216
217
  readonly default: undefined;
217
218
  readonly description: "Source";
218
219
  readonly keyframable: false;
package/dist/cjs/Img.js CHANGED
@@ -224,6 +224,7 @@ const CanvasImageWithPrivateProps = index_js_1.CanvasImage;
224
224
  exports.imgSchema = {
225
225
  src: {
226
226
  type: 'asset',
227
+ assetType: 'image',
227
228
  default: undefined,
228
229
  description: 'Source',
229
230
  keyframable: false,
@@ -123,22 +123,10 @@ export declare const Interactive: {
123
123
  readonly hiddenFromList: false;
124
124
  };
125
125
  readonly 'style.fontWeight': {
126
- readonly type: "enum";
127
- readonly default: "400";
126
+ readonly type: "font-weight";
127
+ readonly default: 400;
128
128
  readonly description: "Font weight";
129
- readonly variants: {
130
- readonly '100': {};
131
- readonly '200': {};
132
- readonly '300': {};
133
- readonly '400': {};
134
- readonly '500': {};
135
- readonly '600': {};
136
- readonly '700': {};
137
- readonly '800': {};
138
- readonly '900': {};
139
- readonly normal: {};
140
- readonly bold: {};
141
- };
129
+ readonly keyframable: false;
142
130
  };
143
131
  readonly 'style.fontStyle': {
144
132
  readonly type: "enum";
@@ -195,6 +195,7 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, trimBefore = 0, freeze
195
195
  const controlsSupportsEffects = controls === null || controls === void 0 ? void 0 : controls.supportsEffects;
196
196
  const controlsComponentIdentity = controls === null || controls === void 0 ? void 0 : controls.componentIdentity;
197
197
  const controlsComponentName = controls === null || controls === void 0 ? void 0 : controls.componentName;
198
+ const controlsVideoConfigValues = controls === null || controls === void 0 ? void 0 : controls.videoConfigValues;
198
199
  const effectRuntimeValues = (0, react_1.useMemo)(() => {
199
200
  var _a;
200
201
  return (_a = _remotionInternalEffects === null || _remotionInternalEffects === void 0 ? void 0 : _remotionInternalEffects.runtimeValues) !== null && _a !== void 0 ? _a : null;
@@ -205,7 +206,8 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, trimBefore = 0, freeze
205
206
  controlsOverrideId === undefined ||
206
207
  controlsSupportsEffects === undefined ||
207
208
  controlsComponentIdentity === undefined ||
208
- controlsComponentName === undefined) {
209
+ controlsComponentName === undefined ||
210
+ controlsVideoConfigValues === undefined) {
209
211
  return null;
210
212
  }
211
213
  return {
@@ -215,10 +217,12 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, trimBefore = 0, freeze
215
217
  supportsEffects: controlsSupportsEffects,
216
218
  componentIdentity: controlsComponentIdentity,
217
219
  componentName: controlsComponentName,
220
+ videoConfigValues: controlsVideoConfigValues,
218
221
  };
219
222
  }, [
220
223
  controlsComponentIdentity,
221
224
  controlsComponentName,
225
+ controlsVideoConfigValues,
222
226
  controlsOverrideId,
223
227
  controlsRuntimeValues,
224
228
  controlsSchema,
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import type { TSequence } from './CompositionManager.js';
3
3
  import type { CanUpdateSequencePropStatus, DragOverrideValue, GetDragOverrides, GetEffectDragOverrides, PropStatuses } from './use-schema.js';
4
+ import type { VideoConfigValues } from './video-config.js';
4
5
  export type SequenceManagerContext = {
5
6
  registerSequence: (seq: TSequence) => void;
6
7
  updateSequence: ((seq: TSequence) => void) | null;
@@ -74,12 +75,7 @@ export type SequencePropsSubscriptionKey = {
74
75
  effectKeys: string[][];
75
76
  videoConfigValues: VideoConfigValues | null;
76
77
  };
77
- export type VideoConfigValues = {
78
- durationInFrames: number;
79
- fps: number;
80
- height: number;
81
- width: number;
82
- };
78
+ export type { VideoConfigValues } from './video-config.js';
83
79
  export declare const SequenceManagerProvider: React.FC<{
84
80
  readonly children: React.ReactNode;
85
81
  }>;
@@ -201,6 +201,7 @@ export declare const animatedImageSchema: {
201
201
  readonly showInTimeline: import("../interactivity-schema.js").HiddenFieldSchema;
202
202
  readonly src: {
203
203
  readonly type: "asset";
204
+ readonly assetType: "image";
204
205
  readonly default: undefined;
205
206
  readonly description: "Source";
206
207
  readonly keyframable: false;
@@ -23,6 +23,7 @@ const resolve_image_source_1 = require("./resolve-image-source");
23
23
  exports.animatedImageSchema = {
24
24
  src: {
25
25
  type: 'asset',
26
+ assetType: 'image',
26
27
  default: undefined,
27
28
  description: 'Source',
28
29
  keyframable: false,
@@ -58,6 +58,7 @@ type SharedAudioContextValue = {
58
58
  audioSyncAnchorEmitter: AudioSyncAnchorEmitter;
59
59
  scheduleAudioNode: (options: ScheduleAudioNodeOptions) => ScheduleAudioNodeResult;
60
60
  resume: () => Promise<void>;
61
+ resumeAsAutoPlay: () => Promise<void>;
61
62
  suspend: () => Promise<void>;
62
63
  getIsResumingAudioContext: () => Promise<AudioContextResumeResult> | null;
63
64
  unscheduleAudioNode: (node: AudioBufferSourceNode) => void;
@@ -111,6 +111,7 @@ const SharedAudioContextProvider = ({ children, audioLatencyHint, audioEnabled,
111
111
  }
112
112
  const isResuming = (0, react_1.useRef)(null);
113
113
  const nextResumeAttemptId = (0, react_1.useRef)(0);
114
+ const nextResumeIsAutoPlayAttempt = (0, react_1.useRef)(false);
114
115
  const audioSyncAnchor = (0, react_1.useMemo)(() => ({ value: 0 }), []);
115
116
  const audioSyncAnchorListeners = (0, react_1.useRef)([]);
116
117
  const audioSyncAnchorEmitter = (0, react_1.useMemo)(() => {
@@ -201,6 +202,8 @@ const SharedAudioContextProvider = ({ children, audioLatencyHint, audioEnabled,
201
202
  };
202
203
  }, [ctxAndGain, _experimentalKeepAudioContextAlive, logLevel]);
203
204
  const resume = (0, react_1.useCallback)(() => {
205
+ const isAutoPlayAttempt = nextResumeIsAutoPlayAttempt.current;
206
+ nextResumeIsAutoPlayAttempt.current = false;
204
207
  if (!ctxAndGain) {
205
208
  return Promise.resolve();
206
209
  }
@@ -226,7 +229,7 @@ const SharedAudioContextProvider = ({ children, audioLatencyHint, audioEnabled,
226
229
  const abortController = new AbortController();
227
230
  const resumeAttemptId = nextResumeAttemptId.current++;
228
231
  const waitPromise = new Promise((resolve) => {
229
- (0, wait_until_actually_resumed_js_1.waitUntilActuallyResumed)(ctxAndGain.audioContext, logLevel, abortController.signal).then(resolve);
232
+ (0, wait_until_actually_resumed_js_1.waitUntilActuallyResumed)(ctxAndGain.audioContext, logLevel, abortController.signal, isAutoPlayAttempt).then(resolve);
230
233
  resumePromise.catch((err) => {
231
234
  log_js_1.Log.warn({ logLevel, tag: 'audio' }, 'AudioContext resume rejected, muting playback and continuing without audio', err);
232
235
  abortController.abort();
@@ -248,6 +251,10 @@ const SharedAudioContextProvider = ({ children, audioLatencyHint, audioEnabled,
248
251
  // since callers (e.g. use-playback.ts) do not await this.
249
252
  });
250
253
  }, [ctxAndGain, _experimentalKeepAudioContextAlive, logLevel]);
254
+ const resumeAsAutoPlay = (0, react_1.useCallback)(() => {
255
+ nextResumeIsAutoPlayAttempt.current = true;
256
+ return resume();
257
+ }, [resume]);
251
258
  const getIsResumingAudioContext = (0, react_1.useCallback)(() => {
252
259
  var _a;
253
260
  var _b;
@@ -326,6 +333,7 @@ const SharedAudioContextProvider = ({ children, audioLatencyHint, audioEnabled,
326
333
  audioSyncAnchorEmitter,
327
334
  scheduleAudioNode,
328
335
  resume,
336
+ resumeAsAutoPlay,
329
337
  suspend,
330
338
  getIsResumingAudioContext,
331
339
  unscheduleAudioNode,
@@ -337,6 +345,7 @@ const SharedAudioContextProvider = ({ children, audioLatencyHint, audioEnabled,
337
345
  audioSyncAnchorEmitter,
338
346
  scheduleAudioNode,
339
347
  resume,
348
+ resumeAsAutoPlay,
340
349
  suspend,
341
350
  getIsResumingAudioContext,
342
351
  unscheduleAudioNode,
@@ -1,2 +1,2 @@
1
1
  export type AudioContextResumeResult = 'resumed' | 'cancelled' | 'failed';
2
- export declare const waitUntilActuallyResumed: (audioContext: AudioContext, logLevel: "error" | "info" | "trace" | "verbose" | "warn", signal: AbortSignal) => Promise<AudioContextResumeResult>;
2
+ export declare const waitUntilActuallyResumed: (audioContext: AudioContext, logLevel: "error" | "info" | "trace" | "verbose" | "warn", signal: AbortSignal, isAutoPlayAttempt: boolean) => Promise<AudioContextResumeResult>;
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.waitUntilActuallyResumed = void 0;
4
4
  const log_js_1 = require("../log.js");
5
5
  const RESUME_WAIT_TIMEOUT = 1000;
6
- const waitUntilActuallyResumed = (audioContext, logLevel, signal) => {
6
+ const waitUntilActuallyResumed = (audioContext, logLevel, signal, isAutoPlayAttempt) => {
7
7
  return new Promise((resolve) => {
8
8
  const startCurrentTime = audioContext.currentTime;
9
9
  const start = audioContext.getOutputTimestamp();
@@ -55,19 +55,21 @@ const waitUntilActuallyResumed = (audioContext, logLevel, signal) => {
55
55
  return;
56
56
  }
57
57
  signal.addEventListener('abort', onAbort, { once: true });
58
- timeout = setTimeout(() => {
59
- // The success check is scheduled with requestAnimationFrame, which can
60
- // be starved while the main thread is busy. Re-check once before
61
- // declaring failure so a resume that actually completed is not
62
- // reported as failed - the Player would otherwise mute itself even
63
- // though playback was started by a user gesture and audio is running.
64
- if (hasAudiblyStarted(startOutputPerformanceTime)) {
65
- finish('resumed');
66
- return;
67
- }
68
- log_js_1.Log.warn({ logLevel, tag: 'audio' }, 'WARNING: You enabled autoPlay on an unmuted <Player /> and the browser did not allow the video to be started. Remotion muted the <Player /> so it can play. To properly handle this, either set the `muted` prop or remove the `autoPlay` prop');
69
- finish('failed');
70
- }, RESUME_WAIT_TIMEOUT);
58
+ if (isAutoPlayAttempt) {
59
+ timeout = setTimeout(() => {
60
+ // The success check is scheduled with requestAnimationFrame, which can
61
+ // be starved while the main thread is busy. Re-check once before
62
+ // declaring failure so a resume that actually completed is not
63
+ // reported as failed - the Player would otherwise mute itself even
64
+ // though playback was started by a user gesture and audio is running.
65
+ if (hasAudiblyStarted(startOutputPerformanceTime)) {
66
+ finish('resumed');
67
+ return;
68
+ }
69
+ log_js_1.Log.warn({ logLevel, tag: 'audio' }, 'WARNING: You enabled autoPlay on an unmuted <Player /> and the browser did not allow the video to be started. Remotion muted the <Player /> so it can play. To properly handle this, either set the `muted` prop or remove the `autoPlay` prop');
70
+ finish('failed');
71
+ }, RESUME_WAIT_TIMEOUT);
72
+ }
71
73
  animationFrame = requestAnimationFrame(check);
72
74
  });
73
75
  };
@@ -201,6 +201,7 @@ export declare const canvasImageSchema: {
201
201
  readonly showInTimeline: import("../interactivity-schema.js").HiddenFieldSchema;
202
202
  readonly src: {
203
203
  readonly type: "asset";
204
+ readonly assetType: "image";
204
205
  readonly default: undefined;
205
206
  readonly description: "Source";
206
207
  readonly keyframable: false;
@@ -22,6 +22,7 @@ const with_interactivity_schema_js_1 = require("../with-interactivity-schema.js"
22
22
  exports.canvasImageSchema = {
23
23
  src: {
24
24
  type: 'asset',
25
+ assetType: 'image',
25
26
  default: undefined,
26
27
  description: 'Source',
27
28
  keyframable: false,
@@ -97,8 +97,15 @@ export type FontFamilyFieldSchema = {
97
97
  description?: string;
98
98
  keyframable?: false;
99
99
  };
100
+ export type FontWeightFieldSchema = {
101
+ type: 'font-weight';
102
+ default: number | string | undefined;
103
+ description?: string;
104
+ keyframable?: false;
105
+ };
100
106
  export type AssetFieldSchema = {
101
107
  type: 'asset';
108
+ assetType?: 'audio' | 'video' | 'image';
102
109
  default: string | undefined;
103
110
  description?: string;
104
111
  keyframable?: false;
@@ -138,7 +145,7 @@ export type CaptionsFieldSchema = {
138
145
  description?: string;
139
146
  keyframable: false;
140
147
  };
141
- export type VisibleFieldSchema = NumberFieldSchema | BooleanFieldSchema | RotationCssFieldSchema | RotationDegreesFieldSchema | TranslateFieldSchema | TransformOriginFieldSchema | ScaleFieldSchema | UvCoordinateFieldSchema | ColorFieldSchema | TextContentFieldSchema | FontFamilyFieldSchema | AssetFieldSchema | ArrayFieldSchema | CaptionsFieldSchema | EnumFieldSchema;
148
+ export type VisibleFieldSchema = NumberFieldSchema | BooleanFieldSchema | RotationCssFieldSchema | RotationDegreesFieldSchema | TranslateFieldSchema | TransformOriginFieldSchema | ScaleFieldSchema | UvCoordinateFieldSchema | ColorFieldSchema | TextContentFieldSchema | FontFamilyFieldSchema | FontWeightFieldSchema | AssetFieldSchema | ArrayFieldSchema | CaptionsFieldSchema | EnumFieldSchema;
142
149
  export type InteractivitySchemaField = VisibleFieldSchema | HiddenFieldSchema;
143
150
  export type InteractivitySchema = {
144
151
  [key: string]: InteractivitySchemaField;
@@ -255,22 +262,10 @@ export declare const textSchema: {
255
262
  readonly hiddenFromList: false;
256
263
  };
257
264
  readonly 'style.fontWeight': {
258
- readonly type: "enum";
259
- readonly default: "400";
265
+ readonly type: "font-weight";
266
+ readonly default: 400;
260
267
  readonly description: "Font weight";
261
- readonly variants: {
262
- readonly '100': {};
263
- readonly '200': {};
264
- readonly '300': {};
265
- readonly '400': {};
266
- readonly '500': {};
267
- readonly '600': {};
268
- readonly '700': {};
269
- readonly '800': {};
270
- readonly '900': {};
271
- readonly normal: {};
272
- readonly bold: {};
273
- };
268
+ readonly keyframable: false;
274
269
  };
275
270
  readonly 'style.fontStyle': {
276
271
  readonly type: "enum";
@@ -76,22 +76,10 @@ exports.textSchema = {
76
76
  hiddenFromList: false,
77
77
  },
78
78
  'style.fontWeight': {
79
- type: 'enum',
80
- default: '400',
79
+ type: 'font-weight',
80
+ default: 400,
81
81
  description: 'Font weight',
82
- variants: {
83
- '100': {},
84
- '200': {},
85
- '300': {},
86
- '400': {},
87
- '500': {},
88
- '600': {},
89
- '700': {},
90
- '800': {},
91
- '900': {},
92
- normal: {},
93
- bold: {},
94
- },
82
+ keyframable: false,
95
83
  },
96
84
  'style.fontStyle': {
97
85
  type: 'enum',
@@ -645,22 +645,10 @@ export declare const Internals: {
645
645
  readonly hiddenFromList: false;
646
646
  };
647
647
  readonly 'style.fontWeight': {
648
- readonly type: "enum";
649
- readonly default: "400";
648
+ readonly type: "font-weight";
649
+ readonly default: 400;
650
650
  readonly description: "Font weight";
651
- readonly variants: {
652
- readonly '100': {};
653
- readonly '200': {};
654
- readonly '300': {};
655
- readonly '400': {};
656
- readonly '500': {};
657
- readonly '600': {};
658
- readonly '700': {};
659
- readonly '800': {};
660
- readonly '900': {};
661
- readonly normal: {};
662
- readonly bold: {};
663
- };
651
+ readonly keyframable: false;
664
652
  };
665
653
  readonly 'style.fontStyle': {
666
654
  readonly type: "enum";
@@ -837,6 +825,7 @@ export declare const Internals: {
837
825
  audioSyncAnchorEmitter: import("./audio/shared-audio-tags.js").AudioSyncAnchorEmitter;
838
826
  scheduleAudioNode: (options: ScheduleAudioNodeOptions) => ScheduleAudioNodeResult;
839
827
  resume: () => Promise<void>;
828
+ resumeAsAutoPlay: () => Promise<void>;
840
829
  suspend: () => Promise<void>;
841
830
  getIsResumingAudioContext: () => Promise<import("./audio/wait-until-actually-resumed.js").AudioContextResumeResult> | null;
842
831
  unscheduleAudioNode: (node: AudioBufferSourceNode) => void;
@@ -0,0 +1,8 @@
1
+ import { type InterpolateOptions } from './interpolate.js';
2
+ export type InterpolateTranslateOptions = InterpolateOptions;
3
+ export declare const interpolateTranslate: (input: number, inputRange: readonly number[], outputRange: readonly string[], options?: Partial<{
4
+ easing: import("./interpolate.js").EasingFunction | readonly import("./interpolate.js").EasingFunction[];
5
+ extrapolateLeft: import("./interpolate.js").ExtrapolateType;
6
+ extrapolateRight: import("./interpolate.js").ExtrapolateType;
7
+ posterize: number;
8
+ }> | undefined) => string;
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.interpolateTranslate = void 0;
4
+ const interpolate_js_1 = require("./interpolate.js");
5
+ const pixelValueRegex = /^([+-]?(?:\d+\.?\d*|\.\d+))px$/;
6
+ const parseTranslate = (value) => {
7
+ if (typeof value !== 'string') {
8
+ throw new TypeError(`outputRange must contain only strings, but got ${typeof value}`);
9
+ }
10
+ const parts = value.trim().split(/\s+/);
11
+ if (parts.length < 1 || parts.length > 3 || parts[0] === '') {
12
+ throw new TypeError(`translate values must contain 1 to 3 pixel values, but got "${value}"`);
13
+ }
14
+ return parts.map((part) => {
15
+ const match = pixelValueRegex.exec(part);
16
+ if (match === null) {
17
+ throw new TypeError(`interpolateTranslate() only supports px values, but got "${part}" in "${value}"`);
18
+ }
19
+ return Number(match[1]);
20
+ });
21
+ };
22
+ /*
23
+ * @description Allows you to map a range of values to CSS translate values using pixel units.
24
+ * @see [Documentation](https://remotion.dev/docs/interpolate-translate)
25
+ */
26
+ const interpolateTranslate = (input, inputRange, outputRange, options) => {
27
+ var _a;
28
+ if (typeof input === 'undefined') {
29
+ throw new TypeError('input can not be undefined');
30
+ }
31
+ if (typeof inputRange === 'undefined') {
32
+ throw new TypeError('inputRange can not be undefined');
33
+ }
34
+ if (typeof outputRange === 'undefined') {
35
+ throw new TypeError('outputRange can not be undefined');
36
+ }
37
+ if (inputRange.length !== outputRange.length) {
38
+ throw new TypeError('inputRange (' +
39
+ inputRange.length +
40
+ ' values provided) and outputRange (' +
41
+ outputRange.length +
42
+ ' values provided) must have the same length');
43
+ }
44
+ const parsedOutputRange = outputRange.map((translateValue) => parseTranslate(translateValue));
45
+ const firstValueLength = (_a = parsedOutputRange[0]) === null || _a === void 0 ? void 0 : _a.length;
46
+ if (firstValueLength === undefined) {
47
+ throw new TypeError('outputRange must have at least 1 element');
48
+ }
49
+ for (const parsedTranslate of parsedOutputRange) {
50
+ if (parsedTranslate.length !== firstValueLength) {
51
+ throw new TypeError(`All translate values must have the same number of pixel values, but got ${firstValueLength} and ${parsedTranslate.length}`);
52
+ }
53
+ }
54
+ return new Array(firstValueLength)
55
+ .fill(true)
56
+ .map((_, index) => {
57
+ const outputValues = [];
58
+ for (const translateValue of parsedOutputRange) {
59
+ const value = translateValue[index];
60
+ if (value === undefined) {
61
+ throw new TypeError(`All translate values must have the same number of pixel values, but got ${firstValueLength} and ${translateValue.length}`);
62
+ }
63
+ outputValues.push(value);
64
+ }
65
+ const interpolatedValue = (0, interpolate_js_1.interpolate)(input, inputRange, outputValues, options);
66
+ return `${interpolatedValue}px`;
67
+ })
68
+ .join(' ');
69
+ };
70
+ exports.interpolateTranslate = interpolateTranslate;