remotion 4.0.380 → 4.0.382

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.
@@ -101,7 +101,10 @@ const InnerComposition = ({ width, height, fps, durationInFrames, id, defaultPro
101
101
  }));
102
102
  }, [defaultProps, id]);
103
103
  const resolved = (0, ResolveCompositionConfig_js_1.useResolvedVideoConfig)(id);
104
- if (environment.isStudio && video && video.component === lazy) {
104
+ if (environment.isStudio &&
105
+ video &&
106
+ video.component === lazy &&
107
+ video.id === id) {
105
108
  const Comp = lazy;
106
109
  if (resolved === null ||
107
110
  (resolved.type !== 'success' &&
@@ -110,7 +113,10 @@ const InnerComposition = ({ width, height, fps, durationInFrames, id, defaultPro
110
113
  }
111
114
  return (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(CanUseRemotionHooks_js_1.CanUseRemotionHooksProvider, { children: (0, jsx_runtime_1.jsx)(react_1.Suspense, { fallback: (0, jsx_runtime_1.jsx)(loading_indicator_js_1.Loading, {}), children: (0, jsx_runtime_1.jsx)(Comp, { ...((_b = resolved.result.props) !== null && _b !== void 0 ? _b : {}) }) }) }), (0, portal_node_js_1.portalNode)());
112
115
  }
113
- if (environment.isRendering && video && video.component === lazy) {
116
+ if (environment.isRendering &&
117
+ video &&
118
+ video.component === lazy &&
119
+ video.id === id) {
114
120
  const Comp = lazy;
115
121
  if (resolved === null ||
116
122
  (resolved.type !== 'success' &&
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RemotionRootContexts = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
- const CompositionManagerContext_js_1 = require("./CompositionManagerContext.js");
7
6
  const EditorProps_js_1 = require("./EditorProps.js");
8
7
  const SequenceManager_js_1 = require("./SequenceManager.js");
9
8
  const TimelineContext_js_1 = require("./TimelineContext.js");
@@ -15,7 +14,6 @@ const prefetch_state_js_1 = require("./prefetch-state.js");
15
14
  const use_media_enabled_js_1 = require("./use-media-enabled.js");
16
15
  const duration_state_js_1 = require("./video/duration-state.js");
17
16
  const RemotionRootContexts = ({ children, numberOfAudioTags, logLevel, audioLatencyHint, videoEnabled, audioEnabled, frameState, }) => {
18
- var _a;
19
17
  const [fastRefreshes, setFastRefreshes] = (0, react_1.useState)(0);
20
18
  const [manualRefreshes, setManualRefreshes] = (0, react_1.useState)(0);
21
19
  const nonceContext = (0, react_1.useMemo)(() => {
@@ -47,15 +45,6 @@ const RemotionRootContexts = ({ children, numberOfAudioTags, logLevel, audioLate
47
45
  const logging = (0, react_1.useMemo)(() => {
48
46
  return { logLevel, mountTime: Date.now() };
49
47
  }, [logLevel]);
50
- const compositionManager = (0, react_1.useContext)(CompositionManagerContext_js_1.CompositionManager);
51
- const composition = (0, react_1.useMemo)(() => {
52
- return compositionManager.compositions.find((c) => {
53
- var _a;
54
- return ((_a = compositionManager.canvasContent) === null || _a === void 0 ? void 0 : _a.type) === 'composition'
55
- ? c.id === compositionManager.canvasContent.compositionId
56
- : false;
57
- });
58
- }, [compositionManager.compositions, compositionManager.canvasContent]);
59
- return ((0, jsx_runtime_1.jsx)(log_level_context_js_1.LogLevelContext.Provider, { value: logging, children: (0, jsx_runtime_1.jsx)(nonce_js_1.NonceContext.Provider, { value: nonceContext, children: (0, jsx_runtime_1.jsx)(nonce_js_1.SetNonceContext.Provider, { value: setNonceContext, children: (0, jsx_runtime_1.jsx)(TimelineContext_js_1.TimelineContextProvider, { frameState: frameState, children: (0, jsx_runtime_1.jsx)(use_media_enabled_js_1.MediaEnabledProvider, { videoEnabled: videoEnabled, audioEnabled: audioEnabled, children: (0, jsx_runtime_1.jsx)(EditorProps_js_1.EditorPropsProvider, { children: (0, jsx_runtime_1.jsx)(prefetch_state_js_1.PrefetchProvider, { children: (0, jsx_runtime_1.jsx)(SequenceManager_js_1.SequenceManagerProvider, { children: (0, jsx_runtime_1.jsx)(shared_audio_tags_js_1.SharedAudioContextProvider, { numberOfAudioTags: numberOfAudioTags, audioLatencyHint: audioLatencyHint, component: (_a = composition === null || composition === void 0 ? void 0 : composition.component) !== null && _a !== void 0 ? _a : null, children: (0, jsx_runtime_1.jsx)(duration_state_js_1.DurationsContextProvider, { children: (0, jsx_runtime_1.jsx)(buffering_js_1.BufferingProvider, { children: children }) }) }) }) }) }) }) }) }) }) }));
48
+ return ((0, jsx_runtime_1.jsx)(log_level_context_js_1.LogLevelContext.Provider, { value: logging, children: (0, jsx_runtime_1.jsx)(nonce_js_1.NonceContext.Provider, { value: nonceContext, children: (0, jsx_runtime_1.jsx)(nonce_js_1.SetNonceContext.Provider, { value: setNonceContext, children: (0, jsx_runtime_1.jsx)(TimelineContext_js_1.TimelineContextProvider, { frameState: frameState, children: (0, jsx_runtime_1.jsx)(use_media_enabled_js_1.MediaEnabledProvider, { videoEnabled: videoEnabled, audioEnabled: audioEnabled, children: (0, jsx_runtime_1.jsx)(EditorProps_js_1.EditorPropsProvider, { children: (0, jsx_runtime_1.jsx)(prefetch_state_js_1.PrefetchProvider, { children: (0, jsx_runtime_1.jsx)(SequenceManager_js_1.SequenceManagerProvider, { children: (0, jsx_runtime_1.jsx)(shared_audio_tags_js_1.SharedAudioContextProvider, { numberOfAudioTags: numberOfAudioTags, audioLatencyHint: audioLatencyHint, children: (0, jsx_runtime_1.jsx)(duration_state_js_1.DurationsContextProvider, { children: (0, jsx_runtime_1.jsx)(buffering_js_1.BufferingProvider, { children: children }) }) }) }) }) }) }) }) }) }) }));
60
49
  };
61
50
  exports.RemotionRootContexts = RemotionRootContexts;
@@ -1,4 +1,4 @@
1
- import type { AudioHTMLAttributes, ComponentType, LazyExoticComponent } from 'react';
1
+ import type { AudioHTMLAttributes } from 'react';
2
2
  import React from 'react';
3
3
  import type { SharedElementSourceNode } from './shared-element-source-node.js';
4
4
  /**
@@ -42,7 +42,6 @@ export declare const SharedAudioContextProvider: React.FC<{
42
42
  readonly numberOfAudioTags: number;
43
43
  readonly children: React.ReactNode;
44
44
  readonly audioLatencyHint: AudioContextLatencyCategory;
45
- readonly component: LazyExoticComponent<ComponentType<Record<string, unknown>>> | ComponentType<Record<string, unknown>> | null;
46
45
  }>;
47
46
  export declare const useSharedAudio: ({ aud, audioId, premounting, }: {
48
47
  aud: AudioHTMLAttributes<HTMLAudioElement>;
@@ -74,7 +74,7 @@ const didPropChange = (key, newProp, prevProp) => {
74
74
  return true;
75
75
  };
76
76
  exports.SharedAudioContext = (0, react_1.createContext)(null);
77
- const SharedAudioContextProvider = ({ children, numberOfAudioTags, audioLatencyHint, component }) => {
77
+ const SharedAudioContextProvider = ({ children, numberOfAudioTags, audioLatencyHint }) => {
78
78
  const audios = (0, react_1.useRef)([]);
79
79
  const [initialNumberOfAudioTags] = (0, react_1.useState)(numberOfAudioTags);
80
80
  if (numberOfAudioTags !== initialNumberOfAudioTags) {
@@ -223,22 +223,6 @@ const SharedAudioContextProvider = ({ children, numberOfAudioTags, audioLatencyH
223
223
  updateAudio,
224
224
  audioContext,
225
225
  ]);
226
- // Fixing a bug: In React, if a component is unmounted using useInsertionEffect, then
227
- // the cleanup function does sometimes not work properly. That is why when we
228
- // are changing the composition, we reset the audio state.
229
- // TODO: Possibly this does not save the problem completely, since the
230
- // if an audio tag that is inside a sequence will also not be removed
231
- // from the shared audios.
232
- const resetAudio = (0, react_1.useCallback)(() => {
233
- takenAudios.current = new Array(numberOfAudioTags).fill(false);
234
- audios.current = [];
235
- rerenderAudios();
236
- }, [numberOfAudioTags, rerenderAudios]);
237
- (0, react_1.useEffect)(() => {
238
- return () => {
239
- resetAudio();
240
- };
241
- }, [component, resetAudio]);
242
226
  return ((0, jsx_runtime_1.jsxs)(exports.SharedAudioContext.Provider, { value: value, children: [refs.map(({ id, ref }) => {
243
227
  return (
244
228
  // Without preload="metadata", iOS will seek the time internally
@@ -27,6 +27,10 @@ const useSingletonAudioContext = (logLevel, latencyHint) => {
27
27
  }
28
28
  return new AudioContext({
29
29
  latencyHint,
30
+ // By default, this can end up being 44100Hz.
31
+ // Playing a 48000Hz file in a 44100Hz context, such as https://remotion.media/video.mp4 in a @remotion/media tag
32
+ // we observe some issues that seem to go away when we set the sample rate to 48000 with Sony LinkBuds Bluetooth headphones.
33
+ sampleRate: 48000,
30
34
  });
31
35
  }, [logLevel, latencyHint, env.isRendering]);
32
36
  return audioContext;
@@ -152,7 +152,6 @@ export declare const Internals: {
152
152
  readonly numberOfAudioTags: number;
153
153
  readonly children: React.ReactNode;
154
154
  readonly audioLatencyHint: AudioContextLatencyCategory;
155
- readonly component: import("react").LazyExoticComponent<import("react").ComponentType<Record<string, unknown>>> | import("react").ComponentType<Record<string, unknown>> | null;
156
155
  }>;
157
156
  readonly invalidCompositionErrorMessage: string;
158
157
  readonly calculateMediaDuration: ({ trimAfter, mediaDurationInFrames, playbackRate, trimBefore, }: {
@@ -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.380";
6
+ export declare const VERSION = "4.0.382";
@@ -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.380';
10
+ exports.VERSION = '4.0.382';
@@ -110,7 +110,7 @@ function truthy(value) {
110
110
  }
111
111
 
112
112
  // src/version.ts
113
- var VERSION = "4.0.380";
113
+ var VERSION = "4.0.382";
114
114
 
115
115
  // src/multiple-versions-warning.ts
116
116
  var checkMultipleRemotionVersions = () => {
@@ -2974,7 +2974,7 @@ var DurationsContextProvider = ({ children }) => {
2974
2974
  import {
2975
2975
  forwardRef as forwardRef4,
2976
2976
  useContext as useContext25,
2977
- useEffect as useEffect13,
2977
+ useEffect as useEffect12,
2978
2978
  useImperativeHandle as useImperativeHandle6,
2979
2979
  useMemo as useMemo21,
2980
2980
  useRef as useRef12,
@@ -3004,7 +3004,6 @@ import React15, {
3004
3004
  createRef as createRef2,
3005
3005
  useCallback as useCallback7,
3006
3006
  useContext as useContext16,
3007
- useEffect as useEffect6,
3008
3007
  useMemo as useMemo15,
3009
3008
  useRef as useRef5,
3010
3009
  useState as useState11
@@ -3117,7 +3116,8 @@ var useSingletonAudioContext = (logLevel, latencyHint) => {
3117
3116
  return null;
3118
3117
  }
3119
3118
  return new AudioContext({
3120
- latencyHint
3119
+ latencyHint,
3120
+ sampleRate: 48000
3121
3121
  });
3122
3122
  }, [logLevel, latencyHint, env.isRendering]);
3123
3123
  return audioContext;
@@ -3152,7 +3152,7 @@ var didPropChange = (key, newProp, prevProp) => {
3152
3152
  return true;
3153
3153
  };
3154
3154
  var SharedAudioContext = createContext16(null);
3155
- var SharedAudioContextProvider = ({ children, numberOfAudioTags, audioLatencyHint, component }) => {
3155
+ var SharedAudioContextProvider = ({ children, numberOfAudioTags, audioLatencyHint }) => {
3156
3156
  const audios = useRef5([]);
3157
3157
  const [initialNumberOfAudioTags] = useState11(numberOfAudioTags);
3158
3158
  if (numberOfAudioTags !== initialNumberOfAudioTags) {
@@ -3296,16 +3296,6 @@ var SharedAudioContextProvider = ({ children, numberOfAudioTags, audioLatencyHin
3296
3296
  updateAudio,
3297
3297
  audioContext
3298
3298
  ]);
3299
- const resetAudio = useCallback7(() => {
3300
- takenAudios.current = new Array(numberOfAudioTags).fill(false);
3301
- audios.current = [];
3302
- rerenderAudios();
3303
- }, [numberOfAudioTags, rerenderAudios]);
3304
- useEffect6(() => {
3305
- return () => {
3306
- resetAudio();
3307
- };
3308
- }, [component, resetAudio]);
3309
3299
  return /* @__PURE__ */ jsxs(SharedAudioContext.Provider, {
3310
3300
  value,
3311
3301
  children: [
@@ -3556,7 +3546,7 @@ var useVolume = ({
3556
3546
  };
3557
3547
 
3558
3548
  // src/use-media-in-timeline.ts
3559
- import { useContext as useContext19, useEffect as useEffect7, useMemo as useMemo16, useState as useState12 } from "react";
3549
+ import { useContext as useContext19, useEffect as useEffect6, useMemo as useMemo16, useState as useState12 } from "react";
3560
3550
 
3561
3551
  // src/audio/use-audio-frame.ts
3562
3552
  import { useContext as useContext18 } from "react";
@@ -3654,7 +3644,7 @@ var useBasicMediaInTimeline = ({
3654
3644
  });
3655
3645
  }).join(",");
3656
3646
  }, [duration, startsAt, volume, mediaVolume]);
3657
- useEffect7(() => {
3647
+ useEffect6(() => {
3658
3648
  if (typeof volume === "number" && volume !== initialVolume) {
3659
3649
  warnOnce2(`Remotion: The ${mediaType} with src ${src} has changed it's volume. Prefer the callback syntax for setting volume to get better timeline display: https://www.remotion.dev/docs/audio/volume`);
3660
3650
  }
@@ -3708,7 +3698,7 @@ var useMediaInTimeline = ({
3708
3698
  trimBefore: undefined,
3709
3699
  playbackRate
3710
3700
  });
3711
- useEffect7(() => {
3701
+ useEffect6(() => {
3712
3702
  if (!src) {
3713
3703
  throw new Error("No src passed");
3714
3704
  }
@@ -3769,7 +3759,7 @@ var useMediaInTimeline = ({
3769
3759
  import {
3770
3760
  useCallback as useCallback10,
3771
3761
  useContext as useContext22,
3772
- useEffect as useEffect11,
3762
+ useEffect as useEffect10,
3773
3763
  useLayoutEffect as useLayoutEffect7,
3774
3764
  useRef as useRef11
3775
3765
  } from "react";
@@ -3784,7 +3774,7 @@ import { useContext as useContext21, useMemo as useMemo18 } from "react";
3784
3774
  import React16, {
3785
3775
  useCallback as useCallback8,
3786
3776
  useContext as useContext20,
3787
- useEffect as useEffect8,
3777
+ useEffect as useEffect7,
3788
3778
  useLayoutEffect as useLayoutEffect6,
3789
3779
  useMemo as useMemo17,
3790
3780
  useRef as useRef8,
@@ -3826,7 +3816,7 @@ var useBufferManager = (logLevel, mountTime) => {
3826
3816
  }
3827
3817
  };
3828
3818
  }, []);
3829
- useEffect8(() => {
3819
+ useEffect7(() => {
3830
3820
  if (blocks.length > 0) {
3831
3821
  onBufferingCallbacks.forEach((c) => c());
3832
3822
  playbackLogging({
@@ -3865,7 +3855,7 @@ var BufferingProvider = ({ children }) => {
3865
3855
  };
3866
3856
  var useIsPlayerBuffering = (bufferManager) => {
3867
3857
  const [isBuffering, setIsBuffering] = useState13(bufferManager.buffering.current);
3868
- useEffect8(() => {
3858
+ useEffect7(() => {
3869
3859
  const onBuffer = () => {
3870
3860
  setIsBuffering(true);
3871
3861
  };
@@ -4034,7 +4024,7 @@ var seek = ({
4034
4024
  };
4035
4025
 
4036
4026
  // src/use-media-buffering.ts
4037
- import { useEffect as useEffect9, useState as useState14 } from "react";
4027
+ import { useEffect as useEffect8, useState as useState14 } from "react";
4038
4028
  var useMediaBuffering = ({
4039
4029
  element,
4040
4030
  shouldBuffer,
@@ -4046,7 +4036,7 @@ var useMediaBuffering = ({
4046
4036
  }) => {
4047
4037
  const buffer = useBufferState();
4048
4038
  const [isBuffering, setIsBuffering] = useState14(false);
4049
- useEffect9(() => {
4039
+ useEffect8(() => {
4050
4040
  let cleanupFns = [];
4051
4041
  const { current } = element;
4052
4042
  if (!current) {
@@ -4174,7 +4164,7 @@ var useMediaBuffering = ({
4174
4164
  };
4175
4165
 
4176
4166
  // src/use-request-video-callback-time.ts
4177
- import { useEffect as useEffect10, useRef as useRef10 } from "react";
4167
+ import { useEffect as useEffect9, useRef as useRef10 } from "react";
4178
4168
  var useRequestVideoCallbackTime = ({
4179
4169
  mediaRef,
4180
4170
  mediaType,
@@ -4182,7 +4172,7 @@ var useRequestVideoCallbackTime = ({
4182
4172
  onVariableFpsVideoDetected
4183
4173
  }) => {
4184
4174
  const currentTime = useRef10(null);
4185
- useEffect10(() => {
4175
+ useEffect9(() => {
4186
4176
  const { current } = mediaRef;
4187
4177
  if (current) {
4188
4178
  currentTime.current = {
@@ -4476,7 +4466,7 @@ var useMediaPlayback = ({
4476
4466
  return acceptableTimeshift ?? defaultAcceptableTimeshift;
4477
4467
  })();
4478
4468
  const isPlayerBuffering = useIsPlayerBuffering(buffering);
4479
- useEffect11(() => {
4469
+ useEffect10(() => {
4480
4470
  if (mediaRef.current?.paused) {
4481
4471
  return;
4482
4472
  }
@@ -4521,7 +4511,7 @@ var useMediaPlayback = ({
4521
4511
  mediaRef.current.playbackRate = playbackRateToSet;
4522
4512
  }
4523
4513
  }, [mediaRef, playbackRate]);
4524
- useEffect11(() => {
4514
+ useEffect10(() => {
4525
4515
  const tagName = mediaType === "audio" ? "<Html5Audio>" : "<Html5Video>";
4526
4516
  if (!mediaRef.current) {
4527
4517
  throw new Error(`No ${mediaType} ref found`);
@@ -4640,7 +4630,7 @@ var useMediaPlayback = ({
4640
4630
  };
4641
4631
 
4642
4632
  // src/use-media-tag.ts
4643
- import { useContext as useContext23, useEffect as useEffect12 } from "react";
4633
+ import { useContext as useContext23, useEffect as useEffect11 } from "react";
4644
4634
  var useMediaTag = ({
4645
4635
  mediaRef,
4646
4636
  id,
@@ -4653,7 +4643,7 @@ var useMediaTag = ({
4653
4643
  const logLevel = useLogLevel();
4654
4644
  const mountTime = useMountTime();
4655
4645
  const env = useRemotionEnvironment();
4656
- useEffect12(() => {
4646
+ useEffect11(() => {
4657
4647
  const tag = {
4658
4648
  id,
4659
4649
  play: (reason) => {
@@ -4870,7 +4860,7 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
4870
4860
  }, [audioRef]);
4871
4861
  const currentOnDurationCallback = useRef12(onDuration);
4872
4862
  currentOnDurationCallback.current = onDuration;
4873
- useEffect13(() => {
4863
+ useEffect12(() => {
4874
4864
  const { current } = audioRef;
4875
4865
  if (!current) {
4876
4866
  return;
@@ -4903,7 +4893,7 @@ var AudioForPreview = forwardRef4(AudioForDevelopmentForwardRefFunction);
4903
4893
  import {
4904
4894
  forwardRef as forwardRef5,
4905
4895
  useContext as useContext26,
4906
- useEffect as useEffect14,
4896
+ useEffect as useEffect13,
4907
4897
  useImperativeHandle as useImperativeHandle7,
4908
4898
  useLayoutEffect as useLayoutEffect8,
4909
4899
  useMemo as useMemo22,
@@ -4951,7 +4941,7 @@ var AudioForRenderingRefForwardingFunction = (props, ref) => {
4951
4941
  useImperativeHandle7(ref, () => {
4952
4942
  return audioRef.current;
4953
4943
  }, []);
4954
- useEffect14(() => {
4944
+ useEffect13(() => {
4955
4945
  if (!props.src) {
4956
4946
  throw new Error("No src passed");
4957
4947
  }
@@ -5158,11 +5148,11 @@ var Html5Audio = forwardRef6(AudioRefForwardingFunction);
5158
5148
  addSequenceStackTraces(Html5Audio);
5159
5149
  var Audio = Html5Audio;
5160
5150
  // src/Composition.tsx
5161
- import { Suspense, useContext as useContext29, useEffect as useEffect16 } from "react";
5151
+ import { Suspense, useContext as useContext29, useEffect as useEffect15 } from "react";
5162
5152
  import { createPortal } from "react-dom";
5163
5153
 
5164
5154
  // src/Folder.tsx
5165
- import { createContext as createContext18, useContext as useContext28, useEffect as useEffect15, useMemo as useMemo23 } from "react";
5155
+ import { createContext as createContext18, useContext as useContext28, useEffect as useEffect14, useMemo as useMemo23 } from "react";
5166
5156
 
5167
5157
  // src/validation/validate-folder-name.ts
5168
5158
  var getRegex = () => /^([a-zA-Z0-9-\u4E00-\u9FFF])+$/g;
@@ -5198,7 +5188,7 @@ var Folder = ({ name, children }) => {
5198
5188
  parentName
5199
5189
  };
5200
5190
  }, [name, parentName]);
5201
- useEffect15(() => {
5191
+ useEffect14(() => {
5202
5192
  registerFolder(name, parentName);
5203
5193
  return () => {
5204
5194
  unregisterFolder(name, parentName);
@@ -5353,7 +5343,7 @@ var validateDefaultAndInputProps = (defaultProps, name, compositionId) => {
5353
5343
  import { jsx as jsx23 } from "react/jsx-runtime";
5354
5344
  var Fallback = () => {
5355
5345
  const { continueRender: continueRender2, delayRender: delayRender2 } = useDelayRender();
5356
- useEffect16(() => {
5346
+ useEffect15(() => {
5357
5347
  const fallback = delayRender2("Waiting for Root component to unsuspend");
5358
5348
  return () => continueRender2(fallback);
5359
5349
  }, [continueRender2, delayRender2]);
@@ -5391,7 +5381,7 @@ var InnerComposition = ({
5391
5381
  throw new Error("<Composition> mounted inside another composition. See https://remotion.dev/docs/wrong-composition-mount for help.");
5392
5382
  }
5393
5383
  const { folderName, parentName } = useContext29(FolderContext);
5394
- useEffect16(() => {
5384
+ useEffect15(() => {
5395
5385
  if (!id) {
5396
5386
  throw new Error("No id for composition passed.");
5397
5387
  }
@@ -5430,7 +5420,7 @@ var InnerComposition = ({
5430
5420
  registerComposition,
5431
5421
  unregisterComposition
5432
5422
  ]);
5433
- useEffect16(() => {
5423
+ useEffect15(() => {
5434
5424
  window.dispatchEvent(new CustomEvent(PROPS_UPDATED_EXTERNALLY, {
5435
5425
  detail: {
5436
5426
  resetUnsaved: id
@@ -5438,7 +5428,7 @@ var InnerComposition = ({
5438
5428
  }));
5439
5429
  }, [defaultProps, id]);
5440
5430
  const resolved = useResolvedVideoConfig(id);
5441
- if (environment.isStudio && video && video.component === lazy) {
5431
+ if (environment.isStudio && video && video.component === lazy && video.id === id) {
5442
5432
  const Comp = lazy;
5443
5433
  if (resolved === null || resolved.type !== "success" && resolved.type !== "success-and-refreshing") {
5444
5434
  return null;
@@ -5452,7 +5442,7 @@ var InnerComposition = ({
5452
5442
  })
5453
5443
  }), portalNode());
5454
5444
  }
5455
- if (environment.isRendering && video && video.component === lazy) {
5445
+ if (environment.isRendering && video && video.component === lazy && video.id === id) {
5456
5446
  const Comp = lazy;
5457
5447
  if (resolved === null || resolved.type !== "success" && resolved.type !== "success-and-refreshing") {
5458
5448
  return null;
@@ -6093,7 +6083,7 @@ var waitForRoot = (fn) => {
6093
6083
  };
6094
6084
 
6095
6085
  // src/RemotionRoot.tsx
6096
- import { useContext as useContext32, useEffect as useEffect17, useMemo as useMemo27, useState as useState18 } from "react";
6086
+ import { useEffect as useEffect16, useMemo as useMemo27, useState as useState18 } from "react";
6097
6087
 
6098
6088
  // src/use-media-enabled.tsx
6099
6089
  import { createContext as createContext19, useContext as useContext31, useMemo as useMemo26 } from "react";
@@ -6159,7 +6149,7 @@ var RemotionRootContexts = ({
6159
6149
  }
6160
6150
  };
6161
6151
  }, []);
6162
- useEffect17(() => {
6152
+ useEffect16(() => {
6163
6153
  if (typeof __webpack_module__ !== "undefined") {
6164
6154
  if (__webpack_module__.hot) {
6165
6155
  __webpack_module__.hot.addStatusHandler((status) => {
@@ -6173,10 +6163,6 @@ var RemotionRootContexts = ({
6173
6163
  const logging = useMemo27(() => {
6174
6164
  return { logLevel, mountTime: Date.now() };
6175
6165
  }, [logLevel]);
6176
- const compositionManager = useContext32(CompositionManager);
6177
- const composition = useMemo27(() => {
6178
- return compositionManager.compositions.find((c2) => compositionManager.canvasContent?.type === "composition" ? c2.id === compositionManager.canvasContent.compositionId : false);
6179
- }, [compositionManager.compositions, compositionManager.canvasContent]);
6180
6166
  return /* @__PURE__ */ jsx28(LogLevelContext.Provider, {
6181
6167
  value: logging,
6182
6168
  children: /* @__PURE__ */ jsx28(NonceContext.Provider, {
@@ -6194,7 +6180,6 @@ var RemotionRootContexts = ({
6194
6180
  children: /* @__PURE__ */ jsx28(SharedAudioContextProvider, {
6195
6181
  numberOfAudioTags,
6196
6182
  audioLatencyHint,
6197
- component: composition?.component ?? null,
6198
6183
  children: /* @__PURE__ */ jsx28(DurationsContextProvider, {
6199
6184
  children: /* @__PURE__ */ jsx28(BufferingProvider, {
6200
6185
  children
@@ -6301,8 +6286,8 @@ import { useCallback as useCallback16 } from "react";
6301
6286
  // src/video/OffthreadVideoForRendering.tsx
6302
6287
  import {
6303
6288
  useCallback as useCallback15,
6304
- useContext as useContext33,
6305
- useEffect as useEffect18,
6289
+ useContext as useContext32,
6290
+ useEffect as useEffect17,
6306
6291
  useLayoutEffect as useLayoutEffect10,
6307
6292
  useMemo as useMemo28,
6308
6293
  useState as useState19
@@ -6343,9 +6328,9 @@ var OffthreadVideoForRendering = ({
6343
6328
  const frame = useCurrentFrame();
6344
6329
  const volumePropsFrame = useFrameForVolumeProp(loopVolumeCurveBehavior);
6345
6330
  const videoConfig = useUnsafeVideoConfig();
6346
- const sequenceContext = useContext33(SequenceContext);
6331
+ const sequenceContext = useContext32(SequenceContext);
6347
6332
  const mediaStartsAt = useMediaStartsAt();
6348
- const { registerRenderAsset, unregisterRenderAsset } = useContext33(RenderAssetManager);
6333
+ const { registerRenderAsset, unregisterRenderAsset } = useContext32(RenderAssetManager);
6349
6334
  if (!src) {
6350
6335
  throw new TypeError("No `src` was passed to <OffthreadVideo>.");
6351
6336
  }
@@ -6364,7 +6349,7 @@ var OffthreadVideoForRendering = ({
6364
6349
  mediaVolume: 1
6365
6350
  });
6366
6351
  warnAboutTooHighVolume(volume);
6367
- useEffect18(() => {
6352
+ useEffect17(() => {
6368
6353
  if (!src) {
6369
6354
  throw new Error("No src passed");
6370
6355
  }
@@ -6525,8 +6510,8 @@ var OffthreadVideoForRendering = ({
6525
6510
  // src/video/VideoForPreview.tsx
6526
6511
  import {
6527
6512
  forwardRef as forwardRef9,
6528
- useContext as useContext34,
6529
- useEffect as useEffect20,
6513
+ useContext as useContext33,
6514
+ useEffect as useEffect19,
6530
6515
  useImperativeHandle as useImperativeHandle10,
6531
6516
  useMemo as useMemo29,
6532
6517
  useRef as useRef16,
@@ -6534,12 +6519,12 @@ import {
6534
6519
  } from "react";
6535
6520
 
6536
6521
  // src/video/emit-video-frame.ts
6537
- import { useEffect as useEffect19 } from "react";
6522
+ import { useEffect as useEffect18 } from "react";
6538
6523
  var useEmitVideoFrame = ({
6539
6524
  ref,
6540
6525
  onVideoFrame
6541
6526
  }) => {
6542
- useEffect19(() => {
6527
+ useEffect18(() => {
6543
6528
  const { current } = ref;
6544
6529
  if (!current) {
6545
6530
  return;
@@ -6565,7 +6550,7 @@ var useEmitVideoFrame = ({
6565
6550
  // src/video/VideoForPreview.tsx
6566
6551
  import { jsx as jsx30 } from "react/jsx-runtime";
6567
6552
  var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
6568
- const context = useContext34(SharedAudioContext);
6553
+ const context = useContext33(SharedAudioContext);
6569
6554
  if (!context) {
6570
6555
  throw new Error("SharedAudioContext not found");
6571
6556
  }
@@ -6613,8 +6598,8 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
6613
6598
  }
6614
6599
  const volumePropFrame = useFrameForVolumeProp(loopVolumeCurveBehavior ?? "repeat");
6615
6600
  const { fps, durationInFrames } = useVideoConfig();
6616
- const parentSequence = useContext34(SequenceContext);
6617
- const { hidden } = useContext34(SequenceVisibilityToggleContext);
6601
+ const parentSequence = useContext33(SequenceContext);
6602
+ const { hidden } = useContext33(SequenceVisibilityToggleContext);
6618
6603
  const logLevel = useLogLevel();
6619
6604
  const mountTime = useMountTime();
6620
6605
  const [timelineId] = useState20(() => String(Math.random()));
@@ -6689,7 +6674,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
6689
6674
  tag: "video",
6690
6675
  mountTime
6691
6676
  }));
6692
- useEffect20(() => {
6677
+ useEffect19(() => {
6693
6678
  const { current } = videoRef;
6694
6679
  if (!current) {
6695
6680
  return;
@@ -6720,7 +6705,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
6720
6705
  const currentOnDurationCallback = useRef16(onDuration);
6721
6706
  currentOnDurationCallback.current = onDuration;
6722
6707
  useEmitVideoFrame({ ref: videoRef, onVideoFrame });
6723
- useEffect20(() => {
6708
+ useEffect19(() => {
6724
6709
  const { current } = videoRef;
6725
6710
  if (!current) {
6726
6711
  return;
@@ -6737,7 +6722,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
6737
6722
  current.removeEventListener("loadedmetadata", onLoadedMetadata);
6738
6723
  };
6739
6724
  }, [src]);
6740
- useEffect20(() => {
6725
+ useEffect19(() => {
6741
6726
  const { current } = videoRef;
6742
6727
  if (!current) {
6743
6728
  return;
@@ -7970,13 +7955,13 @@ var Still = (props2) => {
7970
7955
  return React36.createElement(Composition, newProps);
7971
7956
  };
7972
7957
  // src/video/Video.tsx
7973
- import { forwardRef as forwardRef12, useCallback as useCallback17, useContext as useContext36 } from "react";
7958
+ import { forwardRef as forwardRef12, useCallback as useCallback17, useContext as useContext35 } from "react";
7974
7959
 
7975
7960
  // src/video/VideoForRendering.tsx
7976
7961
  import {
7977
7962
  forwardRef as forwardRef11,
7978
- useContext as useContext35,
7979
- useEffect as useEffect21,
7963
+ useContext as useContext34,
7964
+ useEffect as useEffect20,
7980
7965
  useImperativeHandle as useImperativeHandle11,
7981
7966
  useLayoutEffect as useLayoutEffect11,
7982
7967
  useMemo as useMemo32,
@@ -8129,13 +8114,13 @@ var VideoForRenderingForwardFunction = ({
8129
8114
  const volumePropsFrame = useFrameForVolumeProp(loopVolumeCurveBehavior ?? "repeat");
8130
8115
  const videoConfig = useUnsafeVideoConfig();
8131
8116
  const videoRef = useRef17(null);
8132
- const sequenceContext = useContext35(SequenceContext);
8117
+ const sequenceContext = useContext34(SequenceContext);
8133
8118
  const mediaStartsAt = useMediaStartsAt();
8134
8119
  const environment = useRemotionEnvironment();
8135
8120
  const logLevel = useLogLevel();
8136
8121
  const mountTime = useMountTime();
8137
8122
  const { delayRender: delayRender2, continueRender: continueRender2 } = useDelayRender();
8138
- const { registerRenderAsset, unregisterRenderAsset } = useContext35(RenderAssetManager);
8123
+ const { registerRenderAsset, unregisterRenderAsset } = useContext34(RenderAssetManager);
8139
8124
  const id = useMemo32(() => `video-${random(props2.src ?? "")}-${sequenceContext?.cumulatedFrom}-${sequenceContext?.relativeFrom}-${sequenceContext?.durationInFrames}`, [
8140
8125
  props2.src,
8141
8126
  sequenceContext?.cumulatedFrom,
@@ -8151,7 +8136,7 @@ var VideoForRenderingForwardFunction = ({
8151
8136
  mediaVolume: 1
8152
8137
  });
8153
8138
  warnAboutTooHighVolume(volume);
8154
- useEffect21(() => {
8139
+ useEffect20(() => {
8155
8140
  if (!props2.src) {
8156
8141
  throw new Error("No src passed");
8157
8142
  }
@@ -8194,7 +8179,7 @@ var VideoForRenderingForwardFunction = ({
8194
8179
  useImperativeHandle11(ref, () => {
8195
8180
  return videoRef.current;
8196
8181
  }, []);
8197
- useEffect21(() => {
8182
+ useEffect20(() => {
8198
8183
  if (!window.remotion_videoEnabled) {
8199
8184
  return;
8200
8185
  }
@@ -8339,7 +8324,7 @@ var VideoForwardingFunction = (props2, ref) => {
8339
8324
  const { loop, ...propsOtherThanLoop } = props2;
8340
8325
  const { fps } = useVideoConfig();
8341
8326
  const environment = useRemotionEnvironment();
8342
- const { durations, setDurations } = useContext36(DurationsContext);
8327
+ const { durations, setDurations } = useContext35(DurationsContext);
8343
8328
  if (typeof ref === "string") {
8344
8329
  throw new Error("string refs are not supported");
8345
8330
  }
@@ -1,5 +1,5 @@
1
1
  // src/version.ts
2
- var VERSION = "4.0.380";
2
+ var VERSION = "4.0.382";
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.380",
6
+ "version": "4.0.382",
7
7
  "description": "Make videos programmatically",
8
8
  "main": "dist/cjs/index.js",
9
9
  "types": "dist/cjs/index.d.ts",
@@ -30,11 +30,11 @@
30
30
  "@happy-dom/global-registrator": "14.5.1",
31
31
  "@types/dom-webcodecs": "0.1.11",
32
32
  "happy-dom": "20.0.2",
33
- "react": "19.0.0",
34
- "react-dom": "19.0.0",
33
+ "react": "19.2.1",
34
+ "react-dom": "19.2.1",
35
35
  "webpack": "5.96.1",
36
36
  "zod": "3.22.3",
37
- "@remotion/eslint-config-internal": "4.0.380",
37
+ "@remotion/eslint-config-internal": "4.0.382",
38
38
  "eslint": "9.19.0"
39
39
  },
40
40
  "keywords": [