remotion 4.0.492 → 4.0.494

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.
@@ -12,7 +12,6 @@ const interactivity_schema_js_1 = require("./interactivity-schema.js");
12
12
  const Sequence_js_1 = require("./Sequence.js");
13
13
  const use_delay_render_js_1 = require("./use-delay-render.js");
14
14
  const use_remotion_environment_js_1 = require("./use-remotion-environment.js");
15
- const use_video_config_js_1 = require("./use-video-config.js");
16
15
  const with_interactivity_schema_js_1 = require("./with-interactivity-schema.js");
17
16
  // Memoize the support check across the session — neither the platform
18
17
  // capability nor the chrome://flags toggle can change between calls.
@@ -357,8 +356,6 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
357
356
  });
358
357
  HtmlInCanvasContent.displayName = 'HtmlInCanvasContent';
359
358
  const HtmlInCanvasInner = (0, react_1.forwardRef)(({ width, height, effects = [], children, onPaint, onInit, pixelDensity, controls, style, durationInFrames, name, ...sequenceProps }, ref) => {
360
- const { durationInFrames: videoDuration } = (0, use_video_config_js_1.useVideoConfig)();
361
- const resolvedDuration = durationInFrames !== null && durationInFrames !== void 0 ? durationInFrames : videoDuration;
362
359
  const memoizedEffectDefinitions = (0, use_memoized_effects_js_1.useMemoizedEffectDefinitions)(effects);
363
360
  const actualRef = (0, react_1.useRef)(null);
364
361
  const setCanvasRef = (0, react_1.useCallback)((node) => {
@@ -370,7 +367,7 @@ const HtmlInCanvasInner = (0, react_1.forwardRef)(({ width, height, effects = []
370
367
  ref.current = node;
371
368
  }
372
369
  }, [ref]);
373
- return (jsx_runtime_1.jsx(Sequence_js_1.Sequence, { durationInFrames: resolvedDuration, name: name !== null && name !== void 0 ? name : '<HtmlInCanvas>', _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/remotion/html-in-canvas", controls: controls, _remotionInternalEffects: memoizedEffectDefinitions, outlineRef: actualRef, layout: "none", ...sequenceProps, children: jsx_runtime_1.jsx(HtmlInCanvasContent, { ref: setCanvasRef, width: width, height: height, effects: effects, onPaint: onPaint, onInit: onInit, pixelDensity: pixelDensity, controls: controls, style: style, children: children }) }));
370
+ return (jsx_runtime_1.jsx(Sequence_js_1.Sequence, { durationInFrames: durationInFrames, name: name !== null && name !== void 0 ? name : '<HtmlInCanvas>', _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/remotion/html-in-canvas", controls: controls, _remotionInternalEffects: memoizedEffectDefinitions, outlineRef: actualRef, layout: "none", ...sequenceProps, children: jsx_runtime_1.jsx(HtmlInCanvasContent, { ref: setCanvasRef, width: width, height: height, effects: effects, onPaint: onPaint, onInit: onInit, pixelDensity: pixelDensity, controls: controls, style: style, children: children }) }));
374
371
  });
375
372
  HtmlInCanvasInner.displayName = 'HtmlInCanvas';
376
373
  exports.htmlInCanvasSchema = {
@@ -1,4 +1,5 @@
1
1
  import type { AnyComposition } from './CompositionManager.js';
2
+ import type { VideoConfigMetadataSource } from './resolve-video-config.js';
2
3
  import type { VideoConfig } from './video-config.js';
3
4
  type ResolveCompositionConfigContect = Record<string, VideoConfigState | undefined>;
4
5
  export declare const ResolveCompositionContext: import("react").Context<ResolveCompositionConfigContect | null>;
@@ -12,9 +13,11 @@ type VideoConfigState = {
12
13
  } | {
13
14
  type: 'success';
14
15
  result: VideoConfig;
16
+ metadataSource: VideoConfigMetadataSource | null;
15
17
  } | {
16
18
  type: 'success-and-refreshing';
17
19
  result: VideoConfig;
20
+ metadataSource: VideoConfigMetadataSource | null;
18
21
  } | {
19
22
  type: 'error';
20
23
  error: Error;
@@ -35,6 +35,7 @@ const useResolvedVideoConfig = (preferredCompositionId) => {
35
35
  if (currentCompositionMetadata) {
36
36
  return {
37
37
  type: 'success',
38
+ metadataSource: null,
38
39
  result: {
39
40
  ...currentCompositionMetadata,
40
41
  id: composition.id,
@@ -52,6 +53,7 @@ const useResolvedVideoConfig = (preferredCompositionId) => {
52
53
  (0, validate_dimensions_js_1.validateDimension)(composition.height, 'height', `in <Composition id="${composition.id}">`);
53
54
  return {
54
55
  type: 'success',
56
+ metadataSource: null,
55
57
  result: {
56
58
  width: composition.width,
57
59
  height: composition.height,
@@ -363,7 +363,7 @@ const PremountedPostmountedSequenceRefForwardingFunction = (props, ref) => {
363
363
  var _a;
364
364
  return {
365
365
  ...passedStyle,
366
- opacity: premountingActive || postmountingActive ? 0 : 1,
366
+ opacity: premountingActive || postmountingActive ? 0 : passedStyle === null || passedStyle === void 0 ? void 0 : passedStyle.opacity,
367
367
  pointerEvents: premountingActive || postmountingActive
368
368
  ? 'none'
369
369
  : ((_a = passedStyle === null || passedStyle === void 0 ? void 0 : passedStyle.pointerEvents) !== null && _a !== void 0 ? _a : undefined),
@@ -14,6 +14,7 @@ const use_video_config_js_1 = require("../use-video-config.js");
14
14
  const with_interactivity_schema_js_1 = require("../with-interactivity-schema.js");
15
15
  const canvas_1 = require("./canvas");
16
16
  const decode_image_js_1 = require("./decode-image.js");
17
+ const get_current_time_js_1 = require("./get-current-time.js");
17
18
  const request_init_1 = require("./request-init");
18
19
  const resolve_image_source_1 = require("./resolve-image-source");
19
20
  const animatedImageSchema = {
@@ -55,7 +56,7 @@ const AnimatedImageContent = (0, react_1.forwardRef)(({ src, width, height, onEr
55
56
  const [decodeHandle] = (0, react_1.useState)(() => delayRender(`Rendering <AnimatedImage/> with src="${resolvedSrc}"`));
56
57
  const frame = (0, use_current_frame_js_1.useCurrentFrame)();
57
58
  const { fps } = (0, use_video_config_js_1.useVideoConfig)();
58
- const currentTime = frame / playbackRate / fps;
59
+ const currentTime = (0, get_current_time_js_1.getCurrentTime)({ frame, playbackRate, fps });
59
60
  const currentTimeRef = (0, react_1.useRef)(currentTime);
60
61
  currentTimeRef.current = currentTime;
61
62
  const requestInitKey = (0, request_init_1.serializeRequestInit)(requestInit);
@@ -168,8 +169,6 @@ const AnimatedImageContent = (0, react_1.forwardRef)(({ src, width, height, onEr
168
169
  });
169
170
  AnimatedImageContent.displayName = 'AnimatedImageContent';
170
171
  const AnimatedImageInner = ({ src, width, height, onError, fit, playbackRate, loopBehavior, id, className, style, durationInFrames, requestInit, effects = [], controls, ref, ...sequenceProps }) => {
171
- const { durationInFrames: videoDuration } = (0, use_video_config_js_1.useVideoConfig)();
172
- const resolvedDuration = durationInFrames !== null && durationInFrames !== void 0 ? durationInFrames : videoDuration;
173
172
  const actualRef = (0, react_1.useRef)(null);
174
173
  const memoizedEffectDefinitions = (0, use_memoized_effects_js_1.useMemoizedEffectDefinitions)(effects);
175
174
  (0, react_1.useImperativeHandle)(ref, () => {
@@ -190,7 +189,7 @@ const AnimatedImageInner = ({ src, width, height, onError, fit, playbackRate, lo
190
189
  requestInit,
191
190
  ...canvasProps,
192
191
  };
193
- return (jsx_runtime_1.jsx(Sequence_js_1.Sequence, { layout: "none", durationInFrames: resolvedDuration, name: "<AnimatedImage>", _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/animatedimage", controls: controls, _remotionInternalEffects: memoizedEffectDefinitions, ...sequenceProps, outlineRef: actualRef, children: jsx_runtime_1.jsx(AnimatedImageContent, { ...animatedImageProps, ref: actualRef, effects: effects, controls: controls }) }));
192
+ return (jsx_runtime_1.jsx(Sequence_js_1.Sequence, { layout: "none", durationInFrames: durationInFrames, name: "<AnimatedImage>", _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/animatedimage", controls: controls, _remotionInternalEffects: memoizedEffectDefinitions, ...sequenceProps, outlineRef: actualRef, children: jsx_runtime_1.jsx(AnimatedImageContent, { ...animatedImageProps, ref: actualRef, effects: effects, controls: controls }) }));
194
193
  };
195
194
  exports.AnimatedImage = (0, with_interactivity_schema_js_1.withInteractivitySchema)({
196
195
  Component: AnimatedImageInner,
@@ -0,0 +1,5 @@
1
+ export declare const getCurrentTime: ({ frame, playbackRate, fps, }: {
2
+ frame: number;
3
+ playbackRate: number;
4
+ fps: number;
5
+ }) => number;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getCurrentTime = void 0;
4
+ const getCurrentTime = ({ frame, playbackRate, fps, }) => {
5
+ return (frame * playbackRate) / fps;
6
+ };
7
+ exports.getCurrentTime = getCurrentTime;
@@ -612,7 +612,7 @@ export declare const Internals: {
612
612
  readonly EditorPropsContext: import("react").Context<import("./EditorProps.js").EditorPropsContextType>;
613
613
  readonly usePreload: (src: string) => string;
614
614
  readonly NonceContext: import("react").Context<import("./nonce.js").TNonceContext>;
615
- readonly resolveVideoConfig: ({ calculateMetadata, signal, defaultProps, inputProps: originalProps, compositionId, compositionDurationInFrames, compositionFps, compositionHeight, compositionWidth, }: {
615
+ readonly resolveVideoConfig: (params: {
616
616
  compositionId: string;
617
617
  compositionWidth: number | null;
618
618
  compositionHeight: number | null;
@@ -640,15 +640,34 @@ export declare const Internals: {
640
640
  type: "error";
641
641
  error: Error;
642
642
  };
643
+ readonly resolveVideoConfigWithMetadataOrCatch: (params: {
644
+ compositionId: string;
645
+ compositionWidth: number | null;
646
+ compositionHeight: number | null;
647
+ compositionFps: number | null;
648
+ compositionDurationInFrames: number | null;
649
+ calculateMetadata: import("./Composition.js").CalculateMetadataFunction<Record<string, unknown>> | null;
650
+ signal: AbortSignal;
651
+ defaultProps: Record<string, unknown>;
652
+ inputProps: Record<string, unknown>;
653
+ }) => {
654
+ type: "success";
655
+ result: Promise<import("./resolve-video-config.js").VideoConfigWithMetadata> | import("./resolve-video-config.js").VideoConfigWithMetadata;
656
+ } | {
657
+ type: "error";
658
+ error: Error;
659
+ };
643
660
  readonly ResolveCompositionContext: import("react").Context<{
644
661
  [x: string]: ({
645
662
  type: "loading";
646
663
  } | {
647
664
  type: "success";
648
665
  result: import("./video-config.js").VideoConfig;
666
+ metadataSource: import("./resolve-video-config.js").VideoConfigMetadataSource | null;
649
667
  } | {
650
668
  type: "success-and-refreshing";
651
669
  result: import("./video-config.js").VideoConfig;
670
+ metadataSource: import("./resolve-video-config.js").VideoConfigMetadataSource | null;
652
671
  } | {
653
672
  type: "error";
654
673
  error: Error;
@@ -659,9 +678,11 @@ export declare const Internals: {
659
678
  } | {
660
679
  type: "success";
661
680
  result: import("./video-config.js").VideoConfig;
681
+ metadataSource: import("./resolve-video-config.js").VideoConfigMetadataSource | null;
662
682
  } | {
663
683
  type: "success-and-refreshing";
664
684
  result: import("./video-config.js").VideoConfig;
685
+ metadataSource: import("./resolve-video-config.js").VideoConfigMetadataSource | null;
665
686
  } | {
666
687
  type: "error";
667
688
  error: Error;
@@ -195,6 +195,7 @@ exports.Internals = {
195
195
  NonceContext: nonce_js_1.NonceContext,
196
196
  resolveVideoConfig: resolve_video_config_js_1.resolveVideoConfig,
197
197
  resolveVideoConfigOrCatch: resolve_video_config_js_1.resolveVideoConfigOrCatch,
198
+ resolveVideoConfigWithMetadataOrCatch: resolve_video_config_js_1.resolveVideoConfigWithMetadataOrCatch,
198
199
  ResolveCompositionContext: ResolveCompositionConfig_js_1.ResolveCompositionContext,
199
200
  useResolvedVideoConfig: ResolveCompositionConfig_js_1.useResolvedVideoConfig,
200
201
  resolveCompositionsRef: ResolveCompositionConfig_js_1.resolveCompositionsRef,
@@ -13,7 +13,25 @@ type ResolveVideoConfigParams = {
13
13
  defaultProps: Record<string, unknown>;
14
14
  inputProps: Record<string, unknown>;
15
15
  };
16
- export declare const resolveVideoConfig: ({ calculateMetadata, signal, defaultProps, inputProps: originalProps, compositionId, compositionDurationInFrames, compositionFps, compositionHeight, compositionWidth, }: ResolveVideoConfigParams) => Promise<VideoConfig> | VideoConfig;
16
+ export type VideoConfigMetadataSource = {
17
+ readonly durationInFrames: 'calculate-metadata' | 'composition';
18
+ readonly fps: 'calculate-metadata' | 'composition';
19
+ readonly height: 'calculate-metadata' | 'composition';
20
+ readonly width: 'calculate-metadata' | 'composition';
21
+ };
22
+ export type VideoConfigWithMetadata = {
23
+ readonly metadataSource: VideoConfigMetadataSource;
24
+ readonly videoConfig: VideoConfig;
25
+ };
26
+ export declare const resolveVideoConfigWithMetadata: ({ calculateMetadata, signal, defaultProps, inputProps: originalProps, compositionId, compositionDurationInFrames, compositionFps, compositionHeight, compositionWidth, }: ResolveVideoConfigParams) => Promise<VideoConfigWithMetadata> | VideoConfigWithMetadata;
27
+ export declare const resolveVideoConfig: (params: ResolveVideoConfigParams) => Promise<VideoConfig> | VideoConfig;
28
+ export declare const resolveVideoConfigWithMetadataOrCatch: (params: ResolveVideoConfigParams) => {
29
+ type: "success";
30
+ result: Promise<VideoConfigWithMetadata> | VideoConfigWithMetadata;
31
+ } | {
32
+ type: "error";
33
+ error: Error;
34
+ };
17
35
  export declare const resolveVideoConfigOrCatch: (params: ResolveVideoConfigParams) => {
18
36
  type: "success";
19
37
  result: Promise<VideoConfig> | VideoConfig;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resolveVideoConfigOrCatch = exports.resolveVideoConfig = void 0;
3
+ exports.resolveVideoConfigOrCatch = exports.resolveVideoConfigWithMetadataOrCatch = exports.resolveVideoConfig = exports.resolveVideoConfigWithMetadata = void 0;
4
4
  const get_remotion_environment_js_1 = require("./get-remotion-environment.js");
5
5
  const input_props_serialization_js_1 = require("./input-props-serialization.js");
6
6
  const validate_default_codec_js_1 = require("./validation/validate-default-codec.js");
@@ -42,8 +42,40 @@ const validateCalculated = ({ calculated, compositionId, compositionFps, composi
42
42
  defaultSampleRate,
43
43
  };
44
44
  };
45
- const resolveVideoConfig = ({ calculateMetadata, signal, defaultProps, inputProps: originalProps, compositionId, compositionDurationInFrames, compositionFps, compositionHeight, compositionWidth, }) => {
45
+ const makeVideoConfigWithMetadata = ({ calculated, compositionDurationInFrames, compositionFps, compositionHeight, compositionId, compositionWidth, defaultProps, originalProps, }) => {
46
46
  var _a, _b, _c, _d, _e, _f, _g;
47
+ const data = validateCalculated({
48
+ calculated,
49
+ compositionDurationInFrames,
50
+ compositionFps,
51
+ compositionHeight,
52
+ compositionWidth,
53
+ compositionId,
54
+ });
55
+ return {
56
+ metadataSource: {
57
+ durationInFrames: (calculated === null || calculated === void 0 ? void 0 : calculated.durationInFrames) === undefined
58
+ ? 'composition'
59
+ : 'calculate-metadata',
60
+ fps: (calculated === null || calculated === void 0 ? void 0 : calculated.fps) === undefined ? 'composition' : 'calculate-metadata',
61
+ height: (calculated === null || calculated === void 0 ? void 0 : calculated.height) === undefined ? 'composition' : 'calculate-metadata',
62
+ width: (calculated === null || calculated === void 0 ? void 0 : calculated.width) === undefined ? 'composition' : 'calculate-metadata',
63
+ },
64
+ videoConfig: {
65
+ ...data,
66
+ id: compositionId,
67
+ defaultProps: (0, input_props_serialization_js_1.serializeThenDeserializeInStudio)(defaultProps !== null && defaultProps !== void 0 ? defaultProps : {}),
68
+ props: (0, input_props_serialization_js_1.serializeThenDeserializeInStudio)((_a = calculated === null || calculated === void 0 ? void 0 : calculated.props) !== null && _a !== void 0 ? _a : originalProps),
69
+ defaultCodec: (_b = data.defaultCodec) !== null && _b !== void 0 ? _b : null,
70
+ defaultOutName: (_c = data.defaultOutName) !== null && _c !== void 0 ? _c : null,
71
+ defaultVideoImageFormat: (_d = data.defaultVideoImageFormat) !== null && _d !== void 0 ? _d : null,
72
+ defaultPixelFormat: (_e = data.defaultPixelFormat) !== null && _e !== void 0 ? _e : null,
73
+ defaultProResProfile: (_f = data.defaultProResProfile) !== null && _f !== void 0 ? _f : null,
74
+ defaultSampleRate: (_g = data.defaultSampleRate) !== null && _g !== void 0 ? _g : null,
75
+ },
76
+ };
77
+ };
78
+ const resolveVideoConfigWithMetadata = ({ calculateMetadata, signal, defaultProps, inputProps: originalProps, compositionId, compositionDurationInFrames, compositionFps, compositionHeight, compositionWidth, }) => {
47
79
  const calculatedProm = calculateMetadata
48
80
  ? calculateMetadata({
49
81
  defaultProps,
@@ -57,68 +89,53 @@ const resolveVideoConfig = ({ calculateMetadata, signal, defaultProps, inputProp
57
89
  typeof calculatedProm === 'object' &&
58
90
  'then' in calculatedProm) {
59
91
  return calculatedProm.then((c) => {
60
- var _a;
61
- const { height, width, durationInFrames, fps, defaultCodec, defaultOutName, defaultVideoImageFormat, defaultPixelFormat, defaultProResProfile, defaultSampleRate, } = validateCalculated({
92
+ return makeVideoConfigWithMetadata({
62
93
  calculated: c,
63
94
  compositionDurationInFrames,
64
95
  compositionFps,
65
96
  compositionHeight,
66
97
  compositionWidth,
67
98
  compositionId,
99
+ defaultProps,
100
+ originalProps,
68
101
  });
69
- return {
70
- width,
71
- height,
72
- fps,
73
- durationInFrames,
74
- id: compositionId,
75
- defaultProps: (0, input_props_serialization_js_1.serializeThenDeserializeInStudio)(defaultProps),
76
- props: (0, input_props_serialization_js_1.serializeThenDeserializeInStudio)((_a = c.props) !== null && _a !== void 0 ? _a : originalProps),
77
- defaultCodec: defaultCodec !== null && defaultCodec !== void 0 ? defaultCodec : null,
78
- defaultOutName: defaultOutName !== null && defaultOutName !== void 0 ? defaultOutName : null,
79
- defaultVideoImageFormat: defaultVideoImageFormat !== null && defaultVideoImageFormat !== void 0 ? defaultVideoImageFormat : null,
80
- defaultPixelFormat: defaultPixelFormat !== null && defaultPixelFormat !== void 0 ? defaultPixelFormat : null,
81
- defaultProResProfile: defaultProResProfile !== null && defaultProResProfile !== void 0 ? defaultProResProfile : null,
82
- defaultSampleRate: defaultSampleRate !== null && defaultSampleRate !== void 0 ? defaultSampleRate : null,
83
- };
84
102
  });
85
103
  }
86
- const data = validateCalculated({
104
+ return makeVideoConfigWithMetadata({
87
105
  calculated: calculatedProm,
88
106
  compositionDurationInFrames,
89
107
  compositionFps,
90
108
  compositionHeight,
91
109
  compositionWidth,
92
110
  compositionId,
111
+ defaultProps,
112
+ originalProps,
93
113
  });
94
- if (calculatedProm === null) {
114
+ };
115
+ exports.resolveVideoConfigWithMetadata = resolveVideoConfigWithMetadata;
116
+ const resolveVideoConfig = (params) => {
117
+ const resolved = (0, exports.resolveVideoConfigWithMetadata)(params);
118
+ if (typeof resolved === 'object' && 'then' in resolved) {
119
+ return resolved.then(({ videoConfig }) => videoConfig);
120
+ }
121
+ return resolved.videoConfig;
122
+ };
123
+ exports.resolveVideoConfig = resolveVideoConfig;
124
+ const resolveVideoConfigWithMetadataOrCatch = (params) => {
125
+ try {
95
126
  return {
96
- ...data,
97
- id: compositionId,
98
- defaultProps: (0, input_props_serialization_js_1.serializeThenDeserializeInStudio)(defaultProps !== null && defaultProps !== void 0 ? defaultProps : {}),
99
- props: (0, input_props_serialization_js_1.serializeThenDeserializeInStudio)(originalProps),
100
- defaultCodec: null,
101
- defaultOutName: null,
102
- defaultVideoImageFormat: null,
103
- defaultPixelFormat: null,
104
- defaultProResProfile: null,
105
- defaultSampleRate: null,
127
+ type: 'success',
128
+ result: (0, exports.resolveVideoConfigWithMetadata)(params),
129
+ };
130
+ }
131
+ catch (err) {
132
+ return {
133
+ type: 'error',
134
+ error: err,
106
135
  };
107
136
  }
108
- return {
109
- ...data,
110
- id: compositionId,
111
- defaultProps: (0, input_props_serialization_js_1.serializeThenDeserializeInStudio)(defaultProps !== null && defaultProps !== void 0 ? defaultProps : {}),
112
- props: (0, input_props_serialization_js_1.serializeThenDeserializeInStudio)((_a = calculatedProm.props) !== null && _a !== void 0 ? _a : originalProps),
113
- defaultCodec: (_b = calculatedProm.defaultCodec) !== null && _b !== void 0 ? _b : null,
114
- defaultOutName: (_c = calculatedProm.defaultOutName) !== null && _c !== void 0 ? _c : null,
115
- defaultVideoImageFormat: (_d = calculatedProm.defaultVideoImageFormat) !== null && _d !== void 0 ? _d : null,
116
- defaultPixelFormat: (_e = calculatedProm.defaultPixelFormat) !== null && _e !== void 0 ? _e : null,
117
- defaultProResProfile: (_f = calculatedProm.defaultProResProfile) !== null && _f !== void 0 ? _f : null,
118
- defaultSampleRate: (_g = calculatedProm.defaultSampleRate) !== null && _g !== void 0 ? _g : null,
119
- };
120
137
  };
121
- exports.resolveVideoConfig = resolveVideoConfig;
138
+ exports.resolveVideoConfigWithMetadataOrCatch = resolveVideoConfigWithMetadataOrCatch;
122
139
  const resolveVideoConfigOrCatch = (params) => {
123
140
  try {
124
141
  const promiseOrReturnValue = (0, exports.resolveVideoConfig)(params);
@@ -25,6 +25,12 @@ export type VideoConfigNumericExpression = {
25
25
  multiplicand: number;
26
26
  factorPosition: 'left' | 'right';
27
27
  value: number;
28
+ } | {
29
+ type: 'video-config-subtraction';
30
+ identifier: string;
31
+ minuend: number;
32
+ subtrahend: number;
33
+ value: number;
28
34
  };
29
35
  export type CanUpdateSequencePropStatusLinearEasing = {
30
36
  type: 'linear';
@@ -3,4 +3,4 @@
3
3
  * @see [Documentation](https://remotion.dev/docs/version)
4
4
  * @returns {string} The current version of the remotion package
5
5
  */
6
- export declare const VERSION = "4.0.492";
6
+ export declare const VERSION = "4.0.494";
@@ -7,4 +7,4 @@ exports.VERSION = void 0;
7
7
  * @see [Documentation](https://remotion.dev/docs/version)
8
8
  * @returns {string} The current version of the remotion package
9
9
  */
10
- exports.VERSION = '4.0.492';
10
+ exports.VERSION = '4.0.494';
@@ -15,9 +15,11 @@ export declare function useRemotionContexts(): {
15
15
  } | {
16
16
  type: "success";
17
17
  result: import("./video-config.js").VideoConfig;
18
+ metadataSource: import("./resolve-video-config.js").VideoConfigMetadataSource | null;
18
19
  } | {
19
20
  type: "success-and-refreshing";
20
21
  result: import("./video-config.js").VideoConfig;
22
+ metadataSource: import("./resolve-video-config.js").VideoConfigMetadataSource | null;
21
23
  } | {
22
24
  type: "error";
23
25
  error: Error;
@@ -729,6 +729,7 @@ var useResolvedVideoConfig = (preferredCompositionId) => {
729
729
  if (currentCompositionMetadata) {
730
730
  return {
731
731
  type: "success",
732
+ metadataSource: null,
732
733
  result: {
733
734
  ...currentCompositionMetadata,
734
735
  id: composition.id,
@@ -746,6 +747,7 @@ var useResolvedVideoConfig = (preferredCompositionId) => {
746
747
  validateDimension(composition.height, "height", `in <Composition id="${composition.id}">`);
747
748
  return {
748
749
  type: "success",
750
+ metadataSource: null,
749
751
  result: {
750
752
  width: composition.width,
751
753
  height: composition.height,
@@ -1308,7 +1310,7 @@ var getSingleChildComponent = (children) => {
1308
1310
  };
1309
1311
 
1310
1312
  // src/version.ts
1311
- var VERSION = "4.0.492";
1313
+ var VERSION = "4.0.494";
1312
1314
 
1313
1315
  // src/multiple-versions-warning.ts
1314
1316
  var checkMultipleRemotionVersions = () => {
@@ -4793,7 +4795,7 @@ var PremountedPostmountedSequenceRefForwardingFunction = (props, ref) => {
4793
4795
  const style = useMemo14(() => {
4794
4796
  return {
4795
4797
  ...passedStyle,
4796
- opacity: premountingActive || postmountingActive ? 0 : 1,
4798
+ opacity: premountingActive || postmountingActive ? 0 : passedStyle?.opacity,
4797
4799
  pointerEvents: premountingActive || postmountingActive ? "none" : passedStyle?.pointerEvents ?? undefined,
4798
4800
  ...premountingActive ? styleWhilePremounted : {},
4799
4801
  ...postmountingActive ? styleWhilePostmounted : {}
@@ -5403,6 +5405,15 @@ var decodeImage = async ({
5403
5405
  };
5404
5406
  };
5405
5407
 
5408
+ // src/animated-image/get-current-time.ts
5409
+ var getCurrentTime = ({
5410
+ frame,
5411
+ playbackRate,
5412
+ fps
5413
+ }) => {
5414
+ return frame * playbackRate / fps;
5415
+ };
5416
+
5406
5417
  // src/animated-image/request-init.ts
5407
5418
  var serializeRequestInit = (requestInit) => {
5408
5419
  if (!requestInit) {
@@ -5476,7 +5487,7 @@ var AnimatedImageContent = forwardRef4(({
5476
5487
  const [decodeHandle] = useState6(() => delayRender2(`Rendering <AnimatedImage/> with src="${resolvedSrc}"`));
5477
5488
  const frame = useCurrentFrame();
5478
5489
  const { fps } = useVideoConfig();
5479
- const currentTime = frame / playbackRate / fps;
5490
+ const currentTime = getCurrentTime({ frame, playbackRate, fps });
5480
5491
  const currentTimeRef = useRef9(currentTime);
5481
5492
  currentTimeRef.current = currentTime;
5482
5493
  const requestInitKey = serializeRequestInit(requestInit);
@@ -5604,8 +5615,6 @@ var AnimatedImageInner = ({
5604
5615
  ref,
5605
5616
  ...sequenceProps
5606
5617
  }) => {
5607
- const { durationInFrames: videoDuration } = useVideoConfig();
5608
- const resolvedDuration = durationInFrames ?? videoDuration;
5609
5618
  const actualRef = useRef9(null);
5610
5619
  const memoizedEffectDefinitions = useMemoizedEffectDefinitions(effects);
5611
5620
  useImperativeHandle2(ref, () => {
@@ -5628,7 +5637,7 @@ var AnimatedImageInner = ({
5628
5637
  };
5629
5638
  return /* @__PURE__ */ jsx14(Sequence, {
5630
5639
  layout: "none",
5631
- durationInFrames: resolvedDuration,
5640
+ durationInFrames,
5632
5641
  name: "<AnimatedImage>",
5633
5642
  _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/animatedimage",
5634
5643
  controls,
@@ -9466,8 +9475,6 @@ var HtmlInCanvasInner = forwardRef9(({
9466
9475
  name,
9467
9476
  ...sequenceProps
9468
9477
  }, ref) => {
9469
- const { durationInFrames: videoDuration } = useVideoConfig();
9470
- const resolvedDuration = durationInFrames ?? videoDuration;
9471
9478
  const memoizedEffectDefinitions = useMemoizedEffectDefinitions(effects);
9472
9479
  const actualRef = useRef22(null);
9473
9480
  const setCanvasRef = useCallback16((node) => {
@@ -9479,7 +9486,7 @@ var HtmlInCanvasInner = forwardRef9(({
9479
9486
  }
9480
9487
  }, [ref]);
9481
9488
  return /* @__PURE__ */ jsx25(Sequence, {
9482
- durationInFrames: resolvedDuration,
9489
+ durationInFrames,
9483
9490
  name: name ?? "<HtmlInCanvas>",
9484
9491
  _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/remotion/html-in-canvas",
9485
9492
  controls,
@@ -10876,7 +10883,46 @@ var validateCalculated = ({
10876
10883
  defaultSampleRate
10877
10884
  };
10878
10885
  };
10879
- var resolveVideoConfig = ({
10886
+ var makeVideoConfigWithMetadata = ({
10887
+ calculated,
10888
+ compositionDurationInFrames,
10889
+ compositionFps,
10890
+ compositionHeight,
10891
+ compositionId,
10892
+ compositionWidth,
10893
+ defaultProps,
10894
+ originalProps
10895
+ }) => {
10896
+ const data = validateCalculated({
10897
+ calculated,
10898
+ compositionDurationInFrames,
10899
+ compositionFps,
10900
+ compositionHeight,
10901
+ compositionWidth,
10902
+ compositionId
10903
+ });
10904
+ return {
10905
+ metadataSource: {
10906
+ durationInFrames: calculated?.durationInFrames === undefined ? "composition" : "calculate-metadata",
10907
+ fps: calculated?.fps === undefined ? "composition" : "calculate-metadata",
10908
+ height: calculated?.height === undefined ? "composition" : "calculate-metadata",
10909
+ width: calculated?.width === undefined ? "composition" : "calculate-metadata"
10910
+ },
10911
+ videoConfig: {
10912
+ ...data,
10913
+ id: compositionId,
10914
+ defaultProps: serializeThenDeserializeInStudio(defaultProps ?? {}),
10915
+ props: serializeThenDeserializeInStudio(calculated?.props ?? originalProps),
10916
+ defaultCodec: data.defaultCodec ?? null,
10917
+ defaultOutName: data.defaultOutName ?? null,
10918
+ defaultVideoImageFormat: data.defaultVideoImageFormat ?? null,
10919
+ defaultPixelFormat: data.defaultPixelFormat ?? null,
10920
+ defaultProResProfile: data.defaultProResProfile ?? null,
10921
+ defaultSampleRate: data.defaultSampleRate ?? null
10922
+ }
10923
+ };
10924
+ };
10925
+ var resolveVideoConfigWithMetadata = ({
10880
10926
  calculateMetadata,
10881
10927
  signal,
10882
10928
  defaultProps,
@@ -10896,76 +10942,48 @@ var resolveVideoConfig = ({
10896
10942
  }) : null;
10897
10943
  if (calculatedProm !== null && typeof calculatedProm === "object" && "then" in calculatedProm) {
10898
10944
  return calculatedProm.then((c2) => {
10899
- const {
10900
- height,
10901
- width,
10902
- durationInFrames,
10903
- fps,
10904
- defaultCodec,
10905
- defaultOutName,
10906
- defaultVideoImageFormat,
10907
- defaultPixelFormat,
10908
- defaultProResProfile,
10909
- defaultSampleRate
10910
- } = validateCalculated({
10945
+ return makeVideoConfigWithMetadata({
10911
10946
  calculated: c2,
10912
10947
  compositionDurationInFrames,
10913
10948
  compositionFps,
10914
10949
  compositionHeight,
10915
10950
  compositionWidth,
10916
- compositionId
10951
+ compositionId,
10952
+ defaultProps,
10953
+ originalProps
10917
10954
  });
10918
- return {
10919
- width,
10920
- height,
10921
- fps,
10922
- durationInFrames,
10923
- id: compositionId,
10924
- defaultProps: serializeThenDeserializeInStudio(defaultProps),
10925
- props: serializeThenDeserializeInStudio(c2.props ?? originalProps),
10926
- defaultCodec: defaultCodec ?? null,
10927
- defaultOutName: defaultOutName ?? null,
10928
- defaultVideoImageFormat: defaultVideoImageFormat ?? null,
10929
- defaultPixelFormat: defaultPixelFormat ?? null,
10930
- defaultProResProfile: defaultProResProfile ?? null,
10931
- defaultSampleRate: defaultSampleRate ?? null
10932
- };
10933
10955
  });
10934
10956
  }
10935
- const data = validateCalculated({
10957
+ return makeVideoConfigWithMetadata({
10936
10958
  calculated: calculatedProm,
10937
10959
  compositionDurationInFrames,
10938
10960
  compositionFps,
10939
10961
  compositionHeight,
10940
10962
  compositionWidth,
10941
- compositionId
10963
+ compositionId,
10964
+ defaultProps,
10965
+ originalProps
10942
10966
  });
10943
- if (calculatedProm === null) {
10967
+ };
10968
+ var resolveVideoConfig = (params) => {
10969
+ const resolved = resolveVideoConfigWithMetadata(params);
10970
+ if (typeof resolved === "object" && "then" in resolved) {
10971
+ return resolved.then(({ videoConfig }) => videoConfig);
10972
+ }
10973
+ return resolved.videoConfig;
10974
+ };
10975
+ var resolveVideoConfigWithMetadataOrCatch = (params) => {
10976
+ try {
10944
10977
  return {
10945
- ...data,
10946
- id: compositionId,
10947
- defaultProps: serializeThenDeserializeInStudio(defaultProps ?? {}),
10948
- props: serializeThenDeserializeInStudio(originalProps),
10949
- defaultCodec: null,
10950
- defaultOutName: null,
10951
- defaultVideoImageFormat: null,
10952
- defaultPixelFormat: null,
10953
- defaultProResProfile: null,
10954
- defaultSampleRate: null
10978
+ type: "success",
10979
+ result: resolveVideoConfigWithMetadata(params)
10980
+ };
10981
+ } catch (err) {
10982
+ return {
10983
+ type: "error",
10984
+ error: err
10955
10985
  };
10956
10986
  }
10957
- return {
10958
- ...data,
10959
- id: compositionId,
10960
- defaultProps: serializeThenDeserializeInStudio(defaultProps ?? {}),
10961
- props: serializeThenDeserializeInStudio(calculatedProm.props ?? originalProps),
10962
- defaultCodec: calculatedProm.defaultCodec ?? null,
10963
- defaultOutName: calculatedProm.defaultOutName ?? null,
10964
- defaultVideoImageFormat: calculatedProm.defaultVideoImageFormat ?? null,
10965
- defaultPixelFormat: calculatedProm.defaultPixelFormat ?? null,
10966
- defaultProResProfile: calculatedProm.defaultProResProfile ?? null,
10967
- defaultSampleRate: calculatedProm.defaultSampleRate ?? null
10968
- };
10969
10987
  };
10970
10988
  var resolveVideoConfigOrCatch = (params) => {
10971
10989
  try {
@@ -11991,6 +12009,7 @@ var Internals = {
11991
12009
  NonceContext,
11992
12010
  resolveVideoConfig,
11993
12011
  resolveVideoConfigOrCatch,
12012
+ resolveVideoConfigWithMetadataOrCatch,
11994
12013
  ResolveCompositionContext,
11995
12014
  useResolvedVideoConfig,
11996
12015
  resolveCompositionsRef,
@@ -1,5 +1,5 @@
1
1
  // src/version.ts
2
- var VERSION = "4.0.492";
2
+ var VERSION = "4.0.494";
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.492",
6
+ "version": "4.0.494",
7
7
  "description": "Make videos programmatically",
8
8
  "main": "dist/cjs/index.js",
9
9
  "types": "dist/cjs/index.d.ts",
@@ -35,7 +35,7 @@
35
35
  "react-dom": "19.2.3",
36
36
  "webpack": "5.105.0",
37
37
  "zod": "4.3.6",
38
- "@remotion/eslint-config-internal": "4.0.492",
38
+ "@remotion/eslint-config-internal": "4.0.494",
39
39
  "eslint": "9.19.0",
40
40
  "@typescript/native-preview": "7.0.0-dev.20260217.1"
41
41
  },