remotion 4.0.142 → 4.0.143

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.
Files changed (38) hide show
  1. package/bunfig.toml +2 -0
  2. package/dist/cjs/CanUseRemotionHooks.d.ts +1 -1
  3. package/dist/cjs/Img.js +3 -2
  4. package/dist/cjs/audio/Audio.d.ts +2 -1
  5. package/dist/cjs/audio/AudioForPreview.d.ts +7 -6
  6. package/dist/cjs/audio/AudioForPreview.js +2 -2
  7. package/dist/cjs/audio/AudioForRendering.d.ts +1 -0
  8. package/dist/cjs/audio/AudioForRendering.js +2 -2
  9. package/dist/cjs/audio/props.d.ts +2 -0
  10. package/dist/cjs/audio/use-audio-frame.d.ts +2 -1
  11. package/dist/cjs/audio/use-audio-frame.js +7 -2
  12. package/dist/cjs/index.d.ts +2 -2
  13. package/dist/cjs/internals.d.ts +1 -6
  14. package/dist/cjs/internals.js +0 -5
  15. package/dist/cjs/loop/index.d.ts +13 -5
  16. package/dist/cjs/loop/index.js +38 -3
  17. package/dist/cjs/no-react.d.ts +5 -0
  18. package/dist/cjs/no-react.js +4 -0
  19. package/dist/cjs/spring/index.d.ts +2 -2
  20. package/dist/cjs/spring/measure-spring.d.ts +1 -1
  21. package/dist/cjs/version.d.ts +1 -1
  22. package/dist/cjs/version.js +1 -1
  23. package/dist/cjs/video/OffthreadVideoForRendering.js +2 -2
  24. package/dist/cjs/video/Video.d.ts +3 -2
  25. package/dist/cjs/video/VideoForPreview.d.ts +7 -7
  26. package/dist/cjs/video/VideoForPreview.js +5 -7
  27. package/dist/cjs/video/VideoForRendering.d.ts +1 -0
  28. package/dist/cjs/video/VideoForRendering.js +2 -2
  29. package/dist/cjs/video/index.d.ts +1 -1
  30. package/dist/cjs/video/props.d.ts +3 -0
  31. package/dist/cjs/video/video-fragment.js +9 -5
  32. package/dist/esm/index.mjs +555 -539
  33. package/dist/esm/no-react.mjs +3 -0
  34. package/dist/esm/version.mjs +1 -1
  35. package/ensure-correct-version.ts +41 -0
  36. package/happydom.ts +6 -0
  37. package/package.json +3 -1
  38. package/test.ts +1 -0
package/bunfig.toml ADDED
@@ -0,0 +1,2 @@
1
+ [test]
2
+ #preload = "./happydom.ts"
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
2
  export declare const CanUseRemotionHooks: React.Context<boolean>;
3
3
  export declare const CanUseRemotionHooksProvider: React.FC<{
4
- children: React.ReactNode;
4
+ readonly children: React.ReactNode;
5
5
  }>;
package/dist/cjs/Img.js CHANGED
@@ -65,6 +65,7 @@ const ImgRefForwarding = ({ onError, maxRetries = 2, src, pauseWhenLoading, dela
65
65
  (0, cancel_render_js_1.cancelRender)('Error loading image with src: ' + ((_l = imageRef.current) === null || _l === void 0 ? void 0 : _l.src));
66
66
  }, [maxRetries, onError, retryIn]);
67
67
  if (typeof window !== 'undefined') {
68
+ const isPremounting = Boolean(sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.premounting);
68
69
  // eslint-disable-next-line react-hooks/rules-of-hooks
69
70
  (0, react_1.useLayoutEffect)(() => {
70
71
  if (process.env.NODE_ENV === 'test') {
@@ -74,7 +75,7 @@ const ImgRefForwarding = ({ onError, maxRetries = 2, src, pauseWhenLoading, dela
74
75
  retries: delayRenderRetries !== null && delayRenderRetries !== void 0 ? delayRenderRetries : undefined,
75
76
  timeoutInMilliseconds: delayRenderTimeoutInMilliseconds !== null && delayRenderTimeoutInMilliseconds !== void 0 ? delayRenderTimeoutInMilliseconds : undefined,
76
77
  });
77
- const unblock = pauseWhenLoading && !(sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.premounting)
78
+ const unblock = pauseWhenLoading && !isPremounting
78
79
  ? delayPlayback().unblock
79
80
  : () => undefined;
80
81
  const { current } = imageRef;
@@ -109,7 +110,7 @@ const ImgRefForwarding = ({ onError, maxRetries = 2, src, pauseWhenLoading, dela
109
110
  delayRenderRetries,
110
111
  delayRenderTimeoutInMilliseconds,
111
112
  pauseWhenLoading,
112
- sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.premounting,
113
+ isPremounting,
113
114
  ]);
114
115
  }
115
116
  return ((0, jsx_runtime_1.jsx)("img", { ...props, ref: imageRef, src: actualSrc, onError: didGetError }));
@@ -17,9 +17,10 @@ export declare const Audio: React.ForwardRefExoticComponent<Omit<Omit<React.Deta
17
17
  showInTimeline?: boolean | undefined;
18
18
  delayRenderTimeoutInMilliseconds?: number | undefined;
19
19
  delayRenderRetries?: number | undefined;
20
+ loopVolumeCurveBehavior?: import("./use-audio-frame.js").LoopVolumeCurveBehavior | undefined;
20
21
  } & RemotionMainAudioProps & {
21
22
  /**
22
23
  * @deprecated For internal use only
23
24
  */
24
- stack?: string | undefined;
25
+ readonly stack?: string | undefined;
25
26
  }, "ref"> & React.RefAttributes<HTMLAudioElement>>;
@@ -1,12 +1,13 @@
1
1
  import React from 'react';
2
2
  import type { RemotionAudioProps } from './props.js';
3
3
  type AudioForPreviewProps = RemotionAudioProps & {
4
- shouldPreMountAudioTags: boolean;
5
- onDuration: (src: string, durationInSeconds: number) => void;
6
- pauseWhenBuffering: boolean;
7
- _remotionInternalNativeLoopPassed: boolean;
8
- _remotionInternalStack: string | null;
9
- showInTimeline: boolean;
4
+ readonly shouldPreMountAudioTags: boolean;
5
+ readonly onDuration: (src: string, durationInSeconds: number) => void;
6
+ readonly pauseWhenBuffering: boolean;
7
+ readonly _remotionInternalNativeLoopPassed: boolean;
8
+ readonly _remotionInternalStack: string | null;
9
+ readonly showInTimeline: boolean;
10
+ readonly stack?: string | undefined;
10
11
  };
11
12
  export declare const AudioForPreview: React.ForwardRefExoticComponent<Omit<AudioForPreviewProps, "ref"> & React.RefAttributes<HTMLAudioElement>>;
12
13
  export {};
@@ -21,10 +21,10 @@ const AudioForDevelopmentForwardRefFunction = (props, ref) => {
21
21
  if (props.shouldPreMountAudioTags !== initialShouldPreMountAudioElements) {
22
22
  throw new Error('Cannot change the behavior for pre-mounting audio tags dynamically.');
23
23
  }
24
+ const { volume, muted, playbackRate, shouldPreMountAudioTags, src, onDuration, acceptableTimeShiftInSeconds, _remotionInternalNeedsDurationCalculation, _remotionInternalNativeLoopPassed, _remotionInternalStack, allowAmplificationDuringRender, name, pauseWhenBuffering, showInTimeline, loopVolumeCurveBehavior, stack, ...nativeProps } = props;
24
25
  const [mediaVolume] = (0, volume_position_state_js_1.useMediaVolumeState)();
25
26
  const [mediaMuted] = (0, volume_position_state_js_1.useMediaMutedState)();
26
- const volumePropFrame = (0, use_audio_frame_js_1.useFrameForVolumeProp)();
27
- const { volume, muted, playbackRate, shouldPreMountAudioTags, src, onDuration, acceptableTimeShiftInSeconds, _remotionInternalNeedsDurationCalculation, _remotionInternalNativeLoopPassed, _remotionInternalStack, allowAmplificationDuringRender, name, pauseWhenBuffering, showInTimeline, ...nativeProps } = props;
27
+ const volumePropFrame = (0, use_audio_frame_js_1.useFrameForVolumeProp)(loopVolumeCurveBehavior !== null && loopVolumeCurveBehavior !== void 0 ? loopVolumeCurveBehavior : 'repeat');
28
28
  const { hidden } = (0, react_1.useContext)(SequenceManager_js_1.SequenceVisibilityToggleContext);
29
29
  if (!src) {
30
30
  throw new TypeError("No 'src' was passed to <Audio>.");
@@ -13,6 +13,7 @@ export declare const AudioForRendering: ForwardRefExoticComponent<Omit<React.Det
13
13
  showInTimeline?: boolean | undefined;
14
14
  delayRenderTimeoutInMilliseconds?: number | undefined;
15
15
  delayRenderRetries?: number | undefined;
16
+ loopVolumeCurveBehavior?: import("./use-audio-frame.js").LoopVolumeCurveBehavior | undefined;
16
17
  } & {
17
18
  readonly onDuration: (src: string, durationInSeconds: number) => void;
18
19
  } & RefAttributes<HTMLAudioElement>>;
@@ -14,8 +14,9 @@ const volume_prop_js_1 = require("../volume-prop.js");
14
14
  const use_audio_frame_js_1 = require("./use-audio-frame.js");
15
15
  const AudioForRenderingRefForwardingFunction = (props, ref) => {
16
16
  const audioRef = (0, react_1.useRef)(null);
17
+ const { volume: volumeProp, playbackRate, allowAmplificationDuringRender, onDuration, toneFrequency, _remotionInternalNeedsDurationCalculation, _remotionInternalNativeLoopPassed, acceptableTimeShiftInSeconds, name, onError, delayRenderRetries, delayRenderTimeoutInMilliseconds, loopVolumeCurveBehavior, ...nativeProps } = props;
17
18
  const absoluteFrame = (0, timeline_position_state_js_1.useTimelinePosition)();
18
- const volumePropFrame = (0, use_audio_frame_js_1.useFrameForVolumeProp)();
19
+ const volumePropFrame = (0, use_audio_frame_js_1.useFrameForVolumeProp)(loopVolumeCurveBehavior !== null && loopVolumeCurveBehavior !== void 0 ? loopVolumeCurveBehavior : 'repeat');
19
20
  const frame = (0, use_current_frame_js_1.useCurrentFrame)();
20
21
  const sequenceContext = (0, react_1.useContext)(SequenceContext_js_1.SequenceContext);
21
22
  const { registerRenderAsset, unregisterRenderAsset } = (0, react_1.useContext)(RenderAssetManager_js_1.RenderAssetManager);
@@ -30,7 +31,6 @@ const AudioForRenderingRefForwardingFunction = (props, ref) => {
30
31
  sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.cumulatedFrom,
31
32
  sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.durationInFrames,
32
33
  ]);
33
- const { volume: volumeProp, playbackRate, allowAmplificationDuringRender, onDuration, toneFrequency, _remotionInternalNeedsDurationCalculation, _remotionInternalNativeLoopPassed, acceptableTimeShiftInSeconds, name, onError, delayRenderRetries, delayRenderTimeoutInMilliseconds, ...nativeProps } = props;
34
34
  const volume = (0, volume_prop_js_1.evaluateVolume)({
35
35
  volume: volumeProp,
36
36
  frame: volumePropFrame,
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import type { VolumeProp } from '../volume-prop.js';
3
+ import type { LoopVolumeCurveBehavior } from './use-audio-frame.js';
3
4
  export type RemotionMainAudioProps = {
4
5
  startFrom?: number;
5
6
  endAt?: number;
@@ -17,4 +18,5 @@ export type RemotionAudioProps = Omit<React.DetailedHTMLProps<React.AudioHTMLAtt
17
18
  showInTimeline?: boolean;
18
19
  delayRenderTimeoutInMilliseconds?: number;
19
20
  delayRenderRetries?: number;
21
+ loopVolumeCurveBehavior?: LoopVolumeCurveBehavior;
20
22
  };
@@ -1,6 +1,7 @@
1
1
  export declare const useMediaStartsAt: () => number;
2
+ export type LoopVolumeCurveBehavior = 'repeat' | 'extend';
2
3
  /**
3
4
  * When passing a function as the prop for `volume`,
4
5
  * we calculate the way more intuitive value for currentFrame
5
6
  */
6
- export declare const useFrameForVolumeProp: () => number;
7
+ export declare const useFrameForVolumeProp: (behavior: LoopVolumeCurveBehavior) => number;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useFrameForVolumeProp = exports.useMediaStartsAt = void 0;
4
4
  const react_1 = require("react");
5
5
  const SequenceContext_js_1 = require("../SequenceContext.js");
6
+ const index_js_1 = require("../loop/index.js");
6
7
  const use_current_frame_js_1 = require("../use-current-frame.js");
7
8
  const useMediaStartsAt = () => {
8
9
  var _a;
@@ -15,9 +16,13 @@ exports.useMediaStartsAt = useMediaStartsAt;
15
16
  * When passing a function as the prop for `volume`,
16
17
  * we calculate the way more intuitive value for currentFrame
17
18
  */
18
- const useFrameForVolumeProp = () => {
19
+ const useFrameForVolumeProp = (behavior) => {
20
+ const loop = index_js_1.Loop.useLoop();
19
21
  const frame = (0, use_current_frame_js_1.useCurrentFrame)();
20
22
  const startsAt = (0, exports.useMediaStartsAt)();
21
- return frame + startsAt;
23
+ if (behavior === 'repeat' || loop === null) {
24
+ return frame + startsAt;
25
+ }
26
+ return frame + startsAt + loop.durationInFrames * loop.iteration;
22
27
  };
23
28
  exports.useFrameForVolumeProp = useFrameForVolumeProp;
@@ -1,4 +1,4 @@
1
- /// <reference types="node" />
1
+ /// <reference types="bun-types" />
2
2
  /// <reference types="react" />
3
3
  import './asset-types.js';
4
4
  import type { Codec } from './codec.js';
@@ -16,7 +16,7 @@ declare global {
16
16
  remotion_delayRenderTimeouts: {
17
17
  [key: string]: {
18
18
  label: string | null;
19
- timeout: number | NodeJS.Timeout;
19
+ timeout: number | Timer;
20
20
  };
21
21
  };
22
22
  remotion_cancelledError: string | undefined;
@@ -69,7 +69,7 @@ export declare const Internals: {
69
69
  readonly portalNode: () => HTMLElement;
70
70
  readonly waitForRoot: (fn: (comp: import("react").FC<{}>) => void) => () => void;
71
71
  readonly CanUseRemotionHooksProvider: import("react").FC<{
72
- children: import("react").ReactNode;
72
+ readonly children: import("react").ReactNode;
73
73
  }>;
74
74
  readonly CanUseRemotionHooks: import("react").Context<boolean>;
75
75
  readonly PrefetchProvider: import("react").FC<{
@@ -116,8 +116,6 @@ export declare const Internals: {
116
116
  [x: string]: number;
117
117
  }) => void;
118
118
  readonly useTimelineSetFrame: () => (u: import("react").SetStateAction<Record<string, number>>) => void;
119
- readonly FILE_TOKEN: "remotion-file:";
120
- readonly DATE_TOKEN: "remotion-date:";
121
119
  readonly NativeLayersProvider: import("react").FC<{
122
120
  children?: import("react").ReactNode;
123
121
  }>;
@@ -146,9 +144,6 @@ export declare const Internals: {
146
144
  buffering: import("react").MutableRefObject<boolean>;
147
145
  } | null>;
148
146
  readonly enableSequenceStackTraces: () => void;
149
- readonly colorNames: {
150
- [key: string]: number;
151
- };
152
147
  readonly CurrentScaleContext: import("react").Context<import("./use-current-scale.js").CurrentScaleContextType | null>;
153
148
  readonly PreviewSizeContext: import("react").Context<import("./use-current-scale.js").PreviewSizeCtx>;
154
149
  readonly calculateScale: ({ canvasSize, compositionHeight, compositionWidth, previewSize, }: {
@@ -36,8 +36,6 @@ const EditorProps_js_1 = require("./EditorProps.js");
36
36
  const enable_sequence_stack_traces_js_1 = require("./enable-sequence-stack-traces.js");
37
37
  const get_preview_dom_element_js_1 = require("./get-preview-dom-element.js");
38
38
  const get_remotion_environment_js_1 = require("./get-remotion-environment.js");
39
- const input_props_serialization_js_1 = require("./input-props-serialization.js");
40
- const interpolate_colors_js_1 = require("./interpolate-colors.js");
41
39
  const is_player_js_1 = require("./is-player.js");
42
40
  const NativeLayers_js_1 = require("./NativeLayers.js");
43
41
  const nonce_js_1 = require("./nonce.js");
@@ -114,8 +112,6 @@ exports.Internals = {
114
112
  RenderAssetManager: RenderAssetManager_js_1.RenderAssetManager,
115
113
  persistCurrentFrame: timeline_position_state_js_1.persistCurrentFrame,
116
114
  useTimelineSetFrame: timeline_position_state_js_1.useTimelineSetFrame,
117
- FILE_TOKEN: input_props_serialization_js_1.FILE_TOKEN,
118
- DATE_TOKEN: input_props_serialization_js_1.DATE_TOKEN,
119
115
  NativeLayersProvider: NativeLayers_js_1.NativeLayersProvider,
120
116
  ClipComposition: Composition_js_1.ClipComposition,
121
117
  isIosSafari: video_fragment_js_1.isIosSafari,
@@ -125,7 +121,6 @@ exports.Internals = {
125
121
  BufferingProvider: buffering_js_1.BufferingProvider,
126
122
  BufferingContextReact: buffering_js_1.BufferingContextReact,
127
123
  enableSequenceStackTraces: enable_sequence_stack_traces_js_1.enableSequenceStackTraces,
128
- colorNames: interpolate_colors_js_1.colorNames,
129
124
  CurrentScaleContext: use_current_scale_js_1.CurrentScaleContext,
130
125
  PreviewSizeContext: use_current_scale_js_1.PreviewSizeContext,
131
126
  calculateScale: use_current_scale_js_1.calculateScale,
@@ -1,13 +1,21 @@
1
1
  import React from 'react';
2
2
  import type { LayoutAndStyle } from '../Sequence.js';
3
3
  export type LoopProps = {
4
- durationInFrames: number;
5
- times?: number;
6
- name?: string;
7
- children: React.ReactNode;
4
+ readonly durationInFrames: number;
5
+ readonly times?: number;
6
+ readonly name?: string;
7
+ readonly children: React.ReactNode;
8
8
  } & LayoutAndStyle;
9
+ type LoopContextType = {
10
+ iteration: number;
11
+ durationInFrames: number;
12
+ };
13
+ declare const useLoop: () => LoopContextType | null;
9
14
  /**
10
15
  * @description This component allows you to quickly lay out an animation so it repeats itself.
11
16
  * @see [Documentation](https://www.remotion.dev/docs/loop)
12
17
  */
13
- export declare const Loop: React.FC<LoopProps>;
18
+ export declare const Loop: React.FC<LoopProps> & {
19
+ useLoop: typeof useLoop;
20
+ };
21
+ export {};
@@ -1,12 +1,39 @@
1
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 (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  Object.defineProperty(exports, "__esModule", { value: true });
3
26
  exports.Loop = void 0;
4
27
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = require("react");
28
+ const react_1 = __importStar(require("react"));
6
29
  const Sequence_js_1 = require("../Sequence.js");
7
30
  const use_current_frame_js_1 = require("../use-current-frame.js");
8
31
  const use_video_config_js_1 = require("../use-video-config.js");
9
32
  const validate_duration_in_frames_js_1 = require("../validation/validate-duration-in-frames.js");
33
+ const LoopContext = (0, react_1.createContext)(null);
34
+ const useLoop = () => {
35
+ return react_1.default.useContext(LoopContext);
36
+ };
10
37
  /**
11
38
  * @description This component allows you to quickly lay out an animation so it repeats itself.
12
39
  * @see [Documentation](https://www.remotion.dev/docs/loop)
@@ -31,7 +58,8 @@ const Loop = ({ durationInFrames, times = Infinity, children, name, ...props })
31
58
  const actualTimes = Math.min(maxTimes, times);
32
59
  const style = props.layout === 'none' ? undefined : props.style;
33
60
  const maxFrame = durationInFrames * (actualTimes - 1);
34
- const start = Math.floor(currentFrame / durationInFrames) * durationInFrames;
61
+ const iteration = Math.floor(currentFrame / durationInFrames);
62
+ const start = iteration * durationInFrames;
35
63
  const from = Math.min(start, maxFrame);
36
64
  const loopDisplay = (0, react_1.useMemo)(() => {
37
65
  return {
@@ -40,6 +68,13 @@ const Loop = ({ durationInFrames, times = Infinity, children, name, ...props })
40
68
  durationInFrames,
41
69
  };
42
70
  }, [actualTimes, durationInFrames, from]);
43
- return ((0, jsx_runtime_1.jsx)(Sequence_js_1.Sequence, { durationInFrames: durationInFrames, from: from, name: name !== null && name !== void 0 ? name : '<Loop>', _remotionInternalLoopDisplay: loopDisplay, layout: props.layout, style: style, children: children }));
71
+ const loopContext = (0, react_1.useMemo)(() => {
72
+ return {
73
+ iteration: Math.floor(currentFrame / durationInFrames),
74
+ durationInFrames,
75
+ };
76
+ }, [currentFrame, durationInFrames]);
77
+ return ((0, jsx_runtime_1.jsx)(LoopContext.Provider, { value: loopContext, children: (0, jsx_runtime_1.jsx)(Sequence_js_1.Sequence, { durationInFrames: durationInFrames, from: from, name: name !== null && name !== void 0 ? name : '<Loop>', _remotionInternalLoopDisplay: loopDisplay, layout: props.layout, style: style, children: children }) }));
44
78
  };
45
79
  exports.Loop = Loop;
80
+ exports.Loop.useLoop = useLoop;
@@ -45,4 +45,9 @@ export declare const NoReactInternals: {
45
45
  ENABLE_V5_BREAKING_CHANGES: false;
46
46
  MIN_NODE_VERSION: number;
47
47
  MIN_BUN_VERSION: string;
48
+ colorNames: {
49
+ [key: string]: number;
50
+ };
51
+ DATE_TOKEN: string;
52
+ FILE_TOKEN: string;
48
53
  };
@@ -7,6 +7,7 @@ var random_js_1 = require("./random.js");
7
7
  Object.defineProperty(exports, "random", { enumerable: true, get: function () { return random_js_1.random; } });
8
8
  const delay_render_1 = require("./delay-render");
9
9
  const input_props_serialization_1 = require("./input-props-serialization");
10
+ const input_props_serialization_js_1 = require("./input-props-serialization.js");
10
11
  const interpolate_colors_1 = require("./interpolate-colors");
11
12
  const truthy_1 = require("./truthy");
12
13
  const v5_flag_1 = require("./v5-flag");
@@ -37,4 +38,7 @@ exports.NoReactInternals = {
37
38
  ENABLE_V5_BREAKING_CHANGES: v5_flag_1.ENABLE_V5_BREAKING_CHANGES,
38
39
  MIN_NODE_VERSION: v5_flag_1.ENABLE_V5_BREAKING_CHANGES ? 18 : 16,
39
40
  MIN_BUN_VERSION: v5_flag_1.ENABLE_V5_BREAKING_CHANGES ? '1.1.3' : '1.0.3',
41
+ colorNames: interpolate_colors_1.colorNames,
42
+ DATE_TOKEN: input_props_serialization_js_1.DATE_TOKEN,
43
+ FILE_TOKEN: input_props_serialization_js_1.FILE_TOKEN,
40
44
  };
@@ -1,4 +1,4 @@
1
- import type { SpringConfig } from './spring-utils.js';
1
+ import type { SpringConfig } from './spring-utils';
2
2
  /**
3
3
  * @description Calculates a position based on physical parameters, start and end value, and time.
4
4
  * @see [Documentation](https://www.remotion.dev/docs/spring)
@@ -28,4 +28,4 @@ export declare function spring({ frame: passedFrame, fps, config, from, to, dura
28
28
  reverse?: boolean;
29
29
  }): number;
30
30
  export { measureSpring } from './measure-spring.js';
31
- export { SpringConfig } from './spring-utils.js';
31
+ export type { SpringConfig } from './spring-utils';
@@ -1,4 +1,4 @@
1
- import type { SpringConfig } from './spring-utils.js';
1
+ import type { SpringConfig } from './spring-utils';
2
2
  /**
3
3
  * @description The function returns how long it takes for a spring animation to settle
4
4
  * @see [Documentation](https://www.remotion.dev/docs/measure-spring)
@@ -1 +1 @@
1
- export declare const VERSION = "4.0.142";
1
+ export declare const VERSION = "4.0.143";
@@ -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.142';
5
+ exports.VERSION = '4.0.143';
@@ -18,10 +18,10 @@ const use_unsafe_video_config_js_1 = require("../use-unsafe-video-config.js");
18
18
  const volume_prop_js_1 = require("../volume-prop.js");
19
19
  const get_current_time_js_1 = require("./get-current-time.js");
20
20
  const offthread_video_source_js_1 = require("./offthread-video-source.js");
21
- const OffthreadVideoForRendering = ({ onError, volume: volumeProp, playbackRate, src, muted, allowAmplificationDuringRender, transparent = false, toneMapped = true, toneFrequency, name, ...props }) => {
21
+ const OffthreadVideoForRendering = ({ onError, volume: volumeProp, playbackRate, src, muted, allowAmplificationDuringRender, transparent = false, toneMapped = true, toneFrequency, name, loopVolumeCurveBehavior, ...props }) => {
22
22
  const absoluteFrame = (0, timeline_position_state_js_1.useTimelinePosition)();
23
23
  const frame = (0, use_current_frame_js_1.useCurrentFrame)();
24
- const volumePropsFrame = (0, use_audio_frame_js_1.useFrameForVolumeProp)();
24
+ const volumePropsFrame = (0, use_audio_frame_js_1.useFrameForVolumeProp)(loopVolumeCurveBehavior !== null && loopVolumeCurveBehavior !== void 0 ? loopVolumeCurveBehavior : 'repeat');
25
25
  const videoConfig = (0, use_unsafe_video_config_js_1.useUnsafeVideoConfig)();
26
26
  const sequenceContext = (0, react_1.useContext)(SequenceContext_js_1.SequenceContext);
27
27
  const mediaStartsAt = (0, use_audio_frame_js_1.useMediaStartsAt)();
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { RemotionMainVideoProps } from './props.js';
2
+ import type { RemotionMainVideoProps } from './props';
3
3
  /**
4
4
  * @description allows you to include a video file in your Remotion project. It wraps the native HTMLVideoElement.
5
5
  * @see [Documentation](https://www.remotion.dev/docs/video)
@@ -14,10 +14,11 @@ export declare const Video: React.ForwardRefExoticComponent<Omit<Omit<React.Deta
14
14
  pauseWhenBuffering?: boolean | undefined;
15
15
  showInTimeline?: boolean | undefined;
16
16
  delayRenderTimeoutInMilliseconds?: number | undefined;
17
+ loopVolumeCurveBehavior?: import("../audio/use-audio-frame.js").LoopVolumeCurveBehavior | undefined;
17
18
  delayRenderRetries?: number | undefined;
18
19
  } & RemotionMainVideoProps & {
19
20
  /**
20
21
  * @deprecated For internal use only
21
22
  */
22
- stack?: string | undefined;
23
+ readonly stack?: string | undefined;
23
24
  }, "ref"> & React.RefAttributes<HTMLVideoElement>>;
@@ -1,12 +1,12 @@
1
1
  import React from 'react';
2
- import type { RemotionVideoProps } from './props.js';
2
+ import type { RemotionVideoProps } from './props';
3
3
  type VideoForPreviewProps = RemotionVideoProps & {
4
- onlyWarnForMediaSeekingError: boolean;
5
- onDuration: (src: string, durationInSeconds: number) => void;
6
- pauseWhenBuffering: boolean;
7
- _remotionInternalNativeLoopPassed: boolean;
8
- _remotionInternalStack: string | null;
9
- showInTimeline: boolean;
4
+ readonly onlyWarnForMediaSeekingError: boolean;
5
+ readonly onDuration: (src: string, durationInSeconds: number) => void;
6
+ readonly pauseWhenBuffering: boolean;
7
+ readonly _remotionInternalNativeLoopPassed: boolean;
8
+ readonly _remotionInternalStack: string | null;
9
+ readonly showInTimeline: boolean;
10
10
  };
11
11
  export declare const VideoForPreview: React.ForwardRefExoticComponent<Omit<VideoForPreviewProps, "ref"> & React.RefAttributes<HTMLVideoElement>>;
12
12
  export {};
@@ -18,15 +18,15 @@ const video_fragment_js_1 = require("./video-fragment.js");
18
18
  const VideoForDevelopmentRefForwardingFunction = (props, ref) => {
19
19
  var _a, _b, _c;
20
20
  const videoRef = (0, react_1.useRef)(null);
21
- const volumePropFrame = (0, use_audio_frame_js_1.useFrameForVolumeProp)();
21
+ const { volume, muted, playbackRate, onlyWarnForMediaSeekingError, src, onDuration,
22
+ // @ts-expect-error
23
+ acceptableTimeShift, acceptableTimeShiftInSeconds, toneFrequency, name, _remotionInternalNativeLoopPassed, _remotionInternalStack, style, pauseWhenBuffering, showInTimeline, loopVolumeCurveBehavior, ...nativeProps } = props;
24
+ const volumePropFrame = (0, use_audio_frame_js_1.useFrameForVolumeProp)(loopVolumeCurveBehavior !== null && loopVolumeCurveBehavior !== void 0 ? loopVolumeCurveBehavior : 'repeat');
22
25
  const { fps, durationInFrames } = (0, use_video_config_js_1.useVideoConfig)();
23
26
  const parentSequence = (0, react_1.useContext)(SequenceContext_js_1.SequenceContext);
24
27
  const { hidden } = (0, react_1.useContext)(SequenceManager_js_1.SequenceVisibilityToggleContext);
25
28
  const [timelineId] = (0, react_1.useState)(() => String(Math.random()));
26
29
  const isSequenceHidden = (_a = hidden[timelineId]) !== null && _a !== void 0 ? _a : false;
27
- const { volume, muted, playbackRate, onlyWarnForMediaSeekingError, src, onDuration,
28
- // @ts-expect-error
29
- acceptableTimeShift, acceptableTimeShiftInSeconds, toneFrequency, name, _remotionInternalNativeLoopPassed, _remotionInternalStack, style, pauseWhenBuffering, showInTimeline, ...nativeProps } = props;
30
30
  if (typeof acceptableTimeShift !== 'undefined') {
31
31
  throw new Error('acceptableTimeShift has been removed. Use acceptableTimeShiftInSeconds instead.');
32
32
  }
@@ -66,9 +66,7 @@ const VideoForDevelopmentRefForwardingFunction = (props, ref) => {
66
66
  shouldBuffer: pauseWhenBuffering,
67
67
  isPremounting: Boolean(parentSequence === null || parentSequence === void 0 ? void 0 : parentSequence.premounting),
68
68
  });
69
- const actualFrom = parentSequence
70
- ? parentSequence.relativeFrom + parentSequence.cumulatedFrom
71
- : 0;
69
+ const actualFrom = parentSequence ? parentSequence.relativeFrom : 0;
72
70
  const duration = parentSequence
73
71
  ? Math.min(parentSequence.durationInFrames, durationInFrames)
74
72
  : durationInFrames;
@@ -10,6 +10,7 @@ export declare const VideoForRendering: ForwardRefExoticComponent<Omit<React.Det
10
10
  pauseWhenBuffering?: boolean | undefined;
11
11
  showInTimeline?: boolean | undefined;
12
12
  delayRenderTimeoutInMilliseconds?: number | undefined;
13
+ loopVolumeCurveBehavior?: import("../audio/use-audio-frame.js").LoopVolumeCurveBehavior | undefined;
13
14
  delayRenderRetries?: number | undefined;
14
15
  } & {
15
16
  readonly onDuration: (src: string, durationInSeconds: number) => void;
@@ -17,10 +17,10 @@ const use_unsafe_video_config_js_1 = require("../use-unsafe-video-config.js");
17
17
  const volume_prop_js_1 = require("../volume-prop.js");
18
18
  const get_current_time_js_1 = require("./get-current-time.js");
19
19
  const seek_until_right_js_1 = require("./seek-until-right.js");
20
- const VideoForRenderingForwardFunction = ({ onError, volume: volumeProp, allowAmplificationDuringRender, playbackRate, onDuration, toneFrequency, name, acceptableTimeShiftInSeconds, delayRenderRetries, delayRenderTimeoutInMilliseconds, ...props }, ref) => {
20
+ const VideoForRenderingForwardFunction = ({ onError, volume: volumeProp, allowAmplificationDuringRender, playbackRate, onDuration, toneFrequency, name, acceptableTimeShiftInSeconds, delayRenderRetries, delayRenderTimeoutInMilliseconds, loopVolumeCurveBehavior, ...props }, ref) => {
21
21
  const absoluteFrame = (0, timeline_position_state_js_1.useTimelinePosition)();
22
22
  const frame = (0, use_current_frame_js_1.useCurrentFrame)();
23
- const volumePropsFrame = (0, use_audio_frame_js_1.useFrameForVolumeProp)();
23
+ const volumePropsFrame = (0, use_audio_frame_js_1.useFrameForVolumeProp)(loopVolumeCurveBehavior !== null && loopVolumeCurveBehavior !== void 0 ? loopVolumeCurveBehavior : 'repeat');
24
24
  const videoConfig = (0, use_unsafe_video_config_js_1.useUnsafeVideoConfig)();
25
25
  const videoRef = (0, react_1.useRef)(null);
26
26
  const sequenceContext = (0, react_1.useContext)(SequenceContext_js_1.SequenceContext);
@@ -1,3 +1,3 @@
1
1
  export { OffthreadVideo } from './OffthreadVideo.js';
2
2
  export { Video } from './Video.js';
3
- export { RemotionMainVideoProps, OffthreadVideoProps as RemotionOffthreadVideoProps, RemotionVideoProps, } from './props.js';
3
+ export type { RemotionMainVideoProps, OffthreadVideoProps as RemotionOffthreadVideoProps, RemotionVideoProps, } from './props';
@@ -1,4 +1,5 @@
1
1
  import type React from 'react';
2
+ import type { LoopVolumeCurveBehavior } from '../audio/use-audio-frame.js';
2
3
  import type { VolumeProp } from '../volume-prop.js';
3
4
  export type RemotionMainVideoProps = {
4
5
  startFrom?: number;
@@ -18,6 +19,7 @@ export type RemotionVideoProps = Omit<React.DetailedHTMLProps<React.VideoHTMLAtt
18
19
  pauseWhenBuffering?: boolean;
19
20
  showInTimeline?: boolean;
20
21
  delayRenderTimeoutInMilliseconds?: number;
22
+ loopVolumeCurveBehavior?: LoopVolumeCurveBehavior;
21
23
  delayRenderRetries?: number;
22
24
  };
23
25
  type DeprecatedOffthreadVideoProps = {
@@ -42,6 +44,7 @@ export type OffthreadVideoProps = {
42
44
  transparent?: boolean;
43
45
  toneMapped?: boolean;
44
46
  pauseWhenBuffering?: boolean;
47
+ loopVolumeCurveBehavior?: LoopVolumeCurveBehavior;
45
48
  /**
46
49
  * @deprecated For internal use only
47
50
  */
@@ -41,15 +41,19 @@ const appendVideoFragment = ({ actualSrc, actualFrom, duration, fps, }) => {
41
41
  return actualSrc;
42
42
  };
43
43
  exports.appendVideoFragment = appendVideoFragment;
44
- const isSubsetOfDuration = (prevStartFrom, newStartFrom, prevDuration, newDuration) => {
45
- return (prevStartFrom <= newStartFrom &&
46
- prevStartFrom + prevDuration >= newStartFrom + newDuration);
47
- };
44
+ const isSubsetOfDuration = ({ prevStartFrom, newStartFrom, prevDuration, newDuration, }) => prevStartFrom <= newStartFrom &&
45
+ prevStartFrom + prevDuration >= newStartFrom + newDuration;
48
46
  const useAppendVideoFragment = ({ actualSrc: initialActualSrc, actualFrom: initialActualFrom, duration: initialDuration, fps, }) => {
49
47
  const actualFromRef = (0, react_1.useRef)(initialActualFrom);
50
48
  const actualDuration = (0, react_1.useRef)(initialDuration);
51
49
  const actualSrc = (0, react_1.useRef)(initialActualSrc);
52
- if (!isSubsetOfDuration || initialActualSrc !== actualSrc.current) {
50
+ if (!isSubsetOfDuration({
51
+ prevStartFrom: actualFromRef.current,
52
+ newStartFrom: initialActualFrom,
53
+ prevDuration: actualDuration.current,
54
+ newDuration: initialDuration,
55
+ }) ||
56
+ initialActualSrc !== actualSrc.current) {
53
57
  actualFromRef.current = initialActualFrom;
54
58
  actualDuration.current = initialDuration;
55
59
  actualSrc.current = initialActualSrc;