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.
@@ -0,0 +1,203 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.wrapInSchema = exports.mergeValues = exports.selectActiveKeys = exports.readValuesFromProps = exports.getNestedValue = void 0;
37
+ const react_1 = __importStar(require("react"));
38
+ const delete_nested_key_js_1 = require("./delete-nested-key.js");
39
+ const use_memoized_effects_js_1 = require("./effects/use-memoized-effects.js");
40
+ const flatten_schema_js_1 = require("./flatten-schema.js");
41
+ const sequence_field_schema_js_1 = require("./sequence-field-schema.js");
42
+ const sequence_node_path_js_1 = require("./sequence-node-path.js");
43
+ const SequenceManager_js_1 = require("./SequenceManager.js");
44
+ const use_current_frame_js_1 = require("./use-current-frame.js");
45
+ const use_remotion_environment_js_1 = require("./use-remotion-environment.js");
46
+ const use_schema_js_1 = require("./use-schema.js");
47
+ const getNestedValue = (obj, key) => {
48
+ const parts = key.split('.');
49
+ let current = obj;
50
+ for (const part of parts) {
51
+ if (current === null ||
52
+ current === undefined ||
53
+ typeof current !== 'object')
54
+ return undefined;
55
+ current = current[part];
56
+ }
57
+ return current;
58
+ };
59
+ exports.getNestedValue = getNestedValue;
60
+ const readValuesFromProps = (props, keys) => {
61
+ const out = {};
62
+ for (const key of keys) {
63
+ out[key] = (0, exports.getNestedValue)(props, key);
64
+ }
65
+ return out;
66
+ };
67
+ exports.readValuesFromProps = readValuesFromProps;
68
+ const selectActiveKeys = (schema, values) => {
69
+ return Object.keys((0, flatten_schema_js_1.flattenActiveSchema)(schema, (key) => values[key]));
70
+ };
71
+ exports.selectActiveKeys = selectActiveKeys;
72
+ const mergeValues = ({ props, valuesDotNotation, schemaKeys, propsToDelete, }) => {
73
+ const merged = { ...props };
74
+ for (const key of schemaKeys) {
75
+ const value = valuesDotNotation[key];
76
+ const parts = key.split('.');
77
+ if (parts.length === 1) {
78
+ merged[key] = value;
79
+ continue;
80
+ }
81
+ // For dot-notation keys like 'style.opacity',
82
+ // clone and set the nested path
83
+ let current = merged;
84
+ for (let i = 0; i < parts.length - 1; i++) {
85
+ const part = parts[i];
86
+ if (typeof current[part] === 'object' && current[part] !== null) {
87
+ current[part] = { ...current[part] };
88
+ }
89
+ else {
90
+ current[part] = {};
91
+ }
92
+ current = current[part];
93
+ }
94
+ current[parts[parts.length - 1]] = value;
95
+ }
96
+ (0, delete_nested_key_js_1.deleteNestedKey)(merged, propsToDelete);
97
+ return merged;
98
+ };
99
+ exports.mergeValues = mergeValues;
100
+ const stackToOverrideMap = {};
101
+ const wrapInSchema = ({ Component, componentIdentity, schema, supportsEffects, }) => {
102
+ // Schema is static for a component, so we move this outside
103
+ const schemaWithSequenceName = (0, sequence_field_schema_js_1.extendSchemaWithSequenceName)(schema);
104
+ const flatSchema = (0, flatten_schema_js_1.getFlatSchemaWithAllKeys)(schemaWithSequenceName);
105
+ const flatKeys = Object.keys(flatSchema);
106
+ const Wrapped = (0, react_1.forwardRef)((props, ref) => {
107
+ var _a;
108
+ const env = (0, use_remotion_environment_js_1.useRemotionEnvironment)();
109
+ if (!env.isStudio || env.isReadOnlyStudio || env.isRendering) {
110
+ return react_1.default.createElement(Component, {
111
+ ...props,
112
+ _experimentalControls: null,
113
+ ref,
114
+ });
115
+ }
116
+ // eslint-disable-next-line react-hooks/rules-of-hooks
117
+ const { propStatuses } = (0, react_1.useContext)(SequenceManager_js_1.VisualModePropStatusesContext);
118
+ // eslint-disable-next-line react-hooks/rules-of-hooks
119
+ const { getDragOverrides } = (0, react_1.useContext)(SequenceManager_js_1.VisualModeDragOverridesContext);
120
+ // eslint-disable-next-line react-hooks/rules-of-hooks
121
+ const nodePathMapping = (0, react_1.useContext)(sequence_node_path_js_1.OverrideIdsToNodePathsGettersContext);
122
+ // eslint-disable-next-line react-hooks/rules-of-hooks
123
+ const frame = (0, use_current_frame_js_1.useCurrentFrame)();
124
+ // If the parent has passed `_experimentalControls`, we should not override it.
125
+ // @ts-expect-error
126
+ if (props._experimentalControls) {
127
+ return react_1.default.createElement(Component, {
128
+ ...props,
129
+ ref,
130
+ });
131
+ }
132
+ // eslint-disable-next-line react-hooks/rules-of-hooks
133
+ const [overrideId] = (0, react_1.useState)(() => {
134
+ const { stack } = props;
135
+ if (!stack) {
136
+ return String(Math.random());
137
+ }
138
+ const existingOverrideId = stackToOverrideMap[stack];
139
+ if (existingOverrideId) {
140
+ return existingOverrideId;
141
+ }
142
+ const newOverrideId = String(Math.random());
143
+ stackToOverrideMap[stack] = newOverrideId;
144
+ return newOverrideId;
145
+ });
146
+ const nodePath = (_a = nodePathMapping.overrideIdToNodePathMappings[overrideId]) !== null && _a !== void 0 ? _a : null;
147
+ // Read the runtime values for every flat key from the JSX props,
148
+ // memoized on the leaf values so the object reference is stable
149
+ // when nothing changed — otherwise downstream `useMemo`s churn and
150
+ // effects (e.g. Sequence registration) re-fire every render.
151
+ const runtimeValues = flatKeys.map((k) => (0, exports.getNestedValue)(props, k));
152
+ // eslint-disable-next-line react-hooks/rules-of-hooks
153
+ const currentRuntimeValueDotNotation = (0, react_1.useMemo)(() => (0, exports.readValuesFromProps)(props, flatKeys),
154
+ // eslint-disable-next-line react-hooks/exhaustive-deps
155
+ runtimeValues);
156
+ // eslint-disable-next-line react-hooks/rules-of-hooks
157
+ const controls = (0, react_1.useMemo)(() => {
158
+ return {
159
+ schema: schemaWithSequenceName,
160
+ currentRuntimeValueDotNotation,
161
+ overrideId,
162
+ supportsEffects,
163
+ componentIdentity,
164
+ };
165
+ }, [currentRuntimeValueDotNotation, overrideId]);
166
+ // 3. Apply drag/code overrides on top of the runtime values.
167
+ // eslint-disable-next-line react-hooks/rules-of-hooks
168
+ const { merged: valuesDotNotation, propsToDelete } = (0, react_1.useMemo)(() => {
169
+ return (0, use_schema_js_1.computeEffectiveSchemaValuesDotNotation)({
170
+ schema: schemaWithSequenceName,
171
+ currentValue: currentRuntimeValueDotNotation,
172
+ overrideValues: nodePath === null ? {} : getDragOverrides(nodePath),
173
+ propStatus: nodePath === null
174
+ ? undefined
175
+ : (0, use_memoized_effects_js_1.getPropStatusesCtx)(propStatuses, nodePath),
176
+ frame,
177
+ });
178
+ }, [
179
+ currentRuntimeValueDotNotation,
180
+ getDragOverrides,
181
+ nodePath,
182
+ propStatuses,
183
+ frame,
184
+ ]);
185
+ // 4. Eliminate values forbidden by the resolved discriminated union.
186
+ const activeKeys = (0, exports.selectActiveKeys)(schemaWithSequenceName, valuesDotNotation);
187
+ // 5. Apply the active values back onto the props.
188
+ const mergedProps = (0, exports.mergeValues)({
189
+ props: props,
190
+ valuesDotNotation,
191
+ schemaKeys: activeKeys,
192
+ propsToDelete,
193
+ });
194
+ return react_1.default.createElement(Component, {
195
+ ...mergedProps,
196
+ _experimentalControls: controls,
197
+ ref,
198
+ });
199
+ });
200
+ Wrapped.displayName = `wrapInSchema(${Component.displayName || Component.name || 'Component'})`;
201
+ return Wrapped;
202
+ };
203
+ exports.wrapInSchema = wrapInSchema;
@@ -1537,7 +1537,7 @@ var Composition = (props) => {
1537
1537
  };
1538
1538
 
1539
1539
  // src/version.ts
1540
- var VERSION = "4.0.520";
1540
+ var VERSION = "4.0.522";
1541
1541
 
1542
1542
  // src/multiple-versions-warning.ts
1543
1543
  var checkMultipleRemotionVersions = () => {
@@ -2053,22 +2053,10 @@ var textSchema = {
2053
2053
  hiddenFromList: false
2054
2054
  },
2055
2055
  "style.fontWeight": {
2056
- type: "enum",
2057
- default: "400",
2056
+ type: "font-weight",
2057
+ default: 400,
2058
2058
  description: "Font weight",
2059
- variants: {
2060
- "100": {},
2061
- "200": {},
2062
- "300": {},
2063
- "400": {},
2064
- "500": {},
2065
- "600": {},
2066
- "700": {},
2067
- "800": {},
2068
- "900": {},
2069
- normal: {},
2070
- bold: {}
2071
- }
2059
+ keyframable: false
2072
2060
  },
2073
2061
  "style.fontStyle": {
2074
2062
  type: "enum",
@@ -5254,6 +5242,17 @@ var withInteractivitySchema = ({
5254
5242
  const { getDragOverrides } = useContext19(VisualModeDragOverridesContext);
5255
5243
  const nodePathMapping = useContext19(OverrideIdsToNodePathsGettersContext);
5256
5244
  const frame = useCurrentFrame();
5245
+ const videoConfig = useUnsafeVideoConfig();
5246
+ const durationInFrames = videoConfig?.durationInFrames;
5247
+ const fps = videoConfig?.fps;
5248
+ const height = videoConfig?.height;
5249
+ const width = videoConfig?.width;
5250
+ const videoConfigValues = useMemo12(() => durationInFrames === undefined || fps === undefined || height === undefined || width === undefined ? null : {
5251
+ durationInFrames,
5252
+ fps,
5253
+ height,
5254
+ width
5255
+ }, [durationInFrames, fps, height, width]);
5257
5256
  if (cleanProps.controls) {
5258
5257
  const passedControls = cleanProps.controls;
5259
5258
  if (getStackForControls(passedControls) === null) {
@@ -5292,12 +5291,18 @@ var withInteractivitySchema = ({
5292
5291
  schema: schemaWithSequenceName,
5293
5292
  currentRuntimeValueDotNotation,
5294
5293
  runtimeValues: runtimeValueStore.store,
5294
+ videoConfigValues,
5295
5295
  overrideId,
5296
5296
  supportsEffects,
5297
5297
  componentIdentity,
5298
5298
  componentName
5299
5299
  };
5300
- }, [currentRuntimeValueDotNotation, overrideId, runtimeValueStore.store]);
5300
+ }, [
5301
+ currentRuntimeValueDotNotation,
5302
+ overrideId,
5303
+ runtimeValueStore.store,
5304
+ videoConfigValues
5305
+ ]);
5301
5306
  setStackForControls(controls, internalStack);
5302
5307
  const { merged: valuesDotNotation, propsToDelete } = useMemo12(() => {
5303
5308
  return computeEffectiveSchemaValuesDotNotation({
@@ -5490,9 +5495,10 @@ var RegularSequenceRefForwardingFunction = ({
5490
5495
  const controlsSupportsEffects = controls?.supportsEffects;
5491
5496
  const controlsComponentIdentity = controls?.componentIdentity;
5492
5497
  const controlsComponentName = controls?.componentName;
5498
+ const controlsVideoConfigValues = controls?.videoConfigValues;
5493
5499
  const effectRuntimeValues = useMemo13(() => _remotionInternalEffects?.runtimeValues ?? null, [_remotionInternalEffects]);
5494
5500
  const registrationControls = useMemo13(() => {
5495
- if (controlsSchema === undefined || controlsRuntimeValues === undefined || controlsOverrideId === undefined || controlsSupportsEffects === undefined || controlsComponentIdentity === undefined || controlsComponentName === undefined) {
5501
+ if (controlsSchema === undefined || controlsRuntimeValues === undefined || controlsOverrideId === undefined || controlsSupportsEffects === undefined || controlsComponentIdentity === undefined || controlsComponentName === undefined || controlsVideoConfigValues === undefined) {
5496
5502
  return null;
5497
5503
  }
5498
5504
  return {
@@ -5501,11 +5507,13 @@ var RegularSequenceRefForwardingFunction = ({
5501
5507
  overrideId: controlsOverrideId,
5502
5508
  supportsEffects: controlsSupportsEffects,
5503
5509
  componentIdentity: controlsComponentIdentity,
5504
- componentName: controlsComponentName
5510
+ componentName: controlsComponentName,
5511
+ videoConfigValues: controlsVideoConfigValues
5505
5512
  };
5506
5513
  }, [
5507
5514
  controlsComponentIdentity,
5508
5515
  controlsComponentName,
5516
+ controlsVideoConfigValues,
5509
5517
  controlsOverrideId,
5510
5518
  controlsRuntimeValues,
5511
5519
  controlsSchema,
@@ -6465,6 +6473,7 @@ import { jsx as jsx15 } from "react/jsx-runtime";
6465
6473
  var animatedImageSchema = {
6466
6474
  src: {
6467
6475
  type: "asset",
6476
+ assetType: "image",
6468
6477
  default: undefined,
6469
6478
  description: "Source",
6470
6479
  keyframable: false
@@ -7693,7 +7702,7 @@ var useSingletonAudioContext = ({
7693
7702
 
7694
7703
  // src/audio/wait-until-actually-resumed.ts
7695
7704
  var RESUME_WAIT_TIMEOUT = 1000;
7696
- var waitUntilActuallyResumed = (audioContext, logLevel, signal) => {
7705
+ var waitUntilActuallyResumed = (audioContext, logLevel, signal, isAutoPlayAttempt) => {
7697
7706
  return new Promise((resolve) => {
7698
7707
  const startCurrentTime = audioContext.currentTime;
7699
7708
  const start = audioContext.getOutputTimestamp();
@@ -7741,14 +7750,16 @@ var waitUntilActuallyResumed = (audioContext, logLevel, signal) => {
7741
7750
  return;
7742
7751
  }
7743
7752
  signal.addEventListener("abort", onAbort, { once: true });
7744
- timeout = setTimeout(() => {
7745
- if (hasAudiblyStarted(startOutputPerformanceTime)) {
7746
- finish("resumed");
7747
- return;
7748
- }
7749
- 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");
7750
- finish("failed");
7751
- }, RESUME_WAIT_TIMEOUT);
7753
+ if (isAutoPlayAttempt) {
7754
+ timeout = setTimeout(() => {
7755
+ if (hasAudiblyStarted(startOutputPerformanceTime)) {
7756
+ finish("resumed");
7757
+ return;
7758
+ }
7759
+ 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");
7760
+ finish("failed");
7761
+ }, RESUME_WAIT_TIMEOUT);
7762
+ }
7752
7763
  animationFrame = requestAnimationFrame(check);
7753
7764
  });
7754
7765
  };
@@ -7820,6 +7831,7 @@ var SharedAudioContextProvider = ({
7820
7831
  }
7821
7832
  const isResuming = useRef13(null);
7822
7833
  const nextResumeAttemptId = useRef13(0);
7834
+ const nextResumeIsAutoPlayAttempt = useRef13(false);
7823
7835
  const audioSyncAnchor = useMemo21(() => ({ value: 0 }), []);
7824
7836
  const audioSyncAnchorListeners = useRef13([]);
7825
7837
  const audioSyncAnchorEmitter = useMemo21(() => {
@@ -7895,6 +7907,8 @@ var SharedAudioContextProvider = ({
7895
7907
  };
7896
7908
  }, [ctxAndGain, _experimentalKeepAudioContextAlive, logLevel]);
7897
7909
  const resume = useCallback10(() => {
7910
+ const isAutoPlayAttempt = nextResumeIsAutoPlayAttempt.current;
7911
+ nextResumeIsAutoPlayAttempt.current = false;
7898
7912
  if (!ctxAndGain) {
7899
7913
  return Promise.resolve();
7900
7914
  }
@@ -7916,7 +7930,7 @@ var SharedAudioContextProvider = ({
7916
7930
  const abortController = new AbortController;
7917
7931
  const resumeAttemptId = nextResumeAttemptId.current++;
7918
7932
  const waitPromise = new Promise((resolve) => {
7919
- waitUntilActuallyResumed(ctxAndGain.audioContext, logLevel, abortController.signal).then(resolve);
7933
+ waitUntilActuallyResumed(ctxAndGain.audioContext, logLevel, abortController.signal, isAutoPlayAttempt).then(resolve);
7920
7934
  resumePromise.catch((err) => {
7921
7935
  Log.warn({ logLevel, tag: "audio" }, "AudioContext resume rejected, muting playback and continuing without audio", err);
7922
7936
  abortController.abort();
@@ -7934,6 +7948,10 @@ var SharedAudioContextProvider = ({
7934
7948
  };
7935
7949
  return resumePromise.catch(() => {});
7936
7950
  }, [ctxAndGain, _experimentalKeepAudioContextAlive, logLevel]);
7951
+ const resumeAsAutoPlay = useCallback10(() => {
7952
+ nextResumeIsAutoPlayAttempt.current = true;
7953
+ return resume();
7954
+ }, [resume]);
7937
7955
  const getIsResumingAudioContext = useCallback10(() => {
7938
7956
  return isResuming.current?.promise ?? null;
7939
7957
  }, []);
@@ -7990,6 +8008,7 @@ var SharedAudioContextProvider = ({
7990
8008
  audioSyncAnchorEmitter,
7991
8009
  scheduleAudioNode,
7992
8010
  resume,
8011
+ resumeAsAutoPlay,
7993
8012
  suspend,
7994
8013
  getIsResumingAudioContext,
7995
8014
  unscheduleAudioNode,
@@ -8001,6 +8020,7 @@ var SharedAudioContextProvider = ({
8001
8020
  audioSyncAnchorEmitter,
8002
8021
  scheduleAudioNode,
8003
8022
  resume,
8023
+ resumeAsAutoPlay,
8004
8024
  suspend,
8005
8025
  getIsResumingAudioContext,
8006
8026
  unscheduleAudioNode,
@@ -9387,6 +9407,9 @@ var useMediaPlayback = ({
9387
9407
  const env = useRemotionEnvironment();
9388
9408
  useLayoutEffect10(() => {
9389
9409
  const playbackRateToSet = Math.max(0, playbackRate);
9410
+ if (mediaRef.current && mediaRef.current.defaultPlaybackRate !== playbackRateToSet) {
9411
+ mediaRef.current.defaultPlaybackRate = playbackRateToSet;
9412
+ }
9390
9413
  if (mediaRef.current && mediaRef.current.playbackRate !== playbackRateToSet) {
9391
9414
  mediaRef.current.playbackRate = playbackRateToSet;
9392
9415
  }
@@ -10804,6 +10827,7 @@ import { jsx as jsx27 } from "react/jsx-runtime";
10804
10827
  var canvasImageSchema = {
10805
10828
  src: {
10806
10829
  type: "asset",
10830
+ assetType: "image",
10807
10831
  default: undefined,
10808
10832
  description: "Source",
10809
10833
  keyframable: false
@@ -11572,6 +11596,7 @@ var CanvasImageWithPrivateProps = CanvasImage;
11572
11596
  var imgSchema = {
11573
11597
  src: {
11574
11598
  type: "asset",
11599
+ assetType: "image",
11575
11600
  default: undefined,
11576
11601
  description: "Source",
11577
11602
  keyframable: false
@@ -1,5 +1,5 @@
1
1
  // src/version.ts
2
- var VERSION = "4.0.520";
2
+ var VERSION = "4.0.522";
3
3
  export {
4
4
  VERSION
5
5
  };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/core"
4
4
  },
5
5
  "name": "remotion",
6
- "version": "4.0.520",
6
+ "version": "4.0.522",
7
7
  "description": "Make videos programmatically",
8
8
  "main": "dist/cjs/index.js",
9
9
  "types": "dist/cjs/index.d.ts",
@@ -34,8 +34,8 @@
34
34
  "react": "19.2.3",
35
35
  "react-dom": "19.2.3",
36
36
  "webpack": "5.105.0",
37
- "zod": "4.4.3",
38
- "@remotion/eslint-config-internal": "4.0.520",
37
+ "zod": "4.5.4",
38
+ "@remotion/eslint-config-internal": "4.0.522",
39
39
  "eslint": "9.19.0",
40
40
  "@typescript/native-preview": "7.0.0-dev.20260217.1"
41
41
  },