remotion 4.0.380 → 4.0.381

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
@@ -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.381";
@@ -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.381';
@@ -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.381";
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
@@ -3152,7 +3151,7 @@ var didPropChange = (key, newProp, prevProp) => {
3152
3151
  return true;
3153
3152
  };
3154
3153
  var SharedAudioContext = createContext16(null);
3155
- var SharedAudioContextProvider = ({ children, numberOfAudioTags, audioLatencyHint, component }) => {
3154
+ var SharedAudioContextProvider = ({ children, numberOfAudioTags, audioLatencyHint }) => {
3156
3155
  const audios = useRef5([]);
3157
3156
  const [initialNumberOfAudioTags] = useState11(numberOfAudioTags);
3158
3157
  if (numberOfAudioTags !== initialNumberOfAudioTags) {
@@ -3296,16 +3295,6 @@ var SharedAudioContextProvider = ({ children, numberOfAudioTags, audioLatencyHin
3296
3295
  updateAudio,
3297
3296
  audioContext
3298
3297
  ]);
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
3298
  return /* @__PURE__ */ jsxs(SharedAudioContext.Provider, {
3310
3299
  value,
3311
3300
  children: [
@@ -3556,7 +3545,7 @@ var useVolume = ({
3556
3545
  };
3557
3546
 
3558
3547
  // src/use-media-in-timeline.ts
3559
- import { useContext as useContext19, useEffect as useEffect7, useMemo as useMemo16, useState as useState12 } from "react";
3548
+ import { useContext as useContext19, useEffect as useEffect6, useMemo as useMemo16, useState as useState12 } from "react";
3560
3549
 
3561
3550
  // src/audio/use-audio-frame.ts
3562
3551
  import { useContext as useContext18 } from "react";
@@ -3654,7 +3643,7 @@ var useBasicMediaInTimeline = ({
3654
3643
  });
3655
3644
  }).join(",");
3656
3645
  }, [duration, startsAt, volume, mediaVolume]);
3657
- useEffect7(() => {
3646
+ useEffect6(() => {
3658
3647
  if (typeof volume === "number" && volume !== initialVolume) {
3659
3648
  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
3649
  }
@@ -3708,7 +3697,7 @@ var useMediaInTimeline = ({
3708
3697
  trimBefore: undefined,
3709
3698
  playbackRate
3710
3699
  });
3711
- useEffect7(() => {
3700
+ useEffect6(() => {
3712
3701
  if (!src) {
3713
3702
  throw new Error("No src passed");
3714
3703
  }
@@ -3769,7 +3758,7 @@ var useMediaInTimeline = ({
3769
3758
  import {
3770
3759
  useCallback as useCallback10,
3771
3760
  useContext as useContext22,
3772
- useEffect as useEffect11,
3761
+ useEffect as useEffect10,
3773
3762
  useLayoutEffect as useLayoutEffect7,
3774
3763
  useRef as useRef11
3775
3764
  } from "react";
@@ -3784,7 +3773,7 @@ import { useContext as useContext21, useMemo as useMemo18 } from "react";
3784
3773
  import React16, {
3785
3774
  useCallback as useCallback8,
3786
3775
  useContext as useContext20,
3787
- useEffect as useEffect8,
3776
+ useEffect as useEffect7,
3788
3777
  useLayoutEffect as useLayoutEffect6,
3789
3778
  useMemo as useMemo17,
3790
3779
  useRef as useRef8,
@@ -3826,7 +3815,7 @@ var useBufferManager = (logLevel, mountTime) => {
3826
3815
  }
3827
3816
  };
3828
3817
  }, []);
3829
- useEffect8(() => {
3818
+ useEffect7(() => {
3830
3819
  if (blocks.length > 0) {
3831
3820
  onBufferingCallbacks.forEach((c) => c());
3832
3821
  playbackLogging({
@@ -3865,7 +3854,7 @@ var BufferingProvider = ({ children }) => {
3865
3854
  };
3866
3855
  var useIsPlayerBuffering = (bufferManager) => {
3867
3856
  const [isBuffering, setIsBuffering] = useState13(bufferManager.buffering.current);
3868
- useEffect8(() => {
3857
+ useEffect7(() => {
3869
3858
  const onBuffer = () => {
3870
3859
  setIsBuffering(true);
3871
3860
  };
@@ -4034,7 +4023,7 @@ var seek = ({
4034
4023
  };
4035
4024
 
4036
4025
  // src/use-media-buffering.ts
4037
- import { useEffect as useEffect9, useState as useState14 } from "react";
4026
+ import { useEffect as useEffect8, useState as useState14 } from "react";
4038
4027
  var useMediaBuffering = ({
4039
4028
  element,
4040
4029
  shouldBuffer,
@@ -4046,7 +4035,7 @@ var useMediaBuffering = ({
4046
4035
  }) => {
4047
4036
  const buffer = useBufferState();
4048
4037
  const [isBuffering, setIsBuffering] = useState14(false);
4049
- useEffect9(() => {
4038
+ useEffect8(() => {
4050
4039
  let cleanupFns = [];
4051
4040
  const { current } = element;
4052
4041
  if (!current) {
@@ -4174,7 +4163,7 @@ var useMediaBuffering = ({
4174
4163
  };
4175
4164
 
4176
4165
  // src/use-request-video-callback-time.ts
4177
- import { useEffect as useEffect10, useRef as useRef10 } from "react";
4166
+ import { useEffect as useEffect9, useRef as useRef10 } from "react";
4178
4167
  var useRequestVideoCallbackTime = ({
4179
4168
  mediaRef,
4180
4169
  mediaType,
@@ -4182,7 +4171,7 @@ var useRequestVideoCallbackTime = ({
4182
4171
  onVariableFpsVideoDetected
4183
4172
  }) => {
4184
4173
  const currentTime = useRef10(null);
4185
- useEffect10(() => {
4174
+ useEffect9(() => {
4186
4175
  const { current } = mediaRef;
4187
4176
  if (current) {
4188
4177
  currentTime.current = {
@@ -4476,7 +4465,7 @@ var useMediaPlayback = ({
4476
4465
  return acceptableTimeshift ?? defaultAcceptableTimeshift;
4477
4466
  })();
4478
4467
  const isPlayerBuffering = useIsPlayerBuffering(buffering);
4479
- useEffect11(() => {
4468
+ useEffect10(() => {
4480
4469
  if (mediaRef.current?.paused) {
4481
4470
  return;
4482
4471
  }
@@ -4521,7 +4510,7 @@ var useMediaPlayback = ({
4521
4510
  mediaRef.current.playbackRate = playbackRateToSet;
4522
4511
  }
4523
4512
  }, [mediaRef, playbackRate]);
4524
- useEffect11(() => {
4513
+ useEffect10(() => {
4525
4514
  const tagName = mediaType === "audio" ? "<Html5Audio>" : "<Html5Video>";
4526
4515
  if (!mediaRef.current) {
4527
4516
  throw new Error(`No ${mediaType} ref found`);
@@ -4640,7 +4629,7 @@ var useMediaPlayback = ({
4640
4629
  };
4641
4630
 
4642
4631
  // src/use-media-tag.ts
4643
- import { useContext as useContext23, useEffect as useEffect12 } from "react";
4632
+ import { useContext as useContext23, useEffect as useEffect11 } from "react";
4644
4633
  var useMediaTag = ({
4645
4634
  mediaRef,
4646
4635
  id,
@@ -4653,7 +4642,7 @@ var useMediaTag = ({
4653
4642
  const logLevel = useLogLevel();
4654
4643
  const mountTime = useMountTime();
4655
4644
  const env = useRemotionEnvironment();
4656
- useEffect12(() => {
4645
+ useEffect11(() => {
4657
4646
  const tag = {
4658
4647
  id,
4659
4648
  play: (reason) => {
@@ -4870,7 +4859,7 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
4870
4859
  }, [audioRef]);
4871
4860
  const currentOnDurationCallback = useRef12(onDuration);
4872
4861
  currentOnDurationCallback.current = onDuration;
4873
- useEffect13(() => {
4862
+ useEffect12(() => {
4874
4863
  const { current } = audioRef;
4875
4864
  if (!current) {
4876
4865
  return;
@@ -4903,7 +4892,7 @@ var AudioForPreview = forwardRef4(AudioForDevelopmentForwardRefFunction);
4903
4892
  import {
4904
4893
  forwardRef as forwardRef5,
4905
4894
  useContext as useContext26,
4906
- useEffect as useEffect14,
4895
+ useEffect as useEffect13,
4907
4896
  useImperativeHandle as useImperativeHandle7,
4908
4897
  useLayoutEffect as useLayoutEffect8,
4909
4898
  useMemo as useMemo22,
@@ -4951,7 +4940,7 @@ var AudioForRenderingRefForwardingFunction = (props, ref) => {
4951
4940
  useImperativeHandle7(ref, () => {
4952
4941
  return audioRef.current;
4953
4942
  }, []);
4954
- useEffect14(() => {
4943
+ useEffect13(() => {
4955
4944
  if (!props.src) {
4956
4945
  throw new Error("No src passed");
4957
4946
  }
@@ -5158,11 +5147,11 @@ var Html5Audio = forwardRef6(AudioRefForwardingFunction);
5158
5147
  addSequenceStackTraces(Html5Audio);
5159
5148
  var Audio = Html5Audio;
5160
5149
  // src/Composition.tsx
5161
- import { Suspense, useContext as useContext29, useEffect as useEffect16 } from "react";
5150
+ import { Suspense, useContext as useContext29, useEffect as useEffect15 } from "react";
5162
5151
  import { createPortal } from "react-dom";
5163
5152
 
5164
5153
  // src/Folder.tsx
5165
- import { createContext as createContext18, useContext as useContext28, useEffect as useEffect15, useMemo as useMemo23 } from "react";
5154
+ import { createContext as createContext18, useContext as useContext28, useEffect as useEffect14, useMemo as useMemo23 } from "react";
5166
5155
 
5167
5156
  // src/validation/validate-folder-name.ts
5168
5157
  var getRegex = () => /^([a-zA-Z0-9-\u4E00-\u9FFF])+$/g;
@@ -5198,7 +5187,7 @@ var Folder = ({ name, children }) => {
5198
5187
  parentName
5199
5188
  };
5200
5189
  }, [name, parentName]);
5201
- useEffect15(() => {
5190
+ useEffect14(() => {
5202
5191
  registerFolder(name, parentName);
5203
5192
  return () => {
5204
5193
  unregisterFolder(name, parentName);
@@ -5353,7 +5342,7 @@ var validateDefaultAndInputProps = (defaultProps, name, compositionId) => {
5353
5342
  import { jsx as jsx23 } from "react/jsx-runtime";
5354
5343
  var Fallback = () => {
5355
5344
  const { continueRender: continueRender2, delayRender: delayRender2 } = useDelayRender();
5356
- useEffect16(() => {
5345
+ useEffect15(() => {
5357
5346
  const fallback = delayRender2("Waiting for Root component to unsuspend");
5358
5347
  return () => continueRender2(fallback);
5359
5348
  }, [continueRender2, delayRender2]);
@@ -5391,7 +5380,7 @@ var InnerComposition = ({
5391
5380
  throw new Error("<Composition> mounted inside another composition. See https://remotion.dev/docs/wrong-composition-mount for help.");
5392
5381
  }
5393
5382
  const { folderName, parentName } = useContext29(FolderContext);
5394
- useEffect16(() => {
5383
+ useEffect15(() => {
5395
5384
  if (!id) {
5396
5385
  throw new Error("No id for composition passed.");
5397
5386
  }
@@ -5430,7 +5419,7 @@ var InnerComposition = ({
5430
5419
  registerComposition,
5431
5420
  unregisterComposition
5432
5421
  ]);
5433
- useEffect16(() => {
5422
+ useEffect15(() => {
5434
5423
  window.dispatchEvent(new CustomEvent(PROPS_UPDATED_EXTERNALLY, {
5435
5424
  detail: {
5436
5425
  resetUnsaved: id
@@ -5438,7 +5427,7 @@ var InnerComposition = ({
5438
5427
  }));
5439
5428
  }, [defaultProps, id]);
5440
5429
  const resolved = useResolvedVideoConfig(id);
5441
- if (environment.isStudio && video && video.component === lazy) {
5430
+ if (environment.isStudio && video && video.component === lazy && video.id === id) {
5442
5431
  const Comp = lazy;
5443
5432
  if (resolved === null || resolved.type !== "success" && resolved.type !== "success-and-refreshing") {
5444
5433
  return null;
@@ -5452,7 +5441,7 @@ var InnerComposition = ({
5452
5441
  })
5453
5442
  }), portalNode());
5454
5443
  }
5455
- if (environment.isRendering && video && video.component === lazy) {
5444
+ if (environment.isRendering && video && video.component === lazy && video.id === id) {
5456
5445
  const Comp = lazy;
5457
5446
  if (resolved === null || resolved.type !== "success" && resolved.type !== "success-and-refreshing") {
5458
5447
  return null;
@@ -6093,7 +6082,7 @@ var waitForRoot = (fn) => {
6093
6082
  };
6094
6083
 
6095
6084
  // src/RemotionRoot.tsx
6096
- import { useContext as useContext32, useEffect as useEffect17, useMemo as useMemo27, useState as useState18 } from "react";
6085
+ import { useEffect as useEffect16, useMemo as useMemo27, useState as useState18 } from "react";
6097
6086
 
6098
6087
  // src/use-media-enabled.tsx
6099
6088
  import { createContext as createContext19, useContext as useContext31, useMemo as useMemo26 } from "react";
@@ -6159,7 +6148,7 @@ var RemotionRootContexts = ({
6159
6148
  }
6160
6149
  };
6161
6150
  }, []);
6162
- useEffect17(() => {
6151
+ useEffect16(() => {
6163
6152
  if (typeof __webpack_module__ !== "undefined") {
6164
6153
  if (__webpack_module__.hot) {
6165
6154
  __webpack_module__.hot.addStatusHandler((status) => {
@@ -6173,10 +6162,6 @@ var RemotionRootContexts = ({
6173
6162
  const logging = useMemo27(() => {
6174
6163
  return { logLevel, mountTime: Date.now() };
6175
6164
  }, [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
6165
  return /* @__PURE__ */ jsx28(LogLevelContext.Provider, {
6181
6166
  value: logging,
6182
6167
  children: /* @__PURE__ */ jsx28(NonceContext.Provider, {
@@ -6194,7 +6179,6 @@ var RemotionRootContexts = ({
6194
6179
  children: /* @__PURE__ */ jsx28(SharedAudioContextProvider, {
6195
6180
  numberOfAudioTags,
6196
6181
  audioLatencyHint,
6197
- component: composition?.component ?? null,
6198
6182
  children: /* @__PURE__ */ jsx28(DurationsContextProvider, {
6199
6183
  children: /* @__PURE__ */ jsx28(BufferingProvider, {
6200
6184
  children
@@ -6301,8 +6285,8 @@ import { useCallback as useCallback16 } from "react";
6301
6285
  // src/video/OffthreadVideoForRendering.tsx
6302
6286
  import {
6303
6287
  useCallback as useCallback15,
6304
- useContext as useContext33,
6305
- useEffect as useEffect18,
6288
+ useContext as useContext32,
6289
+ useEffect as useEffect17,
6306
6290
  useLayoutEffect as useLayoutEffect10,
6307
6291
  useMemo as useMemo28,
6308
6292
  useState as useState19
@@ -6343,9 +6327,9 @@ var OffthreadVideoForRendering = ({
6343
6327
  const frame = useCurrentFrame();
6344
6328
  const volumePropsFrame = useFrameForVolumeProp(loopVolumeCurveBehavior);
6345
6329
  const videoConfig = useUnsafeVideoConfig();
6346
- const sequenceContext = useContext33(SequenceContext);
6330
+ const sequenceContext = useContext32(SequenceContext);
6347
6331
  const mediaStartsAt = useMediaStartsAt();
6348
- const { registerRenderAsset, unregisterRenderAsset } = useContext33(RenderAssetManager);
6332
+ const { registerRenderAsset, unregisterRenderAsset } = useContext32(RenderAssetManager);
6349
6333
  if (!src) {
6350
6334
  throw new TypeError("No `src` was passed to <OffthreadVideo>.");
6351
6335
  }
@@ -6364,7 +6348,7 @@ var OffthreadVideoForRendering = ({
6364
6348
  mediaVolume: 1
6365
6349
  });
6366
6350
  warnAboutTooHighVolume(volume);
6367
- useEffect18(() => {
6351
+ useEffect17(() => {
6368
6352
  if (!src) {
6369
6353
  throw new Error("No src passed");
6370
6354
  }
@@ -6525,8 +6509,8 @@ var OffthreadVideoForRendering = ({
6525
6509
  // src/video/VideoForPreview.tsx
6526
6510
  import {
6527
6511
  forwardRef as forwardRef9,
6528
- useContext as useContext34,
6529
- useEffect as useEffect20,
6512
+ useContext as useContext33,
6513
+ useEffect as useEffect19,
6530
6514
  useImperativeHandle as useImperativeHandle10,
6531
6515
  useMemo as useMemo29,
6532
6516
  useRef as useRef16,
@@ -6534,12 +6518,12 @@ import {
6534
6518
  } from "react";
6535
6519
 
6536
6520
  // src/video/emit-video-frame.ts
6537
- import { useEffect as useEffect19 } from "react";
6521
+ import { useEffect as useEffect18 } from "react";
6538
6522
  var useEmitVideoFrame = ({
6539
6523
  ref,
6540
6524
  onVideoFrame
6541
6525
  }) => {
6542
- useEffect19(() => {
6526
+ useEffect18(() => {
6543
6527
  const { current } = ref;
6544
6528
  if (!current) {
6545
6529
  return;
@@ -6565,7 +6549,7 @@ var useEmitVideoFrame = ({
6565
6549
  // src/video/VideoForPreview.tsx
6566
6550
  import { jsx as jsx30 } from "react/jsx-runtime";
6567
6551
  var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
6568
- const context = useContext34(SharedAudioContext);
6552
+ const context = useContext33(SharedAudioContext);
6569
6553
  if (!context) {
6570
6554
  throw new Error("SharedAudioContext not found");
6571
6555
  }
@@ -6613,8 +6597,8 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
6613
6597
  }
6614
6598
  const volumePropFrame = useFrameForVolumeProp(loopVolumeCurveBehavior ?? "repeat");
6615
6599
  const { fps, durationInFrames } = useVideoConfig();
6616
- const parentSequence = useContext34(SequenceContext);
6617
- const { hidden } = useContext34(SequenceVisibilityToggleContext);
6600
+ const parentSequence = useContext33(SequenceContext);
6601
+ const { hidden } = useContext33(SequenceVisibilityToggleContext);
6618
6602
  const logLevel = useLogLevel();
6619
6603
  const mountTime = useMountTime();
6620
6604
  const [timelineId] = useState20(() => String(Math.random()));
@@ -6689,7 +6673,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
6689
6673
  tag: "video",
6690
6674
  mountTime
6691
6675
  }));
6692
- useEffect20(() => {
6676
+ useEffect19(() => {
6693
6677
  const { current } = videoRef;
6694
6678
  if (!current) {
6695
6679
  return;
@@ -6720,7 +6704,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
6720
6704
  const currentOnDurationCallback = useRef16(onDuration);
6721
6705
  currentOnDurationCallback.current = onDuration;
6722
6706
  useEmitVideoFrame({ ref: videoRef, onVideoFrame });
6723
- useEffect20(() => {
6707
+ useEffect19(() => {
6724
6708
  const { current } = videoRef;
6725
6709
  if (!current) {
6726
6710
  return;
@@ -6737,7 +6721,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
6737
6721
  current.removeEventListener("loadedmetadata", onLoadedMetadata);
6738
6722
  };
6739
6723
  }, [src]);
6740
- useEffect20(() => {
6724
+ useEffect19(() => {
6741
6725
  const { current } = videoRef;
6742
6726
  if (!current) {
6743
6727
  return;
@@ -7970,13 +7954,13 @@ var Still = (props2) => {
7970
7954
  return React36.createElement(Composition, newProps);
7971
7955
  };
7972
7956
  // src/video/Video.tsx
7973
- import { forwardRef as forwardRef12, useCallback as useCallback17, useContext as useContext36 } from "react";
7957
+ import { forwardRef as forwardRef12, useCallback as useCallback17, useContext as useContext35 } from "react";
7974
7958
 
7975
7959
  // src/video/VideoForRendering.tsx
7976
7960
  import {
7977
7961
  forwardRef as forwardRef11,
7978
- useContext as useContext35,
7979
- useEffect as useEffect21,
7962
+ useContext as useContext34,
7963
+ useEffect as useEffect20,
7980
7964
  useImperativeHandle as useImperativeHandle11,
7981
7965
  useLayoutEffect as useLayoutEffect11,
7982
7966
  useMemo as useMemo32,
@@ -8129,13 +8113,13 @@ var VideoForRenderingForwardFunction = ({
8129
8113
  const volumePropsFrame = useFrameForVolumeProp(loopVolumeCurveBehavior ?? "repeat");
8130
8114
  const videoConfig = useUnsafeVideoConfig();
8131
8115
  const videoRef = useRef17(null);
8132
- const sequenceContext = useContext35(SequenceContext);
8116
+ const sequenceContext = useContext34(SequenceContext);
8133
8117
  const mediaStartsAt = useMediaStartsAt();
8134
8118
  const environment = useRemotionEnvironment();
8135
8119
  const logLevel = useLogLevel();
8136
8120
  const mountTime = useMountTime();
8137
8121
  const { delayRender: delayRender2, continueRender: continueRender2 } = useDelayRender();
8138
- const { registerRenderAsset, unregisterRenderAsset } = useContext35(RenderAssetManager);
8122
+ const { registerRenderAsset, unregisterRenderAsset } = useContext34(RenderAssetManager);
8139
8123
  const id = useMemo32(() => `video-${random(props2.src ?? "")}-${sequenceContext?.cumulatedFrom}-${sequenceContext?.relativeFrom}-${sequenceContext?.durationInFrames}`, [
8140
8124
  props2.src,
8141
8125
  sequenceContext?.cumulatedFrom,
@@ -8151,7 +8135,7 @@ var VideoForRenderingForwardFunction = ({
8151
8135
  mediaVolume: 1
8152
8136
  });
8153
8137
  warnAboutTooHighVolume(volume);
8154
- useEffect21(() => {
8138
+ useEffect20(() => {
8155
8139
  if (!props2.src) {
8156
8140
  throw new Error("No src passed");
8157
8141
  }
@@ -8194,7 +8178,7 @@ var VideoForRenderingForwardFunction = ({
8194
8178
  useImperativeHandle11(ref, () => {
8195
8179
  return videoRef.current;
8196
8180
  }, []);
8197
- useEffect21(() => {
8181
+ useEffect20(() => {
8198
8182
  if (!window.remotion_videoEnabled) {
8199
8183
  return;
8200
8184
  }
@@ -8339,7 +8323,7 @@ var VideoForwardingFunction = (props2, ref) => {
8339
8323
  const { loop, ...propsOtherThanLoop } = props2;
8340
8324
  const { fps } = useVideoConfig();
8341
8325
  const environment = useRemotionEnvironment();
8342
- const { durations, setDurations } = useContext36(DurationsContext);
8326
+ const { durations, setDurations } = useContext35(DurationsContext);
8343
8327
  if (typeof ref === "string") {
8344
8328
  throw new Error("string refs are not supported");
8345
8329
  }
@@ -1,5 +1,5 @@
1
1
  // src/version.ts
2
- var VERSION = "4.0.380";
2
+ var VERSION = "4.0.381";
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.381",
7
7
  "description": "Make videos programmatically",
8
8
  "main": "dist/cjs/index.js",
9
9
  "types": "dist/cjs/index.d.ts",
@@ -34,7 +34,7 @@
34
34
  "react-dom": "19.0.0",
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.381",
38
38
  "eslint": "9.19.0"
39
39
  },
40
40
  "keywords": [