@remotion/media 4.0.507 → 4.0.509

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.
@@ -40,7 +40,7 @@ var __callDispose = (stack, error, hasError) => {
40
40
  import { useMemo as useMemo3, useState as useState3 } from "react";
41
41
  import {
42
42
  Freeze,
43
- Internals as Internals17,
43
+ Internals as Internals18,
44
44
  Interactive,
45
45
  Sequence,
46
46
  useRemotionEnvironment as useRemotionEnvironment2,
@@ -78,7 +78,7 @@ var getLoopDisplay = ({
78
78
  // src/audio/audio-for-preview.tsx
79
79
  import { useContext as useContext2, useEffect, useMemo, useRef, useState } from "react";
80
80
  import {
81
- Internals as Internals7,
81
+ Internals as Internals8,
82
82
  Audio as RemotionAudio,
83
83
  useBufferState,
84
84
  useCurrentFrame,
@@ -137,7 +137,7 @@ var calculateEndTime = ({
137
137
  };
138
138
 
139
139
  // src/media-player.ts
140
- import { Internals as Internals5 } from "remotion";
140
+ import { Internals as Internals6 } from "remotion";
141
141
 
142
142
  // src/audio-iterator-manager.ts
143
143
  import {
@@ -868,6 +868,51 @@ var getDurationOrCompute = async (input) => {
868
868
  // src/get-shared-input.ts
869
869
  import { ALL_FORMATS, Input, UrlSource } from "mediabunny";
870
870
 
871
+ // src/max-cache-size.ts
872
+ import { cancelRender, Internals as Internals4 } from "remotion";
873
+ var getUncachedMaxCacheSize = (logLevel) => {
874
+ if (typeof window !== "undefined" && window.remotion_mediaCacheSizeInBytes !== undefined && window.remotion_mediaCacheSizeInBytes !== null) {
875
+ if (window.remotion_mediaCacheSizeInBytes < 240 * 1024 * 1024) {
876
+ cancelRender(new Error(`The minimum value for the "mediaCacheSizeInBytes" prop is 240MB (${240 * 1024 * 1024}), got: ${window.remotion_mediaCacheSizeInBytes}`));
877
+ }
878
+ if (window.remotion_mediaCacheSizeInBytes > 20000 * 1024 * 1024) {
879
+ cancelRender(new Error(`The maximum value for the "mediaCacheSizeInBytes" prop is 20GB (${20000 * 1024 * 1024}), got: ${window.remotion_mediaCacheSizeInBytes}`));
880
+ }
881
+ Internals4.Log.verbose({ logLevel, tag: "@remotion/media" }, `Using cache size set using "mediaCacheSizeInBytes": ${(window.remotion_mediaCacheSizeInBytes / 1024 / 1024).toFixed(1)} MB`);
882
+ return window.remotion_mediaCacheSizeInBytes;
883
+ }
884
+ if (typeof window !== "undefined" && window.remotion_initialMemoryAvailable !== undefined && window.remotion_initialMemoryAvailable !== null) {
885
+ const value = window.remotion_initialMemoryAvailable / 2;
886
+ if (value < 500 * 1024 * 1024) {
887
+ Internals4.Log.verbose({ logLevel, tag: "@remotion/media" }, `Using cache size set based on minimum value of 500MB (which is more than half of the available system memory!)`);
888
+ return 500 * 1024 * 1024;
889
+ }
890
+ if (value > 20000 * 1024 * 1024) {
891
+ Internals4.Log.verbose({ logLevel, tag: "@remotion/media" }, `Using cache size set based on maximum value of 20GB (which is less than half of the available system memory)`);
892
+ return 20000 * 1024 * 1024;
893
+ }
894
+ Internals4.Log.verbose({ logLevel, tag: "@remotion/media" }, `Using cache size set based on available memory (50% of available memory): ${(value / 1024 / 1024).toFixed(1)} MB`);
895
+ return value;
896
+ }
897
+ return 1000 * 1000 * 1000;
898
+ };
899
+ var cachedMaxCacheSize = null;
900
+ var getMaxVideoCacheSize = (logLevel) => {
901
+ if (cachedMaxCacheSize !== null) {
902
+ return cachedMaxCacheSize;
903
+ }
904
+ cachedMaxCacheSize = getUncachedMaxCacheSize(logLevel);
905
+ return cachedMaxCacheSize;
906
+ };
907
+ var MIN_SOURCE_CACHE_SIZE = 8 * 1024 * 1024;
908
+ var MAX_SOURCE_CACHE_SIZE = 64 * 1024 * 1024;
909
+ var getMaxSourceCacheSizeFromBudget = (budget) => {
910
+ return Math.min(MAX_SOURCE_CACHE_SIZE, Math.max(MIN_SOURCE_CACHE_SIZE, Math.floor(budget / 16)));
911
+ };
912
+ var getMaxSourceCacheSize = (logLevel) => {
913
+ return getMaxSourceCacheSizeFromBudget(getMaxVideoCacheSize(logLevel));
914
+ };
915
+
871
916
  // src/request-init.ts
872
917
  var normalizeMediaHeaders = (headers) => {
873
918
  if (!headers) {
@@ -950,7 +995,8 @@ var getSharedInputCacheKey = ({
950
995
  var acquireSharedInput = ({
951
996
  src,
952
997
  credentials,
953
- requestInit
998
+ requestInit,
999
+ logLevel
954
1000
  }) => {
955
1001
  const normalizedRequestInit = normalizeMediaRequestInit(requestInit);
956
1002
  const cacheKey = getSharedInputCacheKey({
@@ -968,7 +1014,10 @@ var acquireSharedInput = ({
968
1014
  requestInit: normalizedRequestInit
969
1015
  });
970
1016
  const input = new Input({
971
- source: new UrlSource(src, resolvedRequestInit ? { requestInit: resolvedRequestInit } : undefined),
1017
+ source: new UrlSource(src, {
1018
+ maxCacheSize: getMaxSourceCacheSize(logLevel),
1019
+ ...resolvedRequestInit ? { requestInit: resolvedRequestInit } : undefined
1020
+ }),
972
1021
  formats: ALL_FORMATS
973
1022
  });
974
1023
  sharedInputs[cacheKey] = { input, refCount: 1 };
@@ -1107,7 +1156,7 @@ class PremountAwareDelayPlayback {
1107
1156
 
1108
1157
  // src/video-iterator-manager.ts
1109
1158
  import { CanvasSink } from "mediabunny";
1110
- import { Internals as Internals4 } from "remotion";
1159
+ import { Internals as Internals5 } from "remotion";
1111
1160
 
1112
1161
  // src/helpers/round-to-4-digits.ts
1113
1162
  var roundTo4Digits = (timestamp) => {
@@ -1517,7 +1566,7 @@ var createVideoIterator = async (timeToSeek, cache) => {
1517
1566
  };
1518
1567
 
1519
1568
  // src/video-iterator-manager.ts
1520
- var { runEffectChain } = Internals4;
1569
+ var { runEffectChain } = Internals5;
1521
1570
  var isSequentialMediaTimeAdvance = ({
1522
1571
  previousTime,
1523
1572
  newTime,
@@ -1596,7 +1645,7 @@ var videoIteratorManager = async ({
1596
1645
  if (callback) {
1597
1646
  callback(frame.canvas);
1598
1647
  }
1599
- Internals4.Log.trace({ logLevel, tag: "@remotion/media" }, `[MediaPlayer] Drew frame ${frame.timestamp.toFixed(3)}s`);
1648
+ Internals5.Log.trace({ logLevel, tag: "@remotion/media" }, `[MediaPlayer] Drew frame ${frame.timestamp.toFixed(3)}s`);
1600
1649
  };
1601
1650
  const redrawCurrentFrame = async () => {
1602
1651
  if (!lastDrawnFrame) {
@@ -1608,7 +1657,7 @@ var videoIteratorManager = async ({
1608
1657
  if (callback) {
1609
1658
  callback(lastDrawnFrame.canvas);
1610
1659
  }
1611
- Internals4.Log.trace({ logLevel, tag: "@remotion/media" }, `[MediaPlayer] Redrew frame ${lastDrawnFrame.timestamp.toFixed(3)}s with updated effects`);
1660
+ Internals5.Log.trace({ logLevel, tag: "@remotion/media" }, `[MediaPlayer] Redrew frame ${lastDrawnFrame.timestamp.toFixed(3)}s with updated effects`);
1612
1661
  };
1613
1662
  const startVideoIterator = async (timeToSeek, nonce) => {
1614
1663
  let __stack = [];
@@ -1786,7 +1835,8 @@ class MediaPlayer {
1786
1835
  const { input, cacheKey } = acquireSharedInput({
1787
1836
  src: this.src,
1788
1837
  credentials,
1789
- requestInit
1838
+ requestInit,
1839
+ logLevel
1790
1840
  });
1791
1841
  this.input = input;
1792
1842
  this.inputCacheKey = cacheKey;
@@ -1795,8 +1845,7 @@ class MediaPlayer {
1795
1845
  this.getEffectChainState = getEffectChainState;
1796
1846
  if (canvas) {
1797
1847
  const context = canvas.getContext("2d", {
1798
- alpha: true,
1799
- desynchronized: true
1848
+ alpha: true
1800
1849
  });
1801
1850
  if (!context) {
1802
1851
  throw new Error("Could not get 2D context from canvas");
@@ -1858,7 +1907,7 @@ class MediaPlayer {
1858
1907
  if (isNetworkError(err)) {
1859
1908
  throw error;
1860
1909
  }
1861
- Internals5.Log.error({ logLevel: this.logLevel, tag: "@remotion/media" }, `[MediaPlayer] Failed to recognize format for ${this.src}`, error);
1910
+ Internals6.Log.error({ logLevel: this.logLevel, tag: "@remotion/media" }, `[MediaPlayer] Failed to recognize format for ${this.src}`, error);
1862
1911
  return { type: "unknown-container-format" };
1863
1912
  }
1864
1913
  const [durationInSeconds, videoTrack, audioTracks] = await Promise.all([
@@ -1968,16 +2017,16 @@ class MediaPlayer {
1968
2017
  if (this.isDisposalError()) {
1969
2018
  return { type: "disposed" };
1970
2019
  }
1971
- Internals5.Log.error({ logLevel: this.logLevel, tag: "@remotion/media" }, "[MediaPlayer] Failed to start audio and video iterators", error);
2020
+ Internals6.Log.error({ logLevel: this.logLevel, tag: "@remotion/media" }, "[MediaPlayer] Failed to start audio and video iterators", error);
1972
2021
  }
1973
2022
  return { type: "success", durationInSeconds };
1974
2023
  } catch (error) {
1975
2024
  const err = error;
1976
2025
  if (isNetworkError(err)) {
1977
- Internals5.Log.error({ logLevel: this.logLevel, tag: "@remotion/media" }, `[MediaPlayer] Network/CORS error for ${this.src}`, err);
2026
+ Internals6.Log.error({ logLevel: this.logLevel, tag: "@remotion/media" }, `[MediaPlayer] Network/CORS error for ${this.src}`, err);
1978
2027
  return { type: "network-error" };
1979
2028
  }
1980
- Internals5.Log.error({ logLevel: this.logLevel, tag: "@remotion/media" }, "[MediaPlayer] Failed to initialize", error);
2029
+ Internals6.Log.error({ logLevel: this.logLevel, tag: "@remotion/media" }, "[MediaPlayer] Failed to initialize", error);
1981
2030
  throw error;
1982
2031
  }
1983
2032
  } catch (_catch) {
@@ -2273,7 +2322,7 @@ var callOnErrorAndResolve = ({
2273
2322
 
2274
2323
  // src/use-common-effects.ts
2275
2324
  import { useContext, useLayoutEffect } from "react";
2276
- import { Internals as Internals6 } from "remotion";
2325
+ import { Internals as Internals7 } from "remotion";
2277
2326
  var useCommonEffects = ({
2278
2327
  mediaPlayerRef,
2279
2328
  mediaPlayerReady,
@@ -2297,7 +2346,7 @@ var useCommonEffects = ({
2297
2346
  logLevel,
2298
2347
  label
2299
2348
  }) => {
2300
- const sharedAudioContext = useContext(Internals6.SharedAudioContext);
2349
+ const sharedAudioContext = useContext(Internals7.SharedAudioContext);
2301
2350
  useLayoutEffect(() => {
2302
2351
  const mediaPlayer = mediaPlayerRef.current;
2303
2352
  if (!mediaPlayer)
@@ -2415,7 +2464,7 @@ var useCommonEffects = ({
2415
2464
  if (!mediaPlayer || !mediaPlayerReady)
2416
2465
  return;
2417
2466
  mediaPlayer.seekTo(currentTime).catch(() => {});
2418
- Internals6.Log.trace({ logLevel, tag: "@remotion/media" }, `[${label}] Updating target time to ${currentTime.toFixed(3)}s`);
2467
+ Internals7.Log.trace({ logLevel, tag: "@remotion/media" }, `[${label}] Updating target time to ${currentTime.toFixed(3)}s`);
2419
2468
  }, [currentTime, logLevel, mediaPlayerReady, label, mediaPlayerRef]);
2420
2469
  };
2421
2470
 
@@ -2432,7 +2481,7 @@ var {
2432
2481
  warnAboutTooHighVolume,
2433
2482
  usePreload,
2434
2483
  SequenceContext
2435
- } = Internals7;
2484
+ } = Internals8;
2436
2485
  var AudioForPreviewAssertedShowing = ({
2437
2486
  src,
2438
2487
  playbackRate,
@@ -2465,7 +2514,7 @@ var AudioForPreviewAssertedShowing = ({
2465
2514
  const [mediaPlayerReady, setMediaPlayerReady] = useState(false);
2466
2515
  const [shouldFallbackToNativeAudio, setShouldFallbackToNativeAudio] = useState(false);
2467
2516
  const [playing] = Timeline.usePlayingState();
2468
- const { playbackRate: globalPlaybackRate } = Internals7.usePlaybackRate();
2517
+ const { playbackRate: globalPlaybackRate } = Internals8.usePlaybackRate();
2469
2518
  const sharedAudioContext = useContext2(SharedAudioContext);
2470
2519
  const buffer = useBufferState();
2471
2520
  const [playerMuted] = usePlayerMutedState();
@@ -2491,12 +2540,12 @@ var AudioForPreviewAssertedShowing = ({
2491
2540
  const isPremounting = Boolean(parentSequence?.premounting);
2492
2541
  const isPostmounting = Boolean(parentSequence?.postmounting);
2493
2542
  const sequenceOffset = (parentSequence?.absoluteFrom ?? 0) / videoConfig.fps;
2494
- const bufferingContext = useContext2(Internals7.BufferingContextReact);
2543
+ const bufferingContext = useContext2(Internals8.BufferingContextReact);
2495
2544
  if (!bufferingContext) {
2496
2545
  throw new Error("useMediaPlayback must be used inside a <BufferingContext>");
2497
2546
  }
2498
2547
  const effectiveMuted = muted || playerMuted || userPreferredVolume <= 0;
2499
- const isPlayerBuffering = Internals7.useIsPlayerBuffering(bufferingContext);
2548
+ const isPlayerBuffering = Internals8.useIsPlayerBuffering(bufferingContext);
2500
2549
  const initialPlaying = useRef(playing && !isPlayerBuffering);
2501
2550
  const initialIsPremounting = useRef(isPremounting);
2502
2551
  const initialIsPostmounting = useRef(isPostmounting);
@@ -2592,7 +2641,7 @@ var AudioForPreviewAssertedShowing = ({
2592
2641
  if (action === "fail") {
2593
2642
  throw errorToUse;
2594
2643
  } else {
2595
- Internals7.Log.warn({ logLevel, tag: "@remotion/media" }, fallbackMessage);
2644
+ Internals8.Log.warn({ logLevel, tag: "@remotion/media" }, fallbackMessage);
2596
2645
  setShouldFallbackToNativeAudio(true);
2597
2646
  }
2598
2647
  };
@@ -2618,7 +2667,7 @@ var AudioForPreviewAssertedShowing = ({
2618
2667
  if (result.type === "success") {
2619
2668
  setMediaPlayerReady(true);
2620
2669
  setMediaDurationInSeconds(result.durationInSeconds);
2621
- Internals7.Log.trace({ logLevel, tag: "@remotion/media" }, `[AudioForPreview] MediaPlayer initialized successfully`);
2670
+ Internals8.Log.trace({ logLevel, tag: "@remotion/media" }, `[AudioForPreview] MediaPlayer initialized successfully`);
2622
2671
  }
2623
2672
  }).catch((error) => {
2624
2673
  const [action, errorToUse] = callOnErrorAndResolve({
@@ -2631,7 +2680,7 @@ var AudioForPreviewAssertedShowing = ({
2631
2680
  if (action === "fail") {
2632
2681
  throw errorToUse;
2633
2682
  } else {
2634
- Internals7.Log.error({ logLevel, tag: "@remotion/media" }, "[AudioForPreview] Failed to initialize MediaPlayer", error);
2683
+ Internals8.Log.error({ logLevel, tag: "@remotion/media" }, "[AudioForPreview] Failed to initialize MediaPlayer", error);
2635
2684
  setShouldFallbackToNativeAudio(true);
2636
2685
  }
2637
2686
  });
@@ -2646,12 +2695,12 @@ var AudioForPreviewAssertedShowing = ({
2646
2695
  if (action === "fail") {
2647
2696
  throw errorToUse;
2648
2697
  }
2649
- Internals7.Log.error({ logLevel, tag: "@remotion/media" }, "[AudioForPreview] MediaPlayer initialization failed", errorToUse);
2698
+ Internals8.Log.error({ logLevel, tag: "@remotion/media" }, "[AudioForPreview] MediaPlayer initialization failed", errorToUse);
2650
2699
  setShouldFallbackToNativeAudio(true);
2651
2700
  }
2652
2701
  return () => {
2653
2702
  if (mediaPlayerRef.current) {
2654
- Internals7.Log.trace({ logLevel, tag: "@remotion/media" }, `[AudioForPreview] Disposing MediaPlayer`);
2703
+ Internals8.Log.trace({ logLevel, tag: "@remotion/media" }, `[AudioForPreview] Disposing MediaPlayer`);
2655
2704
  mediaPlayerRef.current.dispose();
2656
2705
  mediaPlayerRef.current = null;
2657
2706
  }
@@ -2719,7 +2768,7 @@ var AudioForPreview = ({
2719
2768
  style
2720
2769
  }) => {
2721
2770
  const preloadedSrc = usePreload(src);
2722
- const defaultLogLevel = Internals7.useLogLevel();
2771
+ const defaultLogLevel = Internals8.useLogLevel();
2723
2772
  const frame = useCurrentFrame();
2724
2773
  const videoConfig = useVideoConfig();
2725
2774
  const currentTime = frame / videoConfig.fps;
@@ -2780,7 +2829,7 @@ import { useContext as useContext3, useLayoutEffect as useLayoutEffect2, useMemo
2780
2829
  import {
2781
2830
  cancelRender as cancelRender2,
2782
2831
  Html5Audio,
2783
- Internals as Internals16,
2832
+ Internals as Internals17,
2784
2833
  random,
2785
2834
  useCurrentFrame as useCurrentFrame2,
2786
2835
  useDelayRender,
@@ -2789,15 +2838,42 @@ import {
2789
2838
 
2790
2839
  // src/caches.ts
2791
2840
  import React2 from "react";
2792
- import { cancelRender, Internals as Internals14 } from "remotion";
2841
+ import { Internals as Internals15 } from "remotion";
2793
2842
 
2794
2843
  // src/audio-extraction/audio-manager.ts
2795
- import { Internals as Internals9 } from "remotion";
2844
+ import { Internals as Internals10 } from "remotion";
2845
+
2846
+ // src/serialized-queue.ts
2847
+ var makeSerializedQueue = () => {
2848
+ let tail = Promise.resolve(undefined);
2849
+ return (fn) => {
2850
+ const result = tail.then(() => fn());
2851
+ tail = result.then(() => {
2852
+ return;
2853
+ }, () => {
2854
+ return;
2855
+ });
2856
+ return result;
2857
+ };
2858
+ };
2796
2859
 
2797
2860
  // src/audio-extraction/audio-iterator.ts
2798
- import { Internals as Internals8 } from "remotion";
2861
+ import { Internals as Internals9 } from "remotion";
2799
2862
 
2800
2863
  // src/audio-extraction/audio-cache.ts
2864
+ var BYTES_PER_SAMPLE = {
2865
+ u8: 1,
2866
+ s16: 2,
2867
+ s32: 4,
2868
+ f32: 4,
2869
+ "u8-planar": 1,
2870
+ "s16-planar": 2,
2871
+ "s32-planar": 4,
2872
+ "f32-planar": 4
2873
+ };
2874
+ var getAudioSampleByteSize = (sample) => {
2875
+ return sample.numberOfFrames * sample.numberOfChannels * BYTES_PER_SAMPLE[sample.format];
2876
+ };
2801
2877
  var makeAudioCache = () => {
2802
2878
  const timestamps = [];
2803
2879
  const samples = {};
@@ -2844,6 +2920,13 @@ var makeAudioCache = () => {
2844
2920
  const getOpenTimestamps = () => {
2845
2921
  return timestamps;
2846
2922
  };
2923
+ const getTotalSize = () => {
2924
+ let total = 0;
2925
+ for (const timestamp of timestamps) {
2926
+ total += getAudioSampleByteSize(samples[timestamp]);
2927
+ }
2928
+ return total;
2929
+ };
2847
2930
  const getOldestTimestamp = () => {
2848
2931
  return timestamps[0];
2849
2932
  };
@@ -2861,7 +2944,8 @@ var makeAudioCache = () => {
2861
2944
  getSamples,
2862
2945
  getOldestTimestamp,
2863
2946
  getNewestTimestamp,
2864
- getOpenTimestamps
2947
+ getOpenTimestamps,
2948
+ getTotalSize
2865
2949
  };
2866
2950
  };
2867
2951
 
@@ -2874,7 +2958,7 @@ var warnAboutMatroskaOnce = (src, logLevel) => {
2874
2958
  return;
2875
2959
  }
2876
2960
  warned[src] = true;
2877
- Internals8.Log.warn({ logLevel, tag: "@remotion/media" }, `Audio from ${src} will need to be read from the beginning. https://www.remotion.dev/docs/media/support#matroska-limitation`);
2961
+ Internals9.Log.warn({ logLevel, tag: "@remotion/media" }, `Audio from ${src} will need to be read from the beginning. https://www.remotion.dev/docs/media/support#matroska-limitation`);
2878
2962
  };
2879
2963
  var makeAudioIterator2 = ({
2880
2964
  audioSampleSink,
@@ -2942,13 +3026,13 @@ var makeAudioIterator2 = ({
2942
3026
  if (openTimestamps.length > 0) {
2943
3027
  const first = openTimestamps[0];
2944
3028
  const last = openTimestamps[openTimestamps.length - 1];
2945
- Internals8.Log.verbose({ logLevel, tag: "@remotion/media" }, "Open audio samples for src", src, `${first.toFixed(3)}...${last.toFixed(3)}`);
3029
+ Internals9.Log.verbose({ logLevel, tag: "@remotion/media" }, "Open audio samples for src", src, `${first.toFixed(3)}...${last.toFixed(3)}`);
2946
3030
  }
2947
3031
  };
2948
3032
  const getCacheStats = () => {
2949
3033
  return {
2950
3034
  count: cache.getOpenTimestamps().length,
2951
- size: cache.getOpenTimestamps().reduce((acc, t) => acc + t, 0)
3035
+ size: cache.getTotalSize()
2952
3036
  };
2953
3037
  };
2954
3038
  const canSatisfyRequestedTime = (timestamp) => {
@@ -3042,7 +3126,7 @@ var makeAudioManager = ({
3042
3126
  if (seenKeys.has(key)) {
3043
3127
  iterator.prepareForDeletion();
3044
3128
  iterators.splice(iterators.indexOf(iterator), 1);
3045
- Internals9.Log.verbose({ logLevel, tag: "@remotion/media" }, `Deleted duplicate iterator for ${iterator.src}`);
3129
+ Internals10.Log.verbose({ logLevel, tag: "@remotion/media" }, `Deleted duplicate iterator for ${iterator.src}`);
3046
3130
  }
3047
3131
  seenKeys.add(key);
3048
3132
  }
@@ -3066,7 +3150,7 @@ var makeAudioManager = ({
3066
3150
  attempts++;
3067
3151
  }
3068
3152
  if ((await getTotalCacheStats()).totalSize > maxCacheSize && attempts >= maxAttempts) {
3069
- Internals9.Log.warn({ logLevel, tag: "@remotion/media" }, `Audio cache: Exceeded max cache size after ${maxAttempts} attempts. Still ${(await getTotalCacheStats()).totalSize} bytes used, target was ${maxCacheSize} bytes.`);
3153
+ Internals10.Log.warn({ logLevel, tag: "@remotion/media" }, `Audio cache: Exceeded max cache size after ${maxAttempts} attempts. Still ${(await getTotalCacheStats()).totalSize} bytes used, target was ${maxCacheSize} bytes.`);
3070
3154
  }
3071
3155
  for (const iterator of iterators) {
3072
3156
  if (iterator.src === src && await iterator.waitForCompletion() && iterator.canSatisfyRequestedTime(timeInSeconds)) {
@@ -3121,7 +3205,7 @@ var makeAudioManager = ({
3121
3205
  disposed = true;
3122
3206
  clearAll();
3123
3207
  };
3124
- let queue = Promise.resolve(undefined);
3208
+ const enqueue = makeSerializedQueue();
3125
3209
  return {
3126
3210
  getIterator: ({
3127
3211
  src,
@@ -3132,7 +3216,7 @@ var makeAudioManager = ({
3132
3216
  logLevel,
3133
3217
  maxCacheSize
3134
3218
  }) => {
3135
- queue = queue.then(() => getIterator({
3219
+ return enqueue(() => getIterator({
3136
3220
  src,
3137
3221
  timeInSeconds,
3138
3222
  audioSampleSink,
@@ -3141,7 +3225,6 @@ var makeAudioManager = ({
3141
3225
  logLevel,
3142
3226
  maxCacheSize
3143
3227
  }));
3144
- return queue;
3145
3228
  },
3146
3229
  getCacheStats,
3147
3230
  getIteratorMostInThePast,
@@ -3153,7 +3236,7 @@ var makeAudioManager = ({
3153
3236
  };
3154
3237
 
3155
3238
  // src/get-sink.ts
3156
- import { Internals as Internals11 } from "remotion";
3239
+ import { Internals as Internals12 } from "remotion";
3157
3240
 
3158
3241
  // src/video-extraction/get-frames-since-keyframe.ts
3159
3242
  import {
@@ -3166,7 +3249,7 @@ import {
3166
3249
  VideoSampleSink,
3167
3250
  WEBM
3168
3251
  } from "mediabunny";
3169
- import { Internals as Internals10 } from "remotion";
3252
+ import { Internals as Internals11 } from "remotion";
3170
3253
 
3171
3254
  // src/browser-can-use-webgl2.ts
3172
3255
  var browserCanUseWebGl2 = null;
@@ -3224,6 +3307,7 @@ var makeSinks = (src, logLevel, credentials, requestInit) => {
3224
3307
  formats: ALL_FORMATS2,
3225
3308
  source: new UrlSource2(src, {
3226
3309
  getRetryDelay,
3310
+ maxCacheSize: getMaxSourceCacheSize(logLevel),
3227
3311
  ...resolvedRequestInit ? { requestInit: resolvedRequestInit } : undefined
3228
3312
  })
3229
3313
  });
@@ -3261,7 +3345,7 @@ var makeSinks = (src, logLevel, credentials, requestInit) => {
3261
3345
  });
3262
3346
  const hasAlpha = startPacket?.sideData.alpha;
3263
3347
  if (hasAlpha && !canBrowserUseWebGl2()) {
3264
- Internals10.Log.warn({ logLevel, tag: "@remotion/media" }, `WebGL2 is not available, using the non-fast CPU path to decode alpha for ${src}.`);
3348
+ Internals11.Log.warn({ logLevel, tag: "@remotion/media" }, `WebGL2 is not available, using the non-fast CPU path to decode alpha for ${src}.`);
3265
3349
  }
3266
3350
  return {
3267
3351
  sampleSink
@@ -3354,7 +3438,7 @@ var makeSinkManager = () => {
3354
3438
  });
3355
3439
  let promise = sinkPromises[cacheKey];
3356
3440
  if (!promise) {
3357
- Internals11.Log.verbose({
3441
+ Internals12.Log.verbose({
3358
3442
  logLevel,
3359
3443
  tag: "@remotion/media"
3360
3444
  }, `Sink for ${src} was not found, creating new sink`);
@@ -3389,7 +3473,7 @@ var makeSinkManager = () => {
3389
3473
  };
3390
3474
 
3391
3475
  // src/video-extraction/keyframe-manager.ts
3392
- import { Internals as Internals13 } from "remotion";
3476
+ import { Internals as Internals14 } from "remotion";
3393
3477
 
3394
3478
  // src/render-timestamp-range.ts
3395
3479
  var renderTimestampRange = (timestamps) => {
@@ -3403,7 +3487,7 @@ var renderTimestampRange = (timestamps) => {
3403
3487
  };
3404
3488
 
3405
3489
  // src/video-extraction/keyframe-bank.ts
3406
- import { Internals as Internals12 } from "remotion";
3490
+ import { Internals as Internals13 } from "remotion";
3407
3491
 
3408
3492
  // src/video-extraction/get-allocation-size.ts
3409
3493
  var BYTES_PER_PIXEL_FOR_OPAQUE_FRAME = 3;
@@ -3428,6 +3512,7 @@ var makeKeyframeBank = async ({
3428
3512
  let hasReachedEndOfVideo = false;
3429
3513
  let lastUsed = Date.now();
3430
3514
  let allocationSize = 0;
3515
+ let pendingOperations = 0;
3431
3516
  const getMeasuredDurationOfFrame = (timestamp) => {
3432
3517
  const index = frameTimestamps.indexOf(timestamp);
3433
3518
  if (index === -1) {
@@ -3483,7 +3568,7 @@ var makeKeyframeBank = async ({
3483
3568
  }
3484
3569
  }
3485
3570
  if (deletedTimestamps.length > 0) {
3486
- Internals12.Log.verbose({ logLevel, tag: "@remotion/media" }, `Deleted ${deletedTimestamps.length} frame${deletedTimestamps.length === 1 ? "" : "s"} ${renderTimestampRange(deletedTimestamps)} for src ${src} because it is lower than ${timestampInSeconds}. Remaining: ${renderTimestampRange(frameTimestamps)}`);
3571
+ Internals13.Log.verbose({ logLevel, tag: "@remotion/media" }, `Deleted ${deletedTimestamps.length} frame${deletedTimestamps.length === 1 ? "" : "s"} ${renderTimestampRange(deletedTimestamps)} for src ${src} because it is lower than ${timestampInSeconds}. Remaining: ${renderTimestampRange(frameTimestamps)}`);
3487
3572
  }
3488
3573
  };
3489
3574
  const hasDecodedEnoughForTimestamp = (timestamp) => {
@@ -3512,7 +3597,7 @@ var makeKeyframeBank = async ({
3512
3597
  frameTimestamps.push(frame.timestamp);
3513
3598
  allocationSize += getAllocationSize(frame);
3514
3599
  lastUsed = Date.now();
3515
- Internals12.Log.trace({ logLevel, tag: "@remotion/media" }, `Added frame at ${frame.timestamp}sec to bank`);
3600
+ Internals13.Log.trace({ logLevel, tag: "@remotion/media" }, `Added frame at ${frame.timestamp}sec to bank`);
3516
3601
  };
3517
3602
  const ensureEnoughFramesForTimestamp = async (timestampInSeconds, logLevel, fps) => {
3518
3603
  while (!hasDecodedEnoughForTimestamp(timestampInSeconds)) {
@@ -3561,13 +3646,13 @@ var makeKeyframeBank = async ({
3561
3646
  const getLastUsed = () => {
3562
3647
  return lastUsed;
3563
3648
  };
3564
- let queue = Promise.resolve(undefined);
3649
+ const enqueue = makeSerializedQueue();
3565
3650
  const firstFrame = await sampleIterator.next();
3566
3651
  if (!firstFrame.value) {
3567
3652
  throw new Error("No first frame found");
3568
3653
  }
3569
3654
  const startTimestampInSeconds = firstFrame.value.timestamp;
3570
- Internals12.Log.verbose({ logLevel: parentLogLevel, tag: "@remotion/media" }, `Creating keyframe bank from ${startTimestampInSeconds}sec`);
3655
+ Internals13.Log.verbose({ logLevel: parentLogLevel, tag: "@remotion/media" }, `Creating keyframe bank from ${startTimestampInSeconds}sec`);
3571
3656
  addFrame(firstFrame.value, parentLogLevel);
3572
3657
  const getRangeOfTimestamps = () => {
3573
3658
  if (frameTimestamps.length === 0) {
@@ -3584,7 +3669,7 @@ var makeKeyframeBank = async ({
3584
3669
  const prepareForDeletion = (logLevel, reason) => {
3585
3670
  const range = getRangeOfTimestamps();
3586
3671
  if (range) {
3587
- Internals12.Log.verbose({ logLevel, tag: "@remotion/media" }, `Preparing for deletion (${reason}) of keyframe bank from ${range?.firstTimestamp}sec to ${range?.lastTimestamp}sec`);
3672
+ Internals13.Log.verbose({ logLevel, tag: "@remotion/media" }, `Preparing for deletion (${reason}) of keyframe bank from ${range?.firstTimestamp}sec to ${range?.lastTimestamp}sec`);
3588
3673
  }
3589
3674
  let framesDeleted = 0;
3590
3675
  for (const frameTimestamp of frameTimestamps.slice()) {
@@ -3625,19 +3710,24 @@ var makeKeyframeBank = async ({
3625
3710
  };
3626
3711
  const keyframeBank = {
3627
3712
  getFrameFromTimestamp: (timestamp, fps) => {
3628
- queue = queue.then(() => getFrameFromTimestamp(timestamp, fps));
3629
- return queue;
3713
+ pendingOperations++;
3714
+ return enqueue(() => getFrameFromTimestamp(timestamp, fps)).finally(() => {
3715
+ pendingOperations--;
3716
+ });
3630
3717
  },
3631
3718
  prepareForDeletion,
3632
3719
  hasTimestampInSecond: (timestamp, fps) => {
3633
- queue = queue.then(() => hasTimestampInSecond(timestamp, fps));
3634
- return queue;
3720
+ pendingOperations++;
3721
+ return enqueue(() => hasTimestampInSecond(timestamp, fps)).finally(() => {
3722
+ pendingOperations--;
3723
+ });
3635
3724
  },
3636
3725
  addFrame,
3637
3726
  deleteFramesBeforeTimestamp,
3638
3727
  src,
3639
3728
  getOpenFrameCount,
3640
3729
  getLastUsed,
3730
+ isBusy: () => pendingOperations > 0,
3641
3731
  canSatisfyTimestamp,
3642
3732
  getRangeOfTimestamps
3643
3733
  };
@@ -3645,11 +3735,14 @@ var makeKeyframeBank = async ({
3645
3735
  };
3646
3736
 
3647
3737
  // src/video-extraction/keyframe-manager.ts
3738
+ var RECENTLY_USED_REQUEST_COUNT = 50;
3648
3739
  var makeKeyframeManager = ({
3649
3740
  getTotalCacheStats
3650
3741
  }) => {
3651
3742
  let sources = {};
3652
3743
  let disposed = false;
3744
+ let requestCountForSrc = {};
3745
+ const lastRequestForBank = new WeakMap;
3653
3746
  const addKeyframeBank = ({
3654
3747
  src,
3655
3748
  bank,
@@ -3674,10 +3767,10 @@ var makeKeyframeManager = ({
3674
3767
  if (size === 0) {
3675
3768
  continue;
3676
3769
  }
3677
- Internals13.Log.verbose({ logLevel, tag: "@remotion/media" }, `Open frames for src ${src}: ${renderTimestampRange(timestamps)}`);
3770
+ Internals14.Log.verbose({ logLevel, tag: "@remotion/media" }, `Open frames for src ${src}: ${renderTimestampRange(timestamps)}`);
3678
3771
  }
3679
3772
  }
3680
- Internals13.Log.verbose({ logLevel, tag: "@remotion/media" }, `Video cache stats: ${count} open frames, ${totalSize} bytes`);
3773
+ Internals14.Log.verbose({ logLevel, tag: "@remotion/media" }, `Video cache stats: ${count} open frames, ${totalSize} bytes`);
3681
3774
  };
3682
3775
  const getCacheStats = () => {
3683
3776
  let count = 0;
@@ -3700,39 +3793,34 @@ var makeKeyframeManager = ({
3700
3793
  let numberOfBanks = 0;
3701
3794
  for (const src in sources) {
3702
3795
  for (const bank of sources[src]) {
3796
+ numberOfBanks++;
3797
+ if (bank.isBusy()) {
3798
+ continue;
3799
+ }
3703
3800
  const index = sources[src].indexOf(bank);
3704
3801
  const lastUsed = bank.getLastUsed();
3705
3802
  if (mostInThePast === null || lastUsed < mostInThePast) {
3706
3803
  mostInThePast = lastUsed;
3707
3804
  mostInThePastBank = { src, bank, index };
3708
3805
  }
3709
- numberOfBanks++;
3710
3806
  }
3711
3807
  }
3712
3808
  if (!mostInThePastBank) {
3713
- throw new Error("No keyframe bank found");
3809
+ return { mostInThePastBank: null, numberOfBanks };
3714
3810
  }
3715
3811
  return { mostInThePastBank, numberOfBanks };
3716
3812
  };
3717
3813
  const deleteOldestKeyframeBank = (logLevel) => {
3718
- const {
3719
- mostInThePastBank: {
3720
- bank: mostInThePastBank,
3721
- src: mostInThePastSrc,
3722
- index: mostInThePastIndex
3723
- },
3724
- numberOfBanks
3725
- } = getTheKeyframeBankMostInThePast();
3726
- if (numberOfBanks < 2) {
3814
+ const { mostInThePastBank, numberOfBanks } = getTheKeyframeBankMostInThePast();
3815
+ if (numberOfBanks < 2 || mostInThePastBank === null) {
3727
3816
  return { finish: true };
3728
3817
  }
3729
- if (mostInThePastBank) {
3730
- const range = mostInThePastBank.getRangeOfTimestamps();
3731
- const { framesDeleted } = mostInThePastBank.prepareForDeletion(logLevel, "deleted oldest keyframe bank to stay under max cache size");
3732
- sources[mostInThePastSrc].splice(mostInThePastIndex, 1);
3733
- if (range) {
3734
- Internals13.Log.verbose({ logLevel, tag: "@remotion/media" }, `Deleted ${framesDeleted} frames for src ${mostInThePastSrc} from ${range?.firstTimestamp}sec to ${range?.lastTimestamp}sec to free up memory.`);
3735
- }
3818
+ const { bank, src, index } = mostInThePastBank;
3819
+ const range = bank.getRangeOfTimestamps();
3820
+ const { framesDeleted } = bank.prepareForDeletion(logLevel, "deleted oldest keyframe bank to stay under max cache size");
3821
+ sources[src].splice(index, 1);
3822
+ if (range) {
3823
+ Internals14.Log.verbose({ logLevel, tag: "@remotion/media" }, `Deleted ${framesDeleted} frames for src ${src} from ${range?.firstTimestamp}sec to ${range?.lastTimestamp}sec to free up memory.`);
3736
3824
  }
3737
3825
  return { finish: false };
3738
3826
  };
@@ -3745,12 +3833,12 @@ var makeKeyframeManager = ({
3745
3833
  if (finish) {
3746
3834
  break;
3747
3835
  }
3748
- Internals13.Log.verbose({ logLevel, tag: "@remotion/media" }, "Deleted oldest keyframe bank to stay under max cache size", (cacheStats.totalSize / 1024 / 1024).toFixed(1), "out of", (maxCacheSize / 1024 / 1024).toFixed(1));
3836
+ Internals14.Log.verbose({ logLevel, tag: "@remotion/media" }, "Deleted oldest keyframe bank to stay under max cache size", (cacheStats.totalSize / 1024 / 1024).toFixed(1), "out of", (maxCacheSize / 1024 / 1024).toFixed(1));
3749
3837
  cacheStats = getTotalCacheStats();
3750
3838
  attempts++;
3751
3839
  }
3752
3840
  if (cacheStats.totalSize > maxCacheSize && attempts >= maxAttempts) {
3753
- Internals13.Log.warn({ logLevel, tag: "@remotion/media" }, `Exceeded max cache size after ${maxAttempts} attempts. Remaining cache size: ${(cacheStats.totalSize / 1024 / 1024).toFixed(1)} MB, target was ${(maxCacheSize / 1024 / 1024).toFixed(1)} MB.`);
3841
+ Internals14.Log.warn({ logLevel, tag: "@remotion/media" }, `Exceeded max cache size after ${maxAttempts} attempts. Remaining cache size: ${(cacheStats.totalSize / 1024 / 1024).toFixed(1)} MB, target was ${(maxCacheSize / 1024 / 1024).toFixed(1)} MB.`);
3754
3842
  }
3755
3843
  };
3756
3844
  const clearKeyframeBanksBeforeTime = ({
@@ -3764,14 +3852,22 @@ var makeKeyframeManager = ({
3764
3852
  return;
3765
3853
  }
3766
3854
  const banks = sources[src];
3855
+ const currentRequest = requestCountForSrc[src] ?? 0;
3767
3856
  for (const bank of banks) {
3857
+ if (bank.isBusy()) {
3858
+ continue;
3859
+ }
3768
3860
  const range = bank.getRangeOfTimestamps();
3769
3861
  if (!range) {
3770
3862
  continue;
3771
3863
  }
3864
+ const lastRequest = lastRequestForBank.get(bank);
3865
+ if (lastRequest !== undefined && currentRequest - lastRequest < RECENTLY_USED_REQUEST_COUNT) {
3866
+ continue;
3867
+ }
3772
3868
  if (range.lastTimestamp < threshold) {
3773
3869
  bank.prepareForDeletion(logLevel, "cleared before threshold " + threshold);
3774
- Internals13.Log.verbose({ logLevel, tag: "@remotion/media" }, `[Video] Cleared frames for src ${src} from ${range.firstTimestamp}sec to ${range.lastTimestamp}sec`);
3870
+ Internals14.Log.verbose({ logLevel, tag: "@remotion/media" }, `[Video] Cleared frames for src ${src} from ${range.firstTimestamp}sec to ${range.lastTimestamp}sec`);
3775
3871
  const bankIndex = banks.indexOf(bank);
3776
3872
  delete sources[src][bankIndex];
3777
3873
  } else {
@@ -3793,7 +3889,7 @@ var makeKeyframeManager = ({
3793
3889
  const existingBanks = sources[src] ?? [];
3794
3890
  const existingBank = existingBanks?.find((bank) => bank.canSatisfyTimestamp(timestamp));
3795
3891
  if (!existingBank) {
3796
- Internals13.Log.trace({ logLevel, tag: "@remotion/media" }, `Creating new keyframe bank for src ${src} at timestamp ${timestamp}`);
3892
+ Internals14.Log.trace({ logLevel, tag: "@remotion/media" }, `Creating new keyframe bank for src ${src} at timestamp ${timestamp}`);
3797
3893
  const newKeyframeBank = await makeKeyframeBank({
3798
3894
  videoSampleSink,
3799
3895
  logLevel,
@@ -3806,10 +3902,10 @@ var makeKeyframeManager = ({
3806
3902
  return newKeyframeBank;
3807
3903
  }
3808
3904
  if (existingBank.canSatisfyTimestamp(timestamp)) {
3809
- Internals13.Log.trace({ logLevel, tag: "@remotion/media" }, `Keyframe bank exists and satisfies timestamp ${timestamp}`);
3905
+ Internals14.Log.trace({ logLevel, tag: "@remotion/media" }, `Keyframe bank exists and satisfies timestamp ${timestamp}`);
3810
3906
  return existingBank;
3811
3907
  }
3812
- Internals13.Log.verbose({ logLevel, tag: "@remotion/media" }, `Keyframe bank exists but frame at time ${timestamp} does not exist anymore.`);
3908
+ Internals14.Log.verbose({ logLevel, tag: "@remotion/media" }, `Keyframe bank exists but frame at time ${timestamp} does not exist anymore.`);
3813
3909
  existingBank.prepareForDeletion(logLevel, "already existed but evicted");
3814
3910
  sources[src] = sources[src].filter((bank) => bank !== existingBank);
3815
3911
  const replacementKeybank = await makeKeyframeBank({
@@ -3834,6 +3930,7 @@ var makeKeyframeManager = ({
3834
3930
  if (disposed) {
3835
3931
  return null;
3836
3932
  }
3933
+ requestCountForSrc[src] = (requestCountForSrc[src] ?? 0) + 1;
3837
3934
  ensureToStayUnderMaxCacheSize(logLevel, maxCacheSize);
3838
3935
  clearKeyframeBanksBeforeTime({
3839
3936
  timestampInSeconds: timestamp,
@@ -3847,6 +3944,9 @@ var makeKeyframeManager = ({
3847
3944
  src,
3848
3945
  logLevel
3849
3946
  });
3947
+ if (keyframeBank) {
3948
+ lastRequestForBank.set(keyframeBank, requestCountForSrc[src]);
3949
+ }
3850
3950
  return keyframeBank;
3851
3951
  };
3852
3952
  const clearAll = (logLevel) => {
@@ -3859,6 +3959,7 @@ var makeKeyframeManager = ({
3859
3959
  sources[src] = [];
3860
3960
  }
3861
3961
  sources = {};
3962
+ requestCountForSrc = {};
3862
3963
  };
3863
3964
  const dispose = (logLevel) => {
3864
3965
  if (disposed) {
@@ -3867,7 +3968,7 @@ var makeKeyframeManager = ({
3867
3968
  disposed = true;
3868
3969
  clearAll(logLevel);
3869
3970
  };
3870
- let queue = Promise.resolve(undefined);
3971
+ const enqueue = makeSerializedQueue();
3871
3972
  return {
3872
3973
  requestKeyframeBank: ({
3873
3974
  timestamp,
@@ -3877,7 +3978,7 @@ var makeKeyframeManager = ({
3877
3978
  maxCacheSize,
3878
3979
  fps
3879
3980
  }) => {
3880
- queue = queue.then(() => requestKeyframeBank({
3981
+ return enqueue(() => requestKeyframeBank({
3881
3982
  timestamp,
3882
3983
  videoSampleSink,
3883
3984
  src,
@@ -3885,7 +3986,6 @@ var makeKeyframeManager = ({
3885
3986
  maxCacheSize,
3886
3987
  fps
3887
3988
  }));
3888
- return queue;
3889
3989
  },
3890
3990
  getCacheStats,
3891
3991
  clearAll,
@@ -3921,8 +4021,8 @@ var makeMediaCache = () => {
3921
4021
  });
3922
4022
  managerInstances.keyframe = keyframeManagerInstance;
3923
4023
  managerInstances.audio = audioManagerInstance;
3924
- let frameExtractionQueue = Promise.resolve(undefined);
3925
- let audioExtractionQueue = Promise.resolve(undefined);
4024
+ const queueFrameExtraction = makeSerializedQueue();
4025
+ const queueAudioExtraction = makeSerializedQueue();
3926
4026
  let disposed = false;
3927
4027
  return {
3928
4028
  sinkManager,
@@ -3930,20 +4030,8 @@ var makeMediaCache = () => {
3930
4030
  audioManager: audioManagerInstance,
3931
4031
  getTotalCacheStats: getCacheStats,
3932
4032
  isDisposed: () => disposed,
3933
- queueFrameExtraction: (extract) => {
3934
- const extraction = frameExtractionQueue.then(extract);
3935
- frameExtractionQueue = extraction.catch(() => {
3936
- return;
3937
- });
3938
- return extraction;
3939
- },
3940
- queueAudioExtraction: (extract) => {
3941
- const extraction = audioExtractionQueue.then(extract);
3942
- audioExtractionQueue = extraction.catch(() => {
3943
- return;
3944
- });
3945
- return extraction;
3946
- },
4033
+ queueFrameExtraction,
4034
+ queueAudioExtraction,
3947
4035
  dispose: (logLevel) => {
3948
4036
  if (disposed) {
3949
4037
  return;
@@ -3963,7 +4051,7 @@ var makeMediaCache = () => {
3963
4051
  };
3964
4052
  var globalMediaCache = makeMediaCache();
3965
4053
  var useRenderMediaCache = (logLevel) => {
3966
- const renderResourceManager = React2.useContext(Internals14.RenderResourceManagerContext);
4054
+ const renderResourceManager = React2.useContext(Internals15.RenderResourceManagerContext);
3967
4055
  if (renderResourceManager === null) {
3968
4056
  return globalMediaCache;
3969
4057
  }
@@ -3978,42 +4066,8 @@ var useRenderMediaCache = (logLevel) => {
3978
4066
  }
3979
4067
  });
3980
4068
  };
3981
- var getUncachedMaxCacheSize = (logLevel) => {
3982
- if (typeof window !== "undefined" && window.remotion_mediaCacheSizeInBytes !== undefined && window.remotion_mediaCacheSizeInBytes !== null) {
3983
- if (window.remotion_mediaCacheSizeInBytes < 240 * 1024 * 1024) {
3984
- cancelRender(new Error(`The minimum value for the "mediaCacheSizeInBytes" prop is 240MB (${240 * 1024 * 1024}), got: ${window.remotion_mediaCacheSizeInBytes}`));
3985
- }
3986
- if (window.remotion_mediaCacheSizeInBytes > 20000 * 1024 * 1024) {
3987
- cancelRender(new Error(`The maximum value for the "mediaCacheSizeInBytes" prop is 20GB (${20000 * 1024 * 1024}), got: ${window.remotion_mediaCacheSizeInBytes}`));
3988
- }
3989
- Internals14.Log.verbose({ logLevel, tag: "@remotion/media" }, `Using cache size set using "mediaCacheSizeInBytes": ${(window.remotion_mediaCacheSizeInBytes / 1024 / 1024).toFixed(1)} MB`);
3990
- return window.remotion_mediaCacheSizeInBytes;
3991
- }
3992
- if (typeof window !== "undefined" && window.remotion_initialMemoryAvailable !== undefined && window.remotion_initialMemoryAvailable !== null) {
3993
- const value = window.remotion_initialMemoryAvailable / 2;
3994
- if (value < 500 * 1024 * 1024) {
3995
- Internals14.Log.verbose({ logLevel, tag: "@remotion/media" }, `Using cache size set based on minimum value of 500MB (which is more than half of the available system memory!)`);
3996
- return 500 * 1024 * 1024;
3997
- }
3998
- if (value > 20000 * 1024 * 1024) {
3999
- Internals14.Log.verbose({ logLevel, tag: "@remotion/media" }, `Using cache size set based on maximum value of 20GB (which is less than half of the available system memory)`);
4000
- return 20000 * 1024 * 1024;
4001
- }
4002
- Internals14.Log.verbose({ logLevel, tag: "@remotion/media" }, `Using cache size set based on available memory (50% of available memory): ${(value / 1024 / 1024).toFixed(1)} MB`);
4003
- return value;
4004
- }
4005
- return 1000 * 1000 * 1000;
4006
- };
4007
- var cachedMaxCacheSize = null;
4008
- var getMaxVideoCacheSize = (logLevel) => {
4009
- if (cachedMaxCacheSize !== null) {
4010
- return cachedMaxCacheSize;
4011
- }
4012
- cachedMaxCacheSize = getUncachedMaxCacheSize(logLevel);
4013
- return cachedMaxCacheSize;
4014
- };
4015
4069
  var useMaxMediaCacheSize = (logLevel) => {
4016
- const context = React2.useContext(Internals14.MaxMediaCacheSizeContext);
4070
+ const context = React2.useContext(Internals15.MaxMediaCacheSizeContext);
4017
4071
  if (context === null) {
4018
4072
  return getMaxVideoCacheSize(logLevel);
4019
4073
  }
@@ -4397,7 +4451,7 @@ var extractAudio = (params) => {
4397
4451
  };
4398
4452
 
4399
4453
  // src/video-extraction/extract-frame.ts
4400
- import { Internals as Internals15 } from "remotion";
4454
+ import { Internals as Internals16 } from "remotion";
4401
4455
  var extractFrameInternal = async ({
4402
4456
  src,
4403
4457
  timeInSeconds: unloopedTimeInSeconds,
@@ -4487,7 +4541,7 @@ var extractFrameInternal = async ({
4487
4541
  durationInSeconds: await sink.getDuration()
4488
4542
  };
4489
4543
  } catch (err) {
4490
- Internals15.Log.info({ logLevel, tag: "@remotion/media" }, `Error decoding ${src} at time ${timeInSeconds}: ${err}`, err);
4544
+ Internals16.Log.info({ logLevel, tag: "@remotion/media" }, `Error decoding ${src} at time ${timeInSeconds}: ${err}`, err);
4491
4545
  return { type: "cannot-decode", durationInSeconds: mediaDurationInSeconds };
4492
4546
  }
4493
4547
  };
@@ -4926,13 +4980,13 @@ var AudioForRendering = ({
4926
4980
  credentials,
4927
4981
  requestInit
4928
4982
  }) => {
4929
- const defaultLogLevel = Internals16.useLogLevel();
4983
+ const defaultLogLevel = Internals17.useLogLevel();
4930
4984
  const logLevel = overriddenLogLevel ?? defaultLogLevel;
4931
4985
  const frame = useCurrentFrame2();
4932
- const absoluteFrame = Internals16.useTimelinePosition();
4933
- const videoConfig = Internals16.useUnsafeVideoConfig();
4934
- const { registerRenderAsset, unregisterRenderAsset } = useContext3(Internals16.RenderAssetManager);
4935
- const startsAt = Internals16.useMediaStartsAt();
4986
+ const absoluteFrame = Internals17.useTimelinePosition();
4987
+ const videoConfig = Internals17.useUnsafeVideoConfig();
4988
+ const { registerRenderAsset, unregisterRenderAsset } = useContext3(Internals17.RenderAssetManager);
4989
+ const startsAt = Internals17.useMediaStartsAt();
4936
4990
  const environment = useRemotionEnvironment();
4937
4991
  if (!videoConfig) {
4938
4992
  throw new Error("No video config found");
@@ -4944,7 +4998,7 @@ var AudioForRendering = ({
4944
4998
  const { delayRender, continueRender } = useDelayRender();
4945
4999
  const [replaceWithHtml5Audio, setReplaceWithHtml5Audio] = useState2(false);
4946
5000
  const [initialRequestInit] = useState2(requestInit);
4947
- const sequenceContext = useContext3(Internals16.SequenceContext);
5001
+ const sequenceContext = useContext3(Internals17.SequenceContext);
4948
5002
  const id = useMemo2(() => `media-audio-${random(src)}-${sequenceContext?.cumulatedFrom}-${sequenceContext?.relativeFrom}-${sequenceContext?.durationInFrames}`, [
4949
5003
  src,
4950
5004
  sequenceContext?.cumulatedFrom,
@@ -4953,7 +5007,7 @@ var AudioForRendering = ({
4953
5007
  ]);
4954
5008
  const maxCacheSize = useMaxMediaCacheSize(logLevel);
4955
5009
  const mediaCache = useRenderMediaCache(logLevel);
4956
- const audioEnabled = Internals16.useAudioEnabled();
5010
+ const audioEnabled = Internals17.useAudioEnabled();
4957
5011
  useLayoutEffect2(() => {
4958
5012
  const timestamp = frame / fps;
4959
5013
  const durationInSeconds = 1 / fps;
@@ -5009,7 +5063,7 @@ var AudioForRendering = ({
5009
5063
  if (action === "fail") {
5010
5064
  cancelRender2(errorToUse);
5011
5065
  }
5012
- Internals16.Log.warn({ logLevel, tag: "@remotion/media" }, fallbackMessage);
5066
+ Internals17.Log.warn({ logLevel, tag: "@remotion/media" }, fallbackMessage);
5013
5067
  setReplaceWithHtml5Audio(true);
5014
5068
  };
5015
5069
  if (result.type === "unknown-container-format") {
@@ -5039,12 +5093,12 @@ var AudioForRendering = ({
5039
5093
  frame,
5040
5094
  startsAt
5041
5095
  });
5042
- const volume = Internals16.evaluateVolume({
5096
+ const volume = Internals17.evaluateVolume({
5043
5097
  volume: volumeProp,
5044
5098
  frame: volumePropsFrame,
5045
5099
  mediaVolume: 1
5046
5100
  });
5047
- Internals16.warnAboutTooHighVolume(volume);
5101
+ Internals17.warnAboutTooHighVolume(volume);
5048
5102
  if (audio && volume > 0) {
5049
5103
  applyVolume(audio.data, volume);
5050
5104
  registerRenderAsset({
@@ -5127,7 +5181,7 @@ var AudioForRendering = ({
5127
5181
 
5128
5182
  // src/audio/audio.tsx
5129
5183
  import { jsx as jsx3 } from "react/jsx-runtime";
5130
- var { validateMediaProps } = Internals17;
5184
+ var { validateMediaProps } = Internals18;
5131
5185
  var audioSchema = {
5132
5186
  src: {
5133
5187
  type: "asset",
@@ -5135,8 +5189,8 @@ var audioSchema = {
5135
5189
  description: "Source",
5136
5190
  keyframable: false
5137
5191
  },
5138
- ...Internals17.baseSchema,
5139
- ...Internals17.premountSchema,
5192
+ ...Internals18.baseSchema,
5193
+ ...Internals18.premountSchema,
5140
5194
  volume: {
5141
5195
  type: "number",
5142
5196
  min: 0,
@@ -5172,12 +5226,12 @@ var AudioInner = (props) => {
5172
5226
  ...otherProps
5173
5227
  } = props;
5174
5228
  const environment = useRemotionEnvironment2();
5175
- const sourceStack = controls ? Internals17.getStackForControls(controls) : null;
5176
- const [mediaVolume] = Internals17.useMediaVolumeState();
5177
- const mediaStartsAt = Internals17.useMediaStartsAt();
5229
+ const sourceStack = controls ? Internals18.getStackForControls(controls) : null;
5230
+ const [mediaVolume] = Internals18.useMediaVolumeState();
5231
+ const mediaStartsAt = Internals18.useMediaStartsAt();
5178
5232
  const videoConfig = useVideoConfig2();
5179
5233
  const sequenceDurationInFrames = Math.min(durationInFrames ?? Infinity, Math.max(0, videoConfig.durationInFrames - (from ?? 0)));
5180
- const basicInfo = Internals17.useBasicMediaInTimeline({
5234
+ const basicInfo = Internals18.useBasicMediaInTimeline({
5181
5235
  src: props.src,
5182
5236
  volume: props.volume,
5183
5237
  playbackRate: props.playbackRate ?? 1,
@@ -5220,7 +5274,7 @@ var AudioInner = (props) => {
5220
5274
  postmountingActive,
5221
5275
  premountingActive,
5222
5276
  premountingStyle
5223
- } = Internals17.usePremounting({
5277
+ } = Internals18.usePremounting({
5224
5278
  from: from ?? 0,
5225
5279
  durationInFrames: basicInfo.duration,
5226
5280
  premountFor: premountFor ?? null,
@@ -5281,7 +5335,7 @@ var Audio = Interactive.withSchema({
5281
5335
  import React6, { useMemo as useMemo6, useState as useState6 } from "react";
5282
5336
  import {
5283
5337
  Freeze as Freeze2,
5284
- Internals as Internals22,
5338
+ Internals as Internals23,
5285
5339
  Interactive as Interactive2,
5286
5340
  Sequence as Sequence2,
5287
5341
  useRemotionEnvironment as useRemotionEnvironment4,
@@ -5289,7 +5343,7 @@ import {
5289
5343
  } from "remotion";
5290
5344
 
5291
5345
  // src/video/get-video-sequence-duration.ts
5292
- import { Internals as Internals18 } from "remotion";
5346
+ import { Internals as Internals19 } from "remotion";
5293
5347
  var getVideoSequenceDuration = ({
5294
5348
  durationInFrames,
5295
5349
  loop,
@@ -5300,7 +5354,7 @@ var getVideoSequenceDuration = ({
5300
5354
  if (loop || trimAfter === undefined) {
5301
5355
  return durationInFrames;
5302
5356
  }
5303
- const trimmedDuration = Internals18.calculateMediaDuration({
5357
+ const trimmedDuration = Internals19.calculateMediaDuration({
5304
5358
  trimAfter,
5305
5359
  trimBefore,
5306
5360
  playbackRate,
@@ -5321,7 +5375,7 @@ import {
5321
5375
  } from "react";
5322
5376
  import {
5323
5377
  Html5Video,
5324
- Internals as Internals20,
5378
+ Internals as Internals21,
5325
5379
  useBufferState as useBufferState2,
5326
5380
  useCurrentFrame as useCurrentFrame3,
5327
5381
  useVideoConfig as useVideoConfig3
@@ -5364,7 +5418,7 @@ var getCachedVideoFrame = (src) => {
5364
5418
  };
5365
5419
 
5366
5420
  // src/video/warn-object-fit-css.ts
5367
- import { Internals as Internals19 } from "remotion";
5421
+ import { Internals as Internals20 } from "remotion";
5368
5422
  var OBJECT_FIT_CLASS_PATTERN = /\bobject-(contain|cover|fill|none|scale-down)\b/;
5369
5423
  var warnedStyle = false;
5370
5424
  var warnedClassName = false;
@@ -5375,11 +5429,11 @@ var warnAboutObjectFitInStyleOrClassName = ({
5375
5429
  }) => {
5376
5430
  if (!warnedStyle && style?.objectFit) {
5377
5431
  warnedStyle = true;
5378
- Internals19.Log.warn({ logLevel, tag: "@remotion/media" }, "Use the `objectFit` prop instead of the `style` prop.");
5432
+ Internals20.Log.warn({ logLevel, tag: "@remotion/media" }, "Use the `objectFit` prop instead of the `style` prop.");
5379
5433
  }
5380
5434
  if (!warnedClassName && className && OBJECT_FIT_CLASS_PATTERN.test(className)) {
5381
5435
  warnedClassName = true;
5382
- Internals19.Log.warn({ logLevel, tag: "@remotion/media" }, "Use the `objectFit` prop instead of `object-*` CSS class names.");
5436
+ Internals20.Log.warn({ logLevel, tag: "@remotion/media" }, "Use the `objectFit` prop instead of `object-*` CSS class names.");
5383
5437
  }
5384
5438
  };
5385
5439
 
@@ -5397,7 +5451,7 @@ var {
5397
5451
  usePreload: usePreload2,
5398
5452
  SequenceContext: SequenceContext2,
5399
5453
  useEffectChainState
5400
- } = Internals20;
5454
+ } = Internals21;
5401
5455
  var VideoForPreviewAssertedShowing = ({
5402
5456
  src: unpreloadedSrc,
5403
5457
  style,
@@ -5440,7 +5494,7 @@ var VideoForPreviewAssertedShowing = ({
5440
5494
  const [mediaPlayerReady, setMediaPlayerReady] = useState4(false);
5441
5495
  const [shouldFallbackToNativeVideo, setShouldFallbackToNativeVideo] = useState4(false);
5442
5496
  const [playing] = Timeline2.usePlayingState();
5443
- const { playbackRate: globalPlaybackRate } = Internals20.usePlaybackRate();
5497
+ const { playbackRate: globalPlaybackRate } = Internals21.usePlaybackRate();
5444
5498
  const sharedAudioContext = useContext4(SharedAudioContext2);
5445
5499
  const buffer = useBufferState2();
5446
5500
  const canvasRefCallback = useCallback((canvas) => {
@@ -5477,12 +5531,12 @@ var VideoForPreviewAssertedShowing = ({
5477
5531
  const currentTimeRef = useRef2(currentTime);
5478
5532
  currentTimeRef.current = currentTime;
5479
5533
  const preloadedSrc = usePreload2(src);
5480
- const buffering = useContext4(Internals20.BufferingContextReact);
5534
+ const buffering = useContext4(Internals21.BufferingContextReact);
5481
5535
  if (!buffering) {
5482
5536
  throw new Error("useMediaPlayback must be used inside a <BufferingContext>");
5483
5537
  }
5484
5538
  const effectiveMuted = muted || playerMuted || userPreferredVolume <= 0;
5485
- const isPlayerBuffering = Internals20.useIsPlayerBuffering(buffering);
5539
+ const isPlayerBuffering = Internals21.useIsPlayerBuffering(buffering);
5486
5540
  const initialPlaying = useRef2(playing && !isPlayerBuffering);
5487
5541
  const initialIsPremounting = useRef2(isPremounting);
5488
5542
  const initialIsPostmounting = useRef2(isPostmounting);
@@ -5509,8 +5563,7 @@ var VideoForPreviewAssertedShowing = ({
5509
5563
  canvas.width = cached.width;
5510
5564
  canvas.height = cached.height;
5511
5565
  const ctx = canvas.getContext("2d", {
5512
- alpha: true,
5513
- desynchronized: true
5566
+ alpha: true
5514
5567
  });
5515
5568
  if (!ctx) {
5516
5569
  return;
@@ -5580,7 +5633,7 @@ var VideoForPreviewAssertedShowing = ({
5580
5633
  if (action === "fail") {
5581
5634
  throw errorToUse;
5582
5635
  }
5583
- Internals20.Log.warn({ logLevel, tag: "@remotion/media" }, fallbackMessage);
5636
+ Internals21.Log.warn({ logLevel, tag: "@remotion/media" }, fallbackMessage);
5584
5637
  setShouldFallbackToNativeVideo(true);
5585
5638
  };
5586
5639
  if (result.type === "unknown-container-format") {
@@ -5622,7 +5675,7 @@ var VideoForPreviewAssertedShowing = ({
5622
5675
  if (action === "fail") {
5623
5676
  throw errorToUse;
5624
5677
  }
5625
- Internals20.Log.error({ logLevel, tag: "@remotion/media" }, "[VideoForPreview] Failed to initialize MediaPlayer", errorToUse);
5678
+ Internals21.Log.error({ logLevel, tag: "@remotion/media" }, "[VideoForPreview] Failed to initialize MediaPlayer", errorToUse);
5626
5679
  setShouldFallbackToNativeVideo(true);
5627
5680
  });
5628
5681
  } catch (error) {
@@ -5636,12 +5689,12 @@ var VideoForPreviewAssertedShowing = ({
5636
5689
  if (action === "fail") {
5637
5690
  throw errorToUse;
5638
5691
  }
5639
- Internals20.Log.error({ logLevel, tag: "@remotion/media" }, "[VideoForPreview] MediaPlayer initialization failed", errorToUse);
5692
+ Internals21.Log.error({ logLevel, tag: "@remotion/media" }, "[VideoForPreview] MediaPlayer initialization failed", errorToUse);
5640
5693
  setShouldFallbackToNativeVideo(true);
5641
5694
  }
5642
5695
  return () => {
5643
5696
  if (mediaPlayerRef.current) {
5644
- Internals20.Log.trace({ logLevel, tag: "@remotion/media" }, `[VideoForPreview] Disposing MediaPlayer`);
5697
+ Internals21.Log.trace({ logLevel, tag: "@remotion/media" }, `[VideoForPreview] Disposing MediaPlayer`);
5645
5698
  mediaPlayerRef.current.dispose();
5646
5699
  mediaPlayerRef.current = null;
5647
5700
  }
@@ -5665,7 +5718,7 @@ var VideoForPreviewAssertedShowing = ({
5665
5718
  ]);
5666
5719
  warnAboutObjectFitInStyleOrClassName({ style, className, logLevel });
5667
5720
  const classNameValue = useMemo4(() => {
5668
- return [Internals20.OBJECTFIT_CONTAIN_CLASS_NAME, className].filter(Internals20.truthy).join(" ");
5721
+ return [Internals21.OBJECTFIT_CONTAIN_CLASS_NAME, className].filter(Internals21.truthy).join(" ");
5669
5722
  }, [className]);
5670
5723
  useCommonEffects({
5671
5724
  mediaPlayerRef,
@@ -5789,7 +5842,7 @@ import {
5789
5842
  useState as useState5
5790
5843
  } from "react";
5791
5844
  import {
5792
- Internals as Internals21,
5845
+ Internals as Internals22,
5793
5846
  Loop,
5794
5847
  random as random2,
5795
5848
  useCurrentFrame as useCurrentFrame4,
@@ -5830,11 +5883,11 @@ var VideoForRendering = ({
5830
5883
  throw new TypeError("No `src` was passed to <Video>.");
5831
5884
  }
5832
5885
  const frame = useCurrentFrame4();
5833
- const absoluteFrame = Internals21.useTimelinePosition();
5886
+ const absoluteFrame = Internals22.useTimelinePosition();
5834
5887
  const { fps } = useVideoConfig4();
5835
- const { registerRenderAsset, unregisterRenderAsset } = useContext5(Internals21.RenderAssetManager);
5836
- const startsAt = Internals21.useMediaStartsAt();
5837
- const sequenceContext = useContext5(Internals21.SequenceContext);
5888
+ const { registerRenderAsset, unregisterRenderAsset } = useContext5(Internals22.RenderAssetManager);
5889
+ const startsAt = Internals22.useMediaStartsAt();
5890
+ const sequenceContext = useContext5(Internals22.SequenceContext);
5838
5891
  const id = useMemo5(() => `media-video-${random2(src)}-${sequenceContext?.cumulatedFrom}-${sequenceContext?.relativeFrom}-${sequenceContext?.durationInFrames}`, [
5839
5892
  src,
5840
5893
  sequenceContext?.cumulatedFrom,
@@ -5846,11 +5899,11 @@ var VideoForRendering = ({
5846
5899
  const canvasRef = useRef3(null);
5847
5900
  const [replaceWithOffthreadVideo, setReplaceWithOffthreadVideo] = useState5(false);
5848
5901
  const [initialRequestInit] = useState5(requestInit);
5849
- const audioEnabled = Internals21.useAudioEnabled();
5850
- const videoEnabled = Internals21.useVideoEnabled();
5902
+ const audioEnabled = Internals22.useAudioEnabled();
5903
+ const videoEnabled = Internals22.useVideoEnabled();
5851
5904
  const maxCacheSize = useMaxMediaCacheSize(logLevel);
5852
5905
  const mediaCache = useRenderMediaCache(logLevel);
5853
- const effectChainState = Internals21.useEffectChainState();
5906
+ const effectChainState = Internals22.useEffectChainState();
5854
5907
  const [error, setError] = useState5(null);
5855
5908
  if (error) {
5856
5909
  throw error;
@@ -5922,7 +5975,7 @@ var VideoForRendering = ({
5922
5975
  return;
5923
5976
  }
5924
5977
  if (window.remotion_isMainTab) {
5925
- Internals21.Log.warn({ logLevel, tag: "@remotion/media" }, fallbackMessage);
5978
+ Internals22.Log.warn({ logLevel, tag: "@remotion/media" }, fallbackMessage);
5926
5979
  }
5927
5980
  setReplaceWithOffthreadVideo({
5928
5981
  durationInSeconds: mediaDurationInSeconds
@@ -5966,7 +6019,7 @@ var VideoForRendering = ({
5966
6019
  context.canvas.style.aspectRatio = `${context.canvas.width} / ${context.canvas.height}`;
5967
6020
  context.drawImage(imageBitmap, 0, 0);
5968
6021
  if (effects.length > 0) {
5969
- const completed = await Internals21.runEffectChain({
6022
+ const completed = await Internals22.runEffectChain({
5970
6023
  state: effectChainState.get(imageBitmap.width, imageBitmap.height),
5971
6024
  source: context.canvas,
5972
6025
  effects,
@@ -5997,12 +6050,12 @@ var VideoForRendering = ({
5997
6050
  frame,
5998
6051
  startsAt
5999
6052
  });
6000
- const volume = Internals21.evaluateVolume({
6053
+ const volume = Internals22.evaluateVolume({
6001
6054
  volume: volumeProp,
6002
6055
  frame: volumePropsFrame,
6003
6056
  mediaVolume: 1
6004
6057
  });
6005
- Internals21.warnAboutTooHighVolume(volume);
6058
+ Internals22.warnAboutTooHighVolume(volume);
6006
6059
  if (audio && volume > 0) {
6007
6060
  applyVolume(audio.data, volume);
6008
6061
  registerRenderAsset({
@@ -6067,7 +6120,7 @@ var VideoForRendering = ({
6067
6120
  ]);
6068
6121
  warnAboutObjectFitInStyleOrClassName({ style, className, logLevel });
6069
6122
  const classNameValue = useMemo5(() => {
6070
- return [Internals21.OBJECTFIT_CONTAIN_CLASS_NAME, className].filter(Internals21.truthy).join(" ");
6123
+ return [Internals22.OBJECTFIT_CONTAIN_CLASS_NAME, className].filter(Internals22.truthy).join(" ");
6071
6124
  }, [className]);
6072
6125
  const styleWithObjectFit = useMemo5(() => {
6073
6126
  return {
@@ -6076,7 +6129,7 @@ var VideoForRendering = ({
6076
6129
  };
6077
6130
  }, [objectFitProp, style]);
6078
6131
  if (replaceWithOffthreadVideo) {
6079
- const fallback = /* @__PURE__ */ jsx5(Internals21.InnerOffthreadVideo, {
6132
+ const fallback = /* @__PURE__ */ jsx5(Internals22.InnerOffthreadVideo, {
6080
6133
  ...props,
6081
6134
  src,
6082
6135
  playbackRate: playbackRate ?? 1,
@@ -6118,7 +6171,7 @@ var VideoForRendering = ({
6118
6171
  }
6119
6172
  return /* @__PURE__ */ jsx5(Loop, {
6120
6173
  layout: "none",
6121
- durationInFrames: Internals21.calculateMediaDuration({
6174
+ durationInFrames: Internals22.calculateMediaDuration({
6122
6175
  trimAfter: trimAfterValue,
6123
6176
  mediaDurationInFrames: replaceWithOffthreadVideo.durationInSeconds * fps,
6124
6177
  playbackRate,
@@ -6147,7 +6200,7 @@ var {
6147
6200
  resolveTrimProps,
6148
6201
  validateMediaProps: validateMediaProps2,
6149
6202
  useCropStyle
6150
- } = Internals22;
6203
+ } = Internals23;
6151
6204
  var videoSchema = {
6152
6205
  src: {
6153
6206
  type: "asset",
@@ -6155,8 +6208,8 @@ var videoSchema = {
6155
6208
  description: "Source",
6156
6209
  keyframable: false
6157
6210
  },
6158
- ...Internals22.baseSchema,
6159
- ...Internals22.premountSchema,
6211
+ ...Internals23.baseSchema,
6212
+ ...Internals23.premountSchema,
6160
6213
  volume: {
6161
6214
  type: "number",
6162
6215
  min: 0,
@@ -6177,7 +6230,7 @@ var videoSchema = {
6177
6230
  },
6178
6231
  muted: { type: "boolean", default: false, description: "Muted" },
6179
6232
  loop: { type: "boolean", default: false, description: "Loop" },
6180
- ...Internals22.transformSchema,
6233
+ ...Internals23.transformSchema,
6181
6234
  ...Interactive2.backgroundSchema,
6182
6235
  ...Interactive2.borderSchema,
6183
6236
  ...Interactive2.borderRadiusSchema,
@@ -6340,10 +6393,10 @@ var VideoInner = ({
6340
6393
  cropBottom,
6341
6394
  ...props
6342
6395
  }) => {
6343
- const sourceStack = controls ? Internals22.getStackForControls(controls) ?? undefined : undefined;
6344
- const fallbackLogLevel = Internals22.useLogLevel();
6345
- const [mediaVolume] = Internals22.useMediaVolumeState();
6346
- const mediaStartsAt = Internals22.useMediaStartsAt();
6396
+ const sourceStack = controls ? Internals23.getStackForControls(controls) ?? undefined : undefined;
6397
+ const fallbackLogLevel = Internals23.useLogLevel();
6398
+ const [mediaVolume] = Internals23.useMediaVolumeState();
6399
+ const mediaStartsAt = Internals23.useMediaStartsAt();
6347
6400
  const videoConfig = useVideoConfig5();
6348
6401
  const sequenceDurationInFrames = Math.min(durationInFrames ?? Infinity, Math.max(0, videoConfig.durationInFrames - (from ?? 0)));
6349
6402
  const videoSequenceDuration = getVideoSequenceDuration({
@@ -6353,7 +6406,7 @@ var VideoInner = ({
6353
6406
  trimAfter,
6354
6407
  trimBefore
6355
6408
  });
6356
- const basicInfo = Internals22.useBasicMediaInTimeline({
6409
+ const basicInfo = Internals23.useBasicMediaInTimeline({
6357
6410
  src,
6358
6411
  volume,
6359
6412
  playbackRate: playbackRate ?? 1,
@@ -6388,11 +6441,11 @@ var VideoInner = ({
6388
6441
  type: "video",
6389
6442
  data: basicInfo
6390
6443
  }), [basicInfo]);
6391
- const memoizedEffects = Internals22.useMemoizedEffects({
6444
+ const memoizedEffects = Internals23.useMemoizedEffects({
6392
6445
  effects: effects ?? [],
6393
6446
  overrideId: controls?.overrideId ?? null
6394
6447
  });
6395
- const memoizedEffectDefinitions = Internals22.useMemoizedEffectDefinitions(effects ?? []);
6448
+ const memoizedEffectDefinitions = Internals23.useMemoizedEffectDefinitions(effects ?? []);
6396
6449
  const refForOutline = React6.useRef(null);
6397
6450
  const {
6398
6451
  effectivePostmountFor,
@@ -6402,7 +6455,7 @@ var VideoInner = ({
6402
6455
  postmountingActive,
6403
6456
  premountingActive,
6404
6457
  premountingStyle
6405
- } = Internals22.usePremounting({
6458
+ } = Internals23.usePremounting({
6406
6459
  from: from ?? 0,
6407
6460
  durationInFrames: videoSequenceDuration ?? Infinity,
6408
6461
  premountFor: premountFor ?? null,