remotion 4.0.97 → 4.0.98

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.
@@ -23,6 +23,7 @@ export type CalculateMetadataFunction<T extends Record<string, unknown>> = (opti
23
23
  defaultProps: T;
24
24
  props: T;
25
25
  abortSignal: AbortSignal;
26
+ compositionId: string;
26
27
  }) => Promise<CalcMetadataReturnType<T>> | CalcMetadataReturnType<T>;
27
28
  type OptionalDimensions<Schema extends AnyZodObject, Props extends Record<string, unknown>> = {
28
29
  width?: number;
@@ -20,7 +20,7 @@ const AudioForDevelopment_js_1 = require("./AudioForDevelopment.js");
20
20
  const AudioForRendering_js_1 = require("./AudioForRendering.js");
21
21
  const shared_audio_tags_js_1 = require("./shared-audio-tags.js");
22
22
  const AudioRefForwardingFunction = (props, ref) => {
23
- var _a, _b;
23
+ var _a, _b, _c;
24
24
  const audioContext = (0, react_1.useContext)(shared_audio_tags_js_1.SharedAudioContext);
25
25
  const { startFrom, endAt, name, stack, ...otherProps } = props;
26
26
  const { loop, ...propsOtherThanLoop } = props;
@@ -48,12 +48,13 @@ const AudioRefForwardingFunction = (props, ref) => {
48
48
  const onDuration = (0, react_1.useCallback)((src, durationInSeconds) => {
49
49
  setDurations({ type: 'got-duration', durationInSeconds, src });
50
50
  }, [setDurations]);
51
- if (loop && durations[(0, absolute_src_js_1.getAbsoluteSrc)(preloadedSrc)] !== undefined) {
52
- const duration = Math.floor(durations[(0, absolute_src_js_1.getAbsoluteSrc)(preloadedSrc)] * fps);
51
+ const durationFetched = (_a = durations[(0, absolute_src_js_1.getAbsoluteSrc)(preloadedSrc)]) !== null && _a !== void 0 ? _a : durations[(0, absolute_src_js_1.getAbsoluteSrc)(props.src)];
52
+ if (loop && durationFetched !== undefined) {
53
+ const duration = durationFetched * fps;
53
54
  return ((0, jsx_runtime_1.jsx)(index_js_1.Loop, { layout: "none", durationInFrames: (0, calculate_loop_js_1.calculateLoopDuration)({
54
55
  endAt,
55
56
  mediaDuration: duration,
56
- playbackRate: (_a = props.playbackRate) !== null && _a !== void 0 ? _a : 1,
57
+ playbackRate: (_b = props.playbackRate) !== null && _b !== void 0 ? _b : 1,
57
58
  startFrom,
58
59
  }), children: (0, jsx_runtime_1.jsx)(exports.Audio, { ...propsOtherThanLoop, ref: ref, _remotionInternalNativeLoopPassed: true }) }));
59
60
  }
@@ -67,7 +68,7 @@ const AudioRefForwardingFunction = (props, ref) => {
67
68
  if (environment.isRendering) {
68
69
  return ((0, jsx_runtime_1.jsx)(AudioForRendering_js_1.AudioForRendering, { onDuration: onDuration, ...props, ref: ref, onError: onError, _remotionInternalNeedsDurationCalculation: Boolean(loop) }));
69
70
  }
70
- return ((0, jsx_runtime_1.jsx)(AudioForDevelopment_js_1.AudioForDevelopment, { _remotionInternalNativeLoopPassed: (_b = props._remotionInternalNativeLoopPassed) !== null && _b !== void 0 ? _b : false, _remotionInternalStack: stack !== null && stack !== void 0 ? stack : null, shouldPreMountAudioTags: audioContext !== null && audioContext.numberOfAudioTags > 0, ...props, ref: ref, onError: onError, onDuration: onDuration, _remotionInternalNeedsDurationCalculation: Boolean(loop) }));
71
+ return ((0, jsx_runtime_1.jsx)(AudioForDevelopment_js_1.AudioForDevelopment, { _remotionInternalNativeLoopPassed: (_c = props._remotionInternalNativeLoopPassed) !== null && _c !== void 0 ? _c : false, _remotionInternalStack: stack !== null && stack !== void 0 ? stack : null, shouldPreMountAudioTags: audioContext !== null && audioContext.numberOfAudioTags > 0, ...props, ref: ref, onError: onError, onDuration: onDuration, _remotionInternalNeedsDurationCalculation: Boolean(loop) }));
71
72
  };
72
73
  /**
73
74
  * @description With this component, you can add audio to your video. All audio formats which are supported by Chromium are supported by the component.
@@ -36,6 +36,7 @@ const resolveVideoConfig = ({ composition, editorProps: editorPropsOrUndefined,
36
36
  defaultProps: (_b = composition.defaultProps) !== null && _b !== void 0 ? _b : {},
37
37
  props: originalProps,
38
38
  abortSignal: signal,
39
+ compositionId: composition.id,
39
40
  })
40
41
  : null;
41
42
  if (calculatedProm !== null &&
@@ -13,7 +13,9 @@ const getEnvVariables = () => {
13
13
  // For the Studio, we already set the environment variables in index-html.ts.
14
14
  // We just add NODE_ENV here.
15
15
  if (!process.env.NODE_ENV) {
16
- throw new Error('process.env.NODE_ENV is not set');
16
+ // https://github.com/remotion-dev/remotion/issues/3412#issuecomment-1910120552
17
+ // eslint-disable-next-line no-useless-concat
18
+ throw new Error('process.en' + '' + 'v.NODE_ENV is not set');
17
19
  }
18
20
  return {
19
21
  NODE_ENV: process.env.NODE_ENV,
@@ -1 +1 @@
1
- export declare const VERSION = "4.0.97";
1
+ export declare const VERSION = "4.0.98";
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
4
  // Automatically generated on publish
5
- exports.VERSION = '4.0.97';
5
+ exports.VERSION = '4.0.98';
@@ -18,7 +18,7 @@ const duration_state_js_1 = require("./duration-state.js");
18
18
  const VideoForDevelopment_js_1 = require("./VideoForDevelopment.js");
19
19
  const VideoForRendering_js_1 = require("./VideoForRendering.js");
20
20
  const VideoForwardingFunction = (props, ref) => {
21
- var _a;
21
+ var _a, _b;
22
22
  const { startFrom, endAt, name, stack, _remotionInternalNativeLoopPassed, ...otherProps } = props;
23
23
  const { loop, ...propsOtherThanLoop } = props;
24
24
  const { fps } = (0, use_video_config_js_1.useVideoConfig)();
@@ -34,12 +34,13 @@ const VideoForwardingFunction = (props, ref) => {
34
34
  const onDuration = (0, react_1.useCallback)((src, durationInSeconds) => {
35
35
  setDurations({ type: 'got-duration', durationInSeconds, src });
36
36
  }, [setDurations]);
37
- if (loop && durations[(0, absolute_src_js_1.getAbsoluteSrc)(preloadedSrc)] !== undefined) {
38
- const mediaDuration = durations[(0, absolute_src_js_1.getAbsoluteSrc)(preloadedSrc)] * fps;
37
+ const durationFetched = (_a = durations[(0, absolute_src_js_1.getAbsoluteSrc)(preloadedSrc)]) !== null && _a !== void 0 ? _a : durations[(0, absolute_src_js_1.getAbsoluteSrc)(props.src)];
38
+ if (loop && durationFetched !== undefined) {
39
+ const mediaDuration = durationFetched * fps;
39
40
  return ((0, jsx_runtime_1.jsx)(index_js_1.Loop, { durationInFrames: (0, calculate_loop_js_1.calculateLoopDuration)({
40
41
  endAt,
41
42
  mediaDuration,
42
- playbackRate: (_a = props.playbackRate) !== null && _a !== void 0 ? _a : 1,
43
+ playbackRate: (_b = props.playbackRate) !== null && _b !== void 0 ? _b : 1,
43
44
  startFrom,
44
45
  }), layout: "none", name: name, children: (0, jsx_runtime_1.jsx)(exports.Video, { ...propsOtherThanLoop, ref: ref, _remotionInternalNativeLoopPassed: true }) }));
45
46
  }
@@ -105,7 +105,7 @@ function truthy(value) {
105
105
  }
106
106
 
107
107
  // Automatically generated on publish
108
- const VERSION = '4.0.97';
108
+ const VERSION = '4.0.98';
109
109
 
110
110
  const checkMultipleRemotionVersions = () => {
111
111
  if (typeof globalThis === 'undefined') {
@@ -530,6 +530,7 @@ const resolveVideoConfig = ({ composition, editorProps: editorPropsOrUndefined,
530
530
  defaultProps: (_b = composition.defaultProps) !== null && _b !== void 0 ? _b : {},
531
531
  props: originalProps,
532
532
  abortSignal: signal,
533
+ compositionId: composition.id,
533
534
  })
534
535
  : null;
535
536
  if (calculatedProm !== null &&
@@ -2639,7 +2640,7 @@ const AudioForRenderingRefForwardingFunction = (props, ref) => {
2639
2640
  const AudioForRendering = forwardRef(AudioForRenderingRefForwardingFunction);
2640
2641
 
2641
2642
  const AudioRefForwardingFunction = (props, ref) => {
2642
- var _a, _b;
2643
+ var _a, _b, _c;
2643
2644
  const audioContext = useContext(SharedAudioContext);
2644
2645
  const { startFrom, endAt, name, stack, ...otherProps } = props;
2645
2646
  const { loop, ...propsOtherThanLoop } = props;
@@ -2667,12 +2668,13 @@ const AudioRefForwardingFunction = (props, ref) => {
2667
2668
  const onDuration = useCallback((src, durationInSeconds) => {
2668
2669
  setDurations({ type: 'got-duration', durationInSeconds, src });
2669
2670
  }, [setDurations]);
2670
- if (loop && durations[getAbsoluteSrc(preloadedSrc)] !== undefined) {
2671
- const duration = Math.floor(durations[getAbsoluteSrc(preloadedSrc)] * fps);
2671
+ const durationFetched = (_a = durations[getAbsoluteSrc(preloadedSrc)]) !== null && _a !== void 0 ? _a : durations[getAbsoluteSrc(props.src)];
2672
+ if (loop && durationFetched !== undefined) {
2673
+ const duration = durationFetched * fps;
2672
2674
  return (jsx(Loop, { layout: "none", durationInFrames: calculateLoopDuration({
2673
2675
  endAt,
2674
2676
  mediaDuration: duration,
2675
- playbackRate: (_a = props.playbackRate) !== null && _a !== void 0 ? _a : 1,
2677
+ playbackRate: (_b = props.playbackRate) !== null && _b !== void 0 ? _b : 1,
2676
2678
  startFrom,
2677
2679
  }), children: jsx(Audio, { ...propsOtherThanLoop, ref: ref, _remotionInternalNativeLoopPassed: true }) }));
2678
2680
  }
@@ -2686,7 +2688,7 @@ const AudioRefForwardingFunction = (props, ref) => {
2686
2688
  if (environment.isRendering) {
2687
2689
  return (jsx(AudioForRendering, { onDuration: onDuration, ...props, ref: ref, onError: onError, _remotionInternalNeedsDurationCalculation: Boolean(loop) }));
2688
2690
  }
2689
- return (jsx(AudioForDevelopment, { _remotionInternalNativeLoopPassed: (_b = props._remotionInternalNativeLoopPassed) !== null && _b !== void 0 ? _b : false, _remotionInternalStack: stack !== null && stack !== void 0 ? stack : null, shouldPreMountAudioTags: audioContext !== null && audioContext.numberOfAudioTags > 0, ...props, ref: ref, onError: onError, onDuration: onDuration, _remotionInternalNeedsDurationCalculation: Boolean(loop) }));
2691
+ return (jsx(AudioForDevelopment, { _remotionInternalNativeLoopPassed: (_c = props._remotionInternalNativeLoopPassed) !== null && _c !== void 0 ? _c : false, _remotionInternalStack: stack !== null && stack !== void 0 ? stack : null, shouldPreMountAudioTags: audioContext !== null && audioContext.numberOfAudioTags > 0, ...props, ref: ref, onError: onError, onDuration: onDuration, _remotionInternalNeedsDurationCalculation: Boolean(loop) }));
2690
2692
  };
2691
2693
  /**
2692
2694
  * @description With this component, you can add audio to your video. All audio formats which are supported by Chromium are supported by the component.
@@ -3946,7 +3948,9 @@ const getEnvVariables = () => {
3946
3948
  // For the Studio, we already set the environment variables in index-html.ts.
3947
3949
  // We just add NODE_ENV here.
3948
3950
  if (!process.env.NODE_ENV) {
3949
- throw new Error('process.env.NODE_ENV is not set');
3951
+ // https://github.com/remotion-dev/remotion/issues/3412#issuecomment-1910120552
3952
+ // eslint-disable-next-line no-useless-concat
3953
+ throw new Error('process.en' + '' + 'v.NODE_ENV is not set');
3950
3954
  }
3951
3955
  return {
3952
3956
  NODE_ENV: process.env.NODE_ENV,
@@ -4997,7 +5001,7 @@ const VideoForRenderingForwardFunction = ({ onError, volume: volumeProp, allowAm
4997
5001
  const VideoForRendering = forwardRef(VideoForRenderingForwardFunction);
4998
5002
 
4999
5003
  const VideoForwardingFunction = (props, ref) => {
5000
- var _a;
5004
+ var _a, _b;
5001
5005
  const { startFrom, endAt, name, stack, _remotionInternalNativeLoopPassed, ...otherProps } = props;
5002
5006
  const { loop, ...propsOtherThanLoop } = props;
5003
5007
  const { fps } = useVideoConfig();
@@ -5013,12 +5017,13 @@ const VideoForwardingFunction = (props, ref) => {
5013
5017
  const onDuration = useCallback((src, durationInSeconds) => {
5014
5018
  setDurations({ type: 'got-duration', durationInSeconds, src });
5015
5019
  }, [setDurations]);
5016
- if (loop && durations[getAbsoluteSrc(preloadedSrc)] !== undefined) {
5017
- const mediaDuration = durations[getAbsoluteSrc(preloadedSrc)] * fps;
5020
+ const durationFetched = (_a = durations[getAbsoluteSrc(preloadedSrc)]) !== null && _a !== void 0 ? _a : durations[getAbsoluteSrc(props.src)];
5021
+ if (loop && durationFetched !== undefined) {
5022
+ const mediaDuration = durationFetched * fps;
5018
5023
  return (jsx(Loop, { durationInFrames: calculateLoopDuration({
5019
5024
  endAt,
5020
5025
  mediaDuration,
5021
- playbackRate: (_a = props.playbackRate) !== null && _a !== void 0 ? _a : 1,
5026
+ playbackRate: (_b = props.playbackRate) !== null && _b !== void 0 ? _b : 1,
5022
5027
  startFrom,
5023
5028
  }), layout: "none", name: name, children: jsx(Video, { ...propsOtherThanLoop, ref: ref, _remotionInternalNativeLoopPassed: true }) }));
5024
5029
  }
@@ -1,4 +1,4 @@
1
1
  // Automatically generated on publish
2
- const VERSION = '4.0.97';
2
+ const VERSION = '4.0.98';
3
3
 
4
4
  export { VERSION };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "remotion",
3
- "version": "4.0.97",
3
+ "version": "4.0.98",
4
4
  "description": "Render videos in React",
5
5
  "main": "dist/cjs/index.js",
6
6
  "types": "dist/cjs/index.d.ts",