@remotion/media 4.0.507 → 4.0.508

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.
@@ -7,5 +7,6 @@ export declare const makeAudioCache: () => {
7
7
  getOldestTimestamp: () => number;
8
8
  getNewestTimestamp: () => number | null;
9
9
  getOpenTimestamps: () => number[];
10
+ getTotalSize: () => number;
10
11
  };
11
12
  export type AudioCache = ReturnType<typeof makeAudioCache>;
package/dist/caches.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { getMaxVideoCacheSize } from './max-cache-size';
1
2
  export declare const getSafeWindowOfMonotonicity: (fps: number) => number;
2
3
  export declare const makeMediaCache: () => {
3
4
  sinkManager: {
@@ -355,5 +356,5 @@ export declare const useRenderMediaCache: (logLevel: "error" | "info" | "trace"
355
356
  queueAudioExtraction: <T>(extract: () => Promise<T>) => Promise<T>;
356
357
  dispose: (logLevel: "error" | "info" | "trace" | "verbose" | "warn") => void;
357
358
  };
358
- export declare const getMaxVideoCacheSize: (logLevel: "error" | "info" | "trace" | "verbose" | "warn") => number;
359
+ export { getMaxVideoCacheSize };
359
360
  export declare const useMaxMediaCacheSize: (logLevel: "error" | "info" | "trace" | "verbose" | "warn") => number;
@@ -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;
@@ -1858,7 +1908,7 @@ class MediaPlayer {
1858
1908
  if (isNetworkError(err)) {
1859
1909
  throw error;
1860
1910
  }
1861
- Internals5.Log.error({ logLevel: this.logLevel, tag: "@remotion/media" }, `[MediaPlayer] Failed to recognize format for ${this.src}`, error);
1911
+ Internals6.Log.error({ logLevel: this.logLevel, tag: "@remotion/media" }, `[MediaPlayer] Failed to recognize format for ${this.src}`, error);
1862
1912
  return { type: "unknown-container-format" };
1863
1913
  }
1864
1914
  const [durationInSeconds, videoTrack, audioTracks] = await Promise.all([
@@ -1968,16 +2018,16 @@ class MediaPlayer {
1968
2018
  if (this.isDisposalError()) {
1969
2019
  return { type: "disposed" };
1970
2020
  }
1971
- Internals5.Log.error({ logLevel: this.logLevel, tag: "@remotion/media" }, "[MediaPlayer] Failed to start audio and video iterators", error);
2021
+ Internals6.Log.error({ logLevel: this.logLevel, tag: "@remotion/media" }, "[MediaPlayer] Failed to start audio and video iterators", error);
1972
2022
  }
1973
2023
  return { type: "success", durationInSeconds };
1974
2024
  } catch (error) {
1975
2025
  const err = error;
1976
2026
  if (isNetworkError(err)) {
1977
- Internals5.Log.error({ logLevel: this.logLevel, tag: "@remotion/media" }, `[MediaPlayer] Network/CORS error for ${this.src}`, err);
2027
+ Internals6.Log.error({ logLevel: this.logLevel, tag: "@remotion/media" }, `[MediaPlayer] Network/CORS error for ${this.src}`, err);
1978
2028
  return { type: "network-error" };
1979
2029
  }
1980
- Internals5.Log.error({ logLevel: this.logLevel, tag: "@remotion/media" }, "[MediaPlayer] Failed to initialize", error);
2030
+ Internals6.Log.error({ logLevel: this.logLevel, tag: "@remotion/media" }, "[MediaPlayer] Failed to initialize", error);
1981
2031
  throw error;
1982
2032
  }
1983
2033
  } catch (_catch) {
@@ -2273,7 +2323,7 @@ var callOnErrorAndResolve = ({
2273
2323
 
2274
2324
  // src/use-common-effects.ts
2275
2325
  import { useContext, useLayoutEffect } from "react";
2276
- import { Internals as Internals6 } from "remotion";
2326
+ import { Internals as Internals7 } from "remotion";
2277
2327
  var useCommonEffects = ({
2278
2328
  mediaPlayerRef,
2279
2329
  mediaPlayerReady,
@@ -2297,7 +2347,7 @@ var useCommonEffects = ({
2297
2347
  logLevel,
2298
2348
  label
2299
2349
  }) => {
2300
- const sharedAudioContext = useContext(Internals6.SharedAudioContext);
2350
+ const sharedAudioContext = useContext(Internals7.SharedAudioContext);
2301
2351
  useLayoutEffect(() => {
2302
2352
  const mediaPlayer = mediaPlayerRef.current;
2303
2353
  if (!mediaPlayer)
@@ -2415,7 +2465,7 @@ var useCommonEffects = ({
2415
2465
  if (!mediaPlayer || !mediaPlayerReady)
2416
2466
  return;
2417
2467
  mediaPlayer.seekTo(currentTime).catch(() => {});
2418
- Internals6.Log.trace({ logLevel, tag: "@remotion/media" }, `[${label}] Updating target time to ${currentTime.toFixed(3)}s`);
2468
+ Internals7.Log.trace({ logLevel, tag: "@remotion/media" }, `[${label}] Updating target time to ${currentTime.toFixed(3)}s`);
2419
2469
  }, [currentTime, logLevel, mediaPlayerReady, label, mediaPlayerRef]);
2420
2470
  };
2421
2471
 
@@ -2432,7 +2482,7 @@ var {
2432
2482
  warnAboutTooHighVolume,
2433
2483
  usePreload,
2434
2484
  SequenceContext
2435
- } = Internals7;
2485
+ } = Internals8;
2436
2486
  var AudioForPreviewAssertedShowing = ({
2437
2487
  src,
2438
2488
  playbackRate,
@@ -2465,7 +2515,7 @@ var AudioForPreviewAssertedShowing = ({
2465
2515
  const [mediaPlayerReady, setMediaPlayerReady] = useState(false);
2466
2516
  const [shouldFallbackToNativeAudio, setShouldFallbackToNativeAudio] = useState(false);
2467
2517
  const [playing] = Timeline.usePlayingState();
2468
- const { playbackRate: globalPlaybackRate } = Internals7.usePlaybackRate();
2518
+ const { playbackRate: globalPlaybackRate } = Internals8.usePlaybackRate();
2469
2519
  const sharedAudioContext = useContext2(SharedAudioContext);
2470
2520
  const buffer = useBufferState();
2471
2521
  const [playerMuted] = usePlayerMutedState();
@@ -2491,12 +2541,12 @@ var AudioForPreviewAssertedShowing = ({
2491
2541
  const isPremounting = Boolean(parentSequence?.premounting);
2492
2542
  const isPostmounting = Boolean(parentSequence?.postmounting);
2493
2543
  const sequenceOffset = (parentSequence?.absoluteFrom ?? 0) / videoConfig.fps;
2494
- const bufferingContext = useContext2(Internals7.BufferingContextReact);
2544
+ const bufferingContext = useContext2(Internals8.BufferingContextReact);
2495
2545
  if (!bufferingContext) {
2496
2546
  throw new Error("useMediaPlayback must be used inside a <BufferingContext>");
2497
2547
  }
2498
2548
  const effectiveMuted = muted || playerMuted || userPreferredVolume <= 0;
2499
- const isPlayerBuffering = Internals7.useIsPlayerBuffering(bufferingContext);
2549
+ const isPlayerBuffering = Internals8.useIsPlayerBuffering(bufferingContext);
2500
2550
  const initialPlaying = useRef(playing && !isPlayerBuffering);
2501
2551
  const initialIsPremounting = useRef(isPremounting);
2502
2552
  const initialIsPostmounting = useRef(isPostmounting);
@@ -2592,7 +2642,7 @@ var AudioForPreviewAssertedShowing = ({
2592
2642
  if (action === "fail") {
2593
2643
  throw errorToUse;
2594
2644
  } else {
2595
- Internals7.Log.warn({ logLevel, tag: "@remotion/media" }, fallbackMessage);
2645
+ Internals8.Log.warn({ logLevel, tag: "@remotion/media" }, fallbackMessage);
2596
2646
  setShouldFallbackToNativeAudio(true);
2597
2647
  }
2598
2648
  };
@@ -2618,7 +2668,7 @@ var AudioForPreviewAssertedShowing = ({
2618
2668
  if (result.type === "success") {
2619
2669
  setMediaPlayerReady(true);
2620
2670
  setMediaDurationInSeconds(result.durationInSeconds);
2621
- Internals7.Log.trace({ logLevel, tag: "@remotion/media" }, `[AudioForPreview] MediaPlayer initialized successfully`);
2671
+ Internals8.Log.trace({ logLevel, tag: "@remotion/media" }, `[AudioForPreview] MediaPlayer initialized successfully`);
2622
2672
  }
2623
2673
  }).catch((error) => {
2624
2674
  const [action, errorToUse] = callOnErrorAndResolve({
@@ -2631,7 +2681,7 @@ var AudioForPreviewAssertedShowing = ({
2631
2681
  if (action === "fail") {
2632
2682
  throw errorToUse;
2633
2683
  } else {
2634
- Internals7.Log.error({ logLevel, tag: "@remotion/media" }, "[AudioForPreview] Failed to initialize MediaPlayer", error);
2684
+ Internals8.Log.error({ logLevel, tag: "@remotion/media" }, "[AudioForPreview] Failed to initialize MediaPlayer", error);
2635
2685
  setShouldFallbackToNativeAudio(true);
2636
2686
  }
2637
2687
  });
@@ -2646,12 +2696,12 @@ var AudioForPreviewAssertedShowing = ({
2646
2696
  if (action === "fail") {
2647
2697
  throw errorToUse;
2648
2698
  }
2649
- Internals7.Log.error({ logLevel, tag: "@remotion/media" }, "[AudioForPreview] MediaPlayer initialization failed", errorToUse);
2699
+ Internals8.Log.error({ logLevel, tag: "@remotion/media" }, "[AudioForPreview] MediaPlayer initialization failed", errorToUse);
2650
2700
  setShouldFallbackToNativeAudio(true);
2651
2701
  }
2652
2702
  return () => {
2653
2703
  if (mediaPlayerRef.current) {
2654
- Internals7.Log.trace({ logLevel, tag: "@remotion/media" }, `[AudioForPreview] Disposing MediaPlayer`);
2704
+ Internals8.Log.trace({ logLevel, tag: "@remotion/media" }, `[AudioForPreview] Disposing MediaPlayer`);
2655
2705
  mediaPlayerRef.current.dispose();
2656
2706
  mediaPlayerRef.current = null;
2657
2707
  }
@@ -2719,7 +2769,7 @@ var AudioForPreview = ({
2719
2769
  style
2720
2770
  }) => {
2721
2771
  const preloadedSrc = usePreload(src);
2722
- const defaultLogLevel = Internals7.useLogLevel();
2772
+ const defaultLogLevel = Internals8.useLogLevel();
2723
2773
  const frame = useCurrentFrame();
2724
2774
  const videoConfig = useVideoConfig();
2725
2775
  const currentTime = frame / videoConfig.fps;
@@ -2780,7 +2830,7 @@ import { useContext as useContext3, useLayoutEffect as useLayoutEffect2, useMemo
2780
2830
  import {
2781
2831
  cancelRender as cancelRender2,
2782
2832
  Html5Audio,
2783
- Internals as Internals16,
2833
+ Internals as Internals17,
2784
2834
  random,
2785
2835
  useCurrentFrame as useCurrentFrame2,
2786
2836
  useDelayRender,
@@ -2789,15 +2839,28 @@ import {
2789
2839
 
2790
2840
  // src/caches.ts
2791
2841
  import React2 from "react";
2792
- import { cancelRender, Internals as Internals14 } from "remotion";
2842
+ import { Internals as Internals15 } from "remotion";
2793
2843
 
2794
2844
  // src/audio-extraction/audio-manager.ts
2795
- import { Internals as Internals9 } from "remotion";
2845
+ import { Internals as Internals10 } from "remotion";
2796
2846
 
2797
2847
  // src/audio-extraction/audio-iterator.ts
2798
- import { Internals as Internals8 } from "remotion";
2848
+ import { Internals as Internals9 } from "remotion";
2799
2849
 
2800
2850
  // src/audio-extraction/audio-cache.ts
2851
+ var BYTES_PER_SAMPLE = {
2852
+ u8: 1,
2853
+ s16: 2,
2854
+ s32: 4,
2855
+ f32: 4,
2856
+ "u8-planar": 1,
2857
+ "s16-planar": 2,
2858
+ "s32-planar": 4,
2859
+ "f32-planar": 4
2860
+ };
2861
+ var getAudioSampleByteSize = (sample) => {
2862
+ return sample.numberOfFrames * sample.numberOfChannels * BYTES_PER_SAMPLE[sample.format];
2863
+ };
2801
2864
  var makeAudioCache = () => {
2802
2865
  const timestamps = [];
2803
2866
  const samples = {};
@@ -2844,6 +2907,13 @@ var makeAudioCache = () => {
2844
2907
  const getOpenTimestamps = () => {
2845
2908
  return timestamps;
2846
2909
  };
2910
+ const getTotalSize = () => {
2911
+ let total = 0;
2912
+ for (const timestamp of timestamps) {
2913
+ total += getAudioSampleByteSize(samples[timestamp]);
2914
+ }
2915
+ return total;
2916
+ };
2847
2917
  const getOldestTimestamp = () => {
2848
2918
  return timestamps[0];
2849
2919
  };
@@ -2861,7 +2931,8 @@ var makeAudioCache = () => {
2861
2931
  getSamples,
2862
2932
  getOldestTimestamp,
2863
2933
  getNewestTimestamp,
2864
- getOpenTimestamps
2934
+ getOpenTimestamps,
2935
+ getTotalSize
2865
2936
  };
2866
2937
  };
2867
2938
 
@@ -2874,7 +2945,7 @@ var warnAboutMatroskaOnce = (src, logLevel) => {
2874
2945
  return;
2875
2946
  }
2876
2947
  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`);
2948
+ 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
2949
  };
2879
2950
  var makeAudioIterator2 = ({
2880
2951
  audioSampleSink,
@@ -2942,13 +3013,13 @@ var makeAudioIterator2 = ({
2942
3013
  if (openTimestamps.length > 0) {
2943
3014
  const first = openTimestamps[0];
2944
3015
  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)}`);
3016
+ Internals9.Log.verbose({ logLevel, tag: "@remotion/media" }, "Open audio samples for src", src, `${first.toFixed(3)}...${last.toFixed(3)}`);
2946
3017
  }
2947
3018
  };
2948
3019
  const getCacheStats = () => {
2949
3020
  return {
2950
3021
  count: cache.getOpenTimestamps().length,
2951
- size: cache.getOpenTimestamps().reduce((acc, t) => acc + t, 0)
3022
+ size: cache.getTotalSize()
2952
3023
  };
2953
3024
  };
2954
3025
  const canSatisfyRequestedTime = (timestamp) => {
@@ -3042,7 +3113,7 @@ var makeAudioManager = ({
3042
3113
  if (seenKeys.has(key)) {
3043
3114
  iterator.prepareForDeletion();
3044
3115
  iterators.splice(iterators.indexOf(iterator), 1);
3045
- Internals9.Log.verbose({ logLevel, tag: "@remotion/media" }, `Deleted duplicate iterator for ${iterator.src}`);
3116
+ Internals10.Log.verbose({ logLevel, tag: "@remotion/media" }, `Deleted duplicate iterator for ${iterator.src}`);
3046
3117
  }
3047
3118
  seenKeys.add(key);
3048
3119
  }
@@ -3066,7 +3137,7 @@ var makeAudioManager = ({
3066
3137
  attempts++;
3067
3138
  }
3068
3139
  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.`);
3140
+ 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
3141
  }
3071
3142
  for (const iterator of iterators) {
3072
3143
  if (iterator.src === src && await iterator.waitForCompletion() && iterator.canSatisfyRequestedTime(timeInSeconds)) {
@@ -3153,7 +3224,7 @@ var makeAudioManager = ({
3153
3224
  };
3154
3225
 
3155
3226
  // src/get-sink.ts
3156
- import { Internals as Internals11 } from "remotion";
3227
+ import { Internals as Internals12 } from "remotion";
3157
3228
 
3158
3229
  // src/video-extraction/get-frames-since-keyframe.ts
3159
3230
  import {
@@ -3166,7 +3237,7 @@ import {
3166
3237
  VideoSampleSink,
3167
3238
  WEBM
3168
3239
  } from "mediabunny";
3169
- import { Internals as Internals10 } from "remotion";
3240
+ import { Internals as Internals11 } from "remotion";
3170
3241
 
3171
3242
  // src/browser-can-use-webgl2.ts
3172
3243
  var browserCanUseWebGl2 = null;
@@ -3224,6 +3295,7 @@ var makeSinks = (src, logLevel, credentials, requestInit) => {
3224
3295
  formats: ALL_FORMATS2,
3225
3296
  source: new UrlSource2(src, {
3226
3297
  getRetryDelay,
3298
+ maxCacheSize: getMaxSourceCacheSize(logLevel),
3227
3299
  ...resolvedRequestInit ? { requestInit: resolvedRequestInit } : undefined
3228
3300
  })
3229
3301
  });
@@ -3261,7 +3333,7 @@ var makeSinks = (src, logLevel, credentials, requestInit) => {
3261
3333
  });
3262
3334
  const hasAlpha = startPacket?.sideData.alpha;
3263
3335
  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}.`);
3336
+ Internals11.Log.warn({ logLevel, tag: "@remotion/media" }, `WebGL2 is not available, using the non-fast CPU path to decode alpha for ${src}.`);
3265
3337
  }
3266
3338
  return {
3267
3339
  sampleSink
@@ -3354,7 +3426,7 @@ var makeSinkManager = () => {
3354
3426
  });
3355
3427
  let promise = sinkPromises[cacheKey];
3356
3428
  if (!promise) {
3357
- Internals11.Log.verbose({
3429
+ Internals12.Log.verbose({
3358
3430
  logLevel,
3359
3431
  tag: "@remotion/media"
3360
3432
  }, `Sink for ${src} was not found, creating new sink`);
@@ -3389,7 +3461,7 @@ var makeSinkManager = () => {
3389
3461
  };
3390
3462
 
3391
3463
  // src/video-extraction/keyframe-manager.ts
3392
- import { Internals as Internals13 } from "remotion";
3464
+ import { Internals as Internals14 } from "remotion";
3393
3465
 
3394
3466
  // src/render-timestamp-range.ts
3395
3467
  var renderTimestampRange = (timestamps) => {
@@ -3403,7 +3475,7 @@ var renderTimestampRange = (timestamps) => {
3403
3475
  };
3404
3476
 
3405
3477
  // src/video-extraction/keyframe-bank.ts
3406
- import { Internals as Internals12 } from "remotion";
3478
+ import { Internals as Internals13 } from "remotion";
3407
3479
 
3408
3480
  // src/video-extraction/get-allocation-size.ts
3409
3481
  var BYTES_PER_PIXEL_FOR_OPAQUE_FRAME = 3;
@@ -3428,6 +3500,7 @@ var makeKeyframeBank = async ({
3428
3500
  let hasReachedEndOfVideo = false;
3429
3501
  let lastUsed = Date.now();
3430
3502
  let allocationSize = 0;
3503
+ let pendingOperations = 0;
3431
3504
  const getMeasuredDurationOfFrame = (timestamp) => {
3432
3505
  const index = frameTimestamps.indexOf(timestamp);
3433
3506
  if (index === -1) {
@@ -3483,7 +3556,7 @@ var makeKeyframeBank = async ({
3483
3556
  }
3484
3557
  }
3485
3558
  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)}`);
3559
+ 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
3560
  }
3488
3561
  };
3489
3562
  const hasDecodedEnoughForTimestamp = (timestamp) => {
@@ -3512,7 +3585,7 @@ var makeKeyframeBank = async ({
3512
3585
  frameTimestamps.push(frame.timestamp);
3513
3586
  allocationSize += getAllocationSize(frame);
3514
3587
  lastUsed = Date.now();
3515
- Internals12.Log.trace({ logLevel, tag: "@remotion/media" }, `Added frame at ${frame.timestamp}sec to bank`);
3588
+ Internals13.Log.trace({ logLevel, tag: "@remotion/media" }, `Added frame at ${frame.timestamp}sec to bank`);
3516
3589
  };
3517
3590
  const ensureEnoughFramesForTimestamp = async (timestampInSeconds, logLevel, fps) => {
3518
3591
  while (!hasDecodedEnoughForTimestamp(timestampInSeconds)) {
@@ -3567,7 +3640,7 @@ var makeKeyframeBank = async ({
3567
3640
  throw new Error("No first frame found");
3568
3641
  }
3569
3642
  const startTimestampInSeconds = firstFrame.value.timestamp;
3570
- Internals12.Log.verbose({ logLevel: parentLogLevel, tag: "@remotion/media" }, `Creating keyframe bank from ${startTimestampInSeconds}sec`);
3643
+ Internals13.Log.verbose({ logLevel: parentLogLevel, tag: "@remotion/media" }, `Creating keyframe bank from ${startTimestampInSeconds}sec`);
3571
3644
  addFrame(firstFrame.value, parentLogLevel);
3572
3645
  const getRangeOfTimestamps = () => {
3573
3646
  if (frameTimestamps.length === 0) {
@@ -3584,7 +3657,7 @@ var makeKeyframeBank = async ({
3584
3657
  const prepareForDeletion = (logLevel, reason) => {
3585
3658
  const range = getRangeOfTimestamps();
3586
3659
  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`);
3660
+ Internals13.Log.verbose({ logLevel, tag: "@remotion/media" }, `Preparing for deletion (${reason}) of keyframe bank from ${range?.firstTimestamp}sec to ${range?.lastTimestamp}sec`);
3588
3661
  }
3589
3662
  let framesDeleted = 0;
3590
3663
  for (const frameTimestamp of frameTimestamps.slice()) {
@@ -3625,12 +3698,18 @@ var makeKeyframeBank = async ({
3625
3698
  };
3626
3699
  const keyframeBank = {
3627
3700
  getFrameFromTimestamp: (timestamp, fps) => {
3628
- queue = queue.then(() => getFrameFromTimestamp(timestamp, fps));
3701
+ pendingOperations++;
3702
+ queue = queue.then(() => getFrameFromTimestamp(timestamp, fps)).finally(() => {
3703
+ pendingOperations--;
3704
+ });
3629
3705
  return queue;
3630
3706
  },
3631
3707
  prepareForDeletion,
3632
3708
  hasTimestampInSecond: (timestamp, fps) => {
3633
- queue = queue.then(() => hasTimestampInSecond(timestamp, fps));
3709
+ pendingOperations++;
3710
+ queue = queue.then(() => hasTimestampInSecond(timestamp, fps)).finally(() => {
3711
+ pendingOperations--;
3712
+ });
3634
3713
  return queue;
3635
3714
  },
3636
3715
  addFrame,
@@ -3638,6 +3717,7 @@ var makeKeyframeBank = async ({
3638
3717
  src,
3639
3718
  getOpenFrameCount,
3640
3719
  getLastUsed,
3720
+ isBusy: () => pendingOperations > 0,
3641
3721
  canSatisfyTimestamp,
3642
3722
  getRangeOfTimestamps
3643
3723
  };
@@ -3645,11 +3725,14 @@ var makeKeyframeBank = async ({
3645
3725
  };
3646
3726
 
3647
3727
  // src/video-extraction/keyframe-manager.ts
3728
+ var RECENTLY_USED_REQUEST_COUNT = 50;
3648
3729
  var makeKeyframeManager = ({
3649
3730
  getTotalCacheStats
3650
3731
  }) => {
3651
3732
  let sources = {};
3652
3733
  let disposed = false;
3734
+ let requestCountForSrc = {};
3735
+ const lastRequestForBank = new WeakMap;
3653
3736
  const addKeyframeBank = ({
3654
3737
  src,
3655
3738
  bank,
@@ -3674,10 +3757,10 @@ var makeKeyframeManager = ({
3674
3757
  if (size === 0) {
3675
3758
  continue;
3676
3759
  }
3677
- Internals13.Log.verbose({ logLevel, tag: "@remotion/media" }, `Open frames for src ${src}: ${renderTimestampRange(timestamps)}`);
3760
+ Internals14.Log.verbose({ logLevel, tag: "@remotion/media" }, `Open frames for src ${src}: ${renderTimestampRange(timestamps)}`);
3678
3761
  }
3679
3762
  }
3680
- Internals13.Log.verbose({ logLevel, tag: "@remotion/media" }, `Video cache stats: ${count} open frames, ${totalSize} bytes`);
3763
+ Internals14.Log.verbose({ logLevel, tag: "@remotion/media" }, `Video cache stats: ${count} open frames, ${totalSize} bytes`);
3681
3764
  };
3682
3765
  const getCacheStats = () => {
3683
3766
  let count = 0;
@@ -3700,39 +3783,34 @@ var makeKeyframeManager = ({
3700
3783
  let numberOfBanks = 0;
3701
3784
  for (const src in sources) {
3702
3785
  for (const bank of sources[src]) {
3786
+ numberOfBanks++;
3787
+ if (bank.isBusy()) {
3788
+ continue;
3789
+ }
3703
3790
  const index = sources[src].indexOf(bank);
3704
3791
  const lastUsed = bank.getLastUsed();
3705
3792
  if (mostInThePast === null || lastUsed < mostInThePast) {
3706
3793
  mostInThePast = lastUsed;
3707
3794
  mostInThePastBank = { src, bank, index };
3708
3795
  }
3709
- numberOfBanks++;
3710
3796
  }
3711
3797
  }
3712
3798
  if (!mostInThePastBank) {
3713
- throw new Error("No keyframe bank found");
3799
+ return { mostInThePastBank: null, numberOfBanks };
3714
3800
  }
3715
3801
  return { mostInThePastBank, numberOfBanks };
3716
3802
  };
3717
3803
  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) {
3804
+ const { mostInThePastBank, numberOfBanks } = getTheKeyframeBankMostInThePast();
3805
+ if (numberOfBanks < 2 || mostInThePastBank === null) {
3727
3806
  return { finish: true };
3728
3807
  }
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
- }
3808
+ const { bank, src, index } = mostInThePastBank;
3809
+ const range = bank.getRangeOfTimestamps();
3810
+ const { framesDeleted } = bank.prepareForDeletion(logLevel, "deleted oldest keyframe bank to stay under max cache size");
3811
+ sources[src].splice(index, 1);
3812
+ if (range) {
3813
+ 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
3814
  }
3737
3815
  return { finish: false };
3738
3816
  };
@@ -3745,12 +3823,12 @@ var makeKeyframeManager = ({
3745
3823
  if (finish) {
3746
3824
  break;
3747
3825
  }
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));
3826
+ 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
3827
  cacheStats = getTotalCacheStats();
3750
3828
  attempts++;
3751
3829
  }
3752
3830
  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.`);
3831
+ 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
3832
  }
3755
3833
  };
3756
3834
  const clearKeyframeBanksBeforeTime = ({
@@ -3764,14 +3842,22 @@ var makeKeyframeManager = ({
3764
3842
  return;
3765
3843
  }
3766
3844
  const banks = sources[src];
3845
+ const currentRequest = requestCountForSrc[src] ?? 0;
3767
3846
  for (const bank of banks) {
3847
+ if (bank.isBusy()) {
3848
+ continue;
3849
+ }
3768
3850
  const range = bank.getRangeOfTimestamps();
3769
3851
  if (!range) {
3770
3852
  continue;
3771
3853
  }
3854
+ const lastRequest = lastRequestForBank.get(bank);
3855
+ if (lastRequest !== undefined && currentRequest - lastRequest < RECENTLY_USED_REQUEST_COUNT) {
3856
+ continue;
3857
+ }
3772
3858
  if (range.lastTimestamp < threshold) {
3773
3859
  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`);
3860
+ Internals14.Log.verbose({ logLevel, tag: "@remotion/media" }, `[Video] Cleared frames for src ${src} from ${range.firstTimestamp}sec to ${range.lastTimestamp}sec`);
3775
3861
  const bankIndex = banks.indexOf(bank);
3776
3862
  delete sources[src][bankIndex];
3777
3863
  } else {
@@ -3793,7 +3879,7 @@ var makeKeyframeManager = ({
3793
3879
  const existingBanks = sources[src] ?? [];
3794
3880
  const existingBank = existingBanks?.find((bank) => bank.canSatisfyTimestamp(timestamp));
3795
3881
  if (!existingBank) {
3796
- Internals13.Log.trace({ logLevel, tag: "@remotion/media" }, `Creating new keyframe bank for src ${src} at timestamp ${timestamp}`);
3882
+ Internals14.Log.trace({ logLevel, tag: "@remotion/media" }, `Creating new keyframe bank for src ${src} at timestamp ${timestamp}`);
3797
3883
  const newKeyframeBank = await makeKeyframeBank({
3798
3884
  videoSampleSink,
3799
3885
  logLevel,
@@ -3806,10 +3892,10 @@ var makeKeyframeManager = ({
3806
3892
  return newKeyframeBank;
3807
3893
  }
3808
3894
  if (existingBank.canSatisfyTimestamp(timestamp)) {
3809
- Internals13.Log.trace({ logLevel, tag: "@remotion/media" }, `Keyframe bank exists and satisfies timestamp ${timestamp}`);
3895
+ Internals14.Log.trace({ logLevel, tag: "@remotion/media" }, `Keyframe bank exists and satisfies timestamp ${timestamp}`);
3810
3896
  return existingBank;
3811
3897
  }
3812
- Internals13.Log.verbose({ logLevel, tag: "@remotion/media" }, `Keyframe bank exists but frame at time ${timestamp} does not exist anymore.`);
3898
+ Internals14.Log.verbose({ logLevel, tag: "@remotion/media" }, `Keyframe bank exists but frame at time ${timestamp} does not exist anymore.`);
3813
3899
  existingBank.prepareForDeletion(logLevel, "already existed but evicted");
3814
3900
  sources[src] = sources[src].filter((bank) => bank !== existingBank);
3815
3901
  const replacementKeybank = await makeKeyframeBank({
@@ -3834,6 +3920,7 @@ var makeKeyframeManager = ({
3834
3920
  if (disposed) {
3835
3921
  return null;
3836
3922
  }
3923
+ requestCountForSrc[src] = (requestCountForSrc[src] ?? 0) + 1;
3837
3924
  ensureToStayUnderMaxCacheSize(logLevel, maxCacheSize);
3838
3925
  clearKeyframeBanksBeforeTime({
3839
3926
  timestampInSeconds: timestamp,
@@ -3847,6 +3934,9 @@ var makeKeyframeManager = ({
3847
3934
  src,
3848
3935
  logLevel
3849
3936
  });
3937
+ if (keyframeBank) {
3938
+ lastRequestForBank.set(keyframeBank, requestCountForSrc[src]);
3939
+ }
3850
3940
  return keyframeBank;
3851
3941
  };
3852
3942
  const clearAll = (logLevel) => {
@@ -3859,6 +3949,7 @@ var makeKeyframeManager = ({
3859
3949
  sources[src] = [];
3860
3950
  }
3861
3951
  sources = {};
3952
+ requestCountForSrc = {};
3862
3953
  };
3863
3954
  const dispose = (logLevel) => {
3864
3955
  if (disposed) {
@@ -3963,7 +4054,7 @@ var makeMediaCache = () => {
3963
4054
  };
3964
4055
  var globalMediaCache = makeMediaCache();
3965
4056
  var useRenderMediaCache = (logLevel) => {
3966
- const renderResourceManager = React2.useContext(Internals14.RenderResourceManagerContext);
4057
+ const renderResourceManager = React2.useContext(Internals15.RenderResourceManagerContext);
3967
4058
  if (renderResourceManager === null) {
3968
4059
  return globalMediaCache;
3969
4060
  }
@@ -3978,42 +4069,8 @@ var useRenderMediaCache = (logLevel) => {
3978
4069
  }
3979
4070
  });
3980
4071
  };
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
4072
  var useMaxMediaCacheSize = (logLevel) => {
4016
- const context = React2.useContext(Internals14.MaxMediaCacheSizeContext);
4073
+ const context = React2.useContext(Internals15.MaxMediaCacheSizeContext);
4017
4074
  if (context === null) {
4018
4075
  return getMaxVideoCacheSize(logLevel);
4019
4076
  }
@@ -4397,7 +4454,7 @@ var extractAudio = (params) => {
4397
4454
  };
4398
4455
 
4399
4456
  // src/video-extraction/extract-frame.ts
4400
- import { Internals as Internals15 } from "remotion";
4457
+ import { Internals as Internals16 } from "remotion";
4401
4458
  var extractFrameInternal = async ({
4402
4459
  src,
4403
4460
  timeInSeconds: unloopedTimeInSeconds,
@@ -4487,7 +4544,7 @@ var extractFrameInternal = async ({
4487
4544
  durationInSeconds: await sink.getDuration()
4488
4545
  };
4489
4546
  } catch (err) {
4490
- Internals15.Log.info({ logLevel, tag: "@remotion/media" }, `Error decoding ${src} at time ${timeInSeconds}: ${err}`, err);
4547
+ Internals16.Log.info({ logLevel, tag: "@remotion/media" }, `Error decoding ${src} at time ${timeInSeconds}: ${err}`, err);
4491
4548
  return { type: "cannot-decode", durationInSeconds: mediaDurationInSeconds };
4492
4549
  }
4493
4550
  };
@@ -4926,13 +4983,13 @@ var AudioForRendering = ({
4926
4983
  credentials,
4927
4984
  requestInit
4928
4985
  }) => {
4929
- const defaultLogLevel = Internals16.useLogLevel();
4986
+ const defaultLogLevel = Internals17.useLogLevel();
4930
4987
  const logLevel = overriddenLogLevel ?? defaultLogLevel;
4931
4988
  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();
4989
+ const absoluteFrame = Internals17.useTimelinePosition();
4990
+ const videoConfig = Internals17.useUnsafeVideoConfig();
4991
+ const { registerRenderAsset, unregisterRenderAsset } = useContext3(Internals17.RenderAssetManager);
4992
+ const startsAt = Internals17.useMediaStartsAt();
4936
4993
  const environment = useRemotionEnvironment();
4937
4994
  if (!videoConfig) {
4938
4995
  throw new Error("No video config found");
@@ -4944,7 +5001,7 @@ var AudioForRendering = ({
4944
5001
  const { delayRender, continueRender } = useDelayRender();
4945
5002
  const [replaceWithHtml5Audio, setReplaceWithHtml5Audio] = useState2(false);
4946
5003
  const [initialRequestInit] = useState2(requestInit);
4947
- const sequenceContext = useContext3(Internals16.SequenceContext);
5004
+ const sequenceContext = useContext3(Internals17.SequenceContext);
4948
5005
  const id = useMemo2(() => `media-audio-${random(src)}-${sequenceContext?.cumulatedFrom}-${sequenceContext?.relativeFrom}-${sequenceContext?.durationInFrames}`, [
4949
5006
  src,
4950
5007
  sequenceContext?.cumulatedFrom,
@@ -4953,7 +5010,7 @@ var AudioForRendering = ({
4953
5010
  ]);
4954
5011
  const maxCacheSize = useMaxMediaCacheSize(logLevel);
4955
5012
  const mediaCache = useRenderMediaCache(logLevel);
4956
- const audioEnabled = Internals16.useAudioEnabled();
5013
+ const audioEnabled = Internals17.useAudioEnabled();
4957
5014
  useLayoutEffect2(() => {
4958
5015
  const timestamp = frame / fps;
4959
5016
  const durationInSeconds = 1 / fps;
@@ -5009,7 +5066,7 @@ var AudioForRendering = ({
5009
5066
  if (action === "fail") {
5010
5067
  cancelRender2(errorToUse);
5011
5068
  }
5012
- Internals16.Log.warn({ logLevel, tag: "@remotion/media" }, fallbackMessage);
5069
+ Internals17.Log.warn({ logLevel, tag: "@remotion/media" }, fallbackMessage);
5013
5070
  setReplaceWithHtml5Audio(true);
5014
5071
  };
5015
5072
  if (result.type === "unknown-container-format") {
@@ -5039,12 +5096,12 @@ var AudioForRendering = ({
5039
5096
  frame,
5040
5097
  startsAt
5041
5098
  });
5042
- const volume = Internals16.evaluateVolume({
5099
+ const volume = Internals17.evaluateVolume({
5043
5100
  volume: volumeProp,
5044
5101
  frame: volumePropsFrame,
5045
5102
  mediaVolume: 1
5046
5103
  });
5047
- Internals16.warnAboutTooHighVolume(volume);
5104
+ Internals17.warnAboutTooHighVolume(volume);
5048
5105
  if (audio && volume > 0) {
5049
5106
  applyVolume(audio.data, volume);
5050
5107
  registerRenderAsset({
@@ -5127,7 +5184,7 @@ var AudioForRendering = ({
5127
5184
 
5128
5185
  // src/audio/audio.tsx
5129
5186
  import { jsx as jsx3 } from "react/jsx-runtime";
5130
- var { validateMediaProps } = Internals17;
5187
+ var { validateMediaProps } = Internals18;
5131
5188
  var audioSchema = {
5132
5189
  src: {
5133
5190
  type: "asset",
@@ -5135,8 +5192,8 @@ var audioSchema = {
5135
5192
  description: "Source",
5136
5193
  keyframable: false
5137
5194
  },
5138
- ...Internals17.baseSchema,
5139
- ...Internals17.premountSchema,
5195
+ ...Internals18.baseSchema,
5196
+ ...Internals18.premountSchema,
5140
5197
  volume: {
5141
5198
  type: "number",
5142
5199
  min: 0,
@@ -5172,12 +5229,12 @@ var AudioInner = (props) => {
5172
5229
  ...otherProps
5173
5230
  } = props;
5174
5231
  const environment = useRemotionEnvironment2();
5175
- const sourceStack = controls ? Internals17.getStackForControls(controls) : null;
5176
- const [mediaVolume] = Internals17.useMediaVolumeState();
5177
- const mediaStartsAt = Internals17.useMediaStartsAt();
5232
+ const sourceStack = controls ? Internals18.getStackForControls(controls) : null;
5233
+ const [mediaVolume] = Internals18.useMediaVolumeState();
5234
+ const mediaStartsAt = Internals18.useMediaStartsAt();
5178
5235
  const videoConfig = useVideoConfig2();
5179
5236
  const sequenceDurationInFrames = Math.min(durationInFrames ?? Infinity, Math.max(0, videoConfig.durationInFrames - (from ?? 0)));
5180
- const basicInfo = Internals17.useBasicMediaInTimeline({
5237
+ const basicInfo = Internals18.useBasicMediaInTimeline({
5181
5238
  src: props.src,
5182
5239
  volume: props.volume,
5183
5240
  playbackRate: props.playbackRate ?? 1,
@@ -5220,7 +5277,7 @@ var AudioInner = (props) => {
5220
5277
  postmountingActive,
5221
5278
  premountingActive,
5222
5279
  premountingStyle
5223
- } = Internals17.usePremounting({
5280
+ } = Internals18.usePremounting({
5224
5281
  from: from ?? 0,
5225
5282
  durationInFrames: basicInfo.duration,
5226
5283
  premountFor: premountFor ?? null,
@@ -5281,7 +5338,7 @@ var Audio = Interactive.withSchema({
5281
5338
  import React6, { useMemo as useMemo6, useState as useState6 } from "react";
5282
5339
  import {
5283
5340
  Freeze as Freeze2,
5284
- Internals as Internals22,
5341
+ Internals as Internals23,
5285
5342
  Interactive as Interactive2,
5286
5343
  Sequence as Sequence2,
5287
5344
  useRemotionEnvironment as useRemotionEnvironment4,
@@ -5289,7 +5346,7 @@ import {
5289
5346
  } from "remotion";
5290
5347
 
5291
5348
  // src/video/get-video-sequence-duration.ts
5292
- import { Internals as Internals18 } from "remotion";
5349
+ import { Internals as Internals19 } from "remotion";
5293
5350
  var getVideoSequenceDuration = ({
5294
5351
  durationInFrames,
5295
5352
  loop,
@@ -5300,7 +5357,7 @@ var getVideoSequenceDuration = ({
5300
5357
  if (loop || trimAfter === undefined) {
5301
5358
  return durationInFrames;
5302
5359
  }
5303
- const trimmedDuration = Internals18.calculateMediaDuration({
5360
+ const trimmedDuration = Internals19.calculateMediaDuration({
5304
5361
  trimAfter,
5305
5362
  trimBefore,
5306
5363
  playbackRate,
@@ -5321,7 +5378,7 @@ import {
5321
5378
  } from "react";
5322
5379
  import {
5323
5380
  Html5Video,
5324
- Internals as Internals20,
5381
+ Internals as Internals21,
5325
5382
  useBufferState as useBufferState2,
5326
5383
  useCurrentFrame as useCurrentFrame3,
5327
5384
  useVideoConfig as useVideoConfig3
@@ -5364,7 +5421,7 @@ var getCachedVideoFrame = (src) => {
5364
5421
  };
5365
5422
 
5366
5423
  // src/video/warn-object-fit-css.ts
5367
- import { Internals as Internals19 } from "remotion";
5424
+ import { Internals as Internals20 } from "remotion";
5368
5425
  var OBJECT_FIT_CLASS_PATTERN = /\bobject-(contain|cover|fill|none|scale-down)\b/;
5369
5426
  var warnedStyle = false;
5370
5427
  var warnedClassName = false;
@@ -5375,11 +5432,11 @@ var warnAboutObjectFitInStyleOrClassName = ({
5375
5432
  }) => {
5376
5433
  if (!warnedStyle && style?.objectFit) {
5377
5434
  warnedStyle = true;
5378
- Internals19.Log.warn({ logLevel, tag: "@remotion/media" }, "Use the `objectFit` prop instead of the `style` prop.");
5435
+ Internals20.Log.warn({ logLevel, tag: "@remotion/media" }, "Use the `objectFit` prop instead of the `style` prop.");
5379
5436
  }
5380
5437
  if (!warnedClassName && className && OBJECT_FIT_CLASS_PATTERN.test(className)) {
5381
5438
  warnedClassName = true;
5382
- Internals19.Log.warn({ logLevel, tag: "@remotion/media" }, "Use the `objectFit` prop instead of `object-*` CSS class names.");
5439
+ Internals20.Log.warn({ logLevel, tag: "@remotion/media" }, "Use the `objectFit` prop instead of `object-*` CSS class names.");
5383
5440
  }
5384
5441
  };
5385
5442
 
@@ -5397,7 +5454,7 @@ var {
5397
5454
  usePreload: usePreload2,
5398
5455
  SequenceContext: SequenceContext2,
5399
5456
  useEffectChainState
5400
- } = Internals20;
5457
+ } = Internals21;
5401
5458
  var VideoForPreviewAssertedShowing = ({
5402
5459
  src: unpreloadedSrc,
5403
5460
  style,
@@ -5440,7 +5497,7 @@ var VideoForPreviewAssertedShowing = ({
5440
5497
  const [mediaPlayerReady, setMediaPlayerReady] = useState4(false);
5441
5498
  const [shouldFallbackToNativeVideo, setShouldFallbackToNativeVideo] = useState4(false);
5442
5499
  const [playing] = Timeline2.usePlayingState();
5443
- const { playbackRate: globalPlaybackRate } = Internals20.usePlaybackRate();
5500
+ const { playbackRate: globalPlaybackRate } = Internals21.usePlaybackRate();
5444
5501
  const sharedAudioContext = useContext4(SharedAudioContext2);
5445
5502
  const buffer = useBufferState2();
5446
5503
  const canvasRefCallback = useCallback((canvas) => {
@@ -5477,12 +5534,12 @@ var VideoForPreviewAssertedShowing = ({
5477
5534
  const currentTimeRef = useRef2(currentTime);
5478
5535
  currentTimeRef.current = currentTime;
5479
5536
  const preloadedSrc = usePreload2(src);
5480
- const buffering = useContext4(Internals20.BufferingContextReact);
5537
+ const buffering = useContext4(Internals21.BufferingContextReact);
5481
5538
  if (!buffering) {
5482
5539
  throw new Error("useMediaPlayback must be used inside a <BufferingContext>");
5483
5540
  }
5484
5541
  const effectiveMuted = muted || playerMuted || userPreferredVolume <= 0;
5485
- const isPlayerBuffering = Internals20.useIsPlayerBuffering(buffering);
5542
+ const isPlayerBuffering = Internals21.useIsPlayerBuffering(buffering);
5486
5543
  const initialPlaying = useRef2(playing && !isPlayerBuffering);
5487
5544
  const initialIsPremounting = useRef2(isPremounting);
5488
5545
  const initialIsPostmounting = useRef2(isPostmounting);
@@ -5580,7 +5637,7 @@ var VideoForPreviewAssertedShowing = ({
5580
5637
  if (action === "fail") {
5581
5638
  throw errorToUse;
5582
5639
  }
5583
- Internals20.Log.warn({ logLevel, tag: "@remotion/media" }, fallbackMessage);
5640
+ Internals21.Log.warn({ logLevel, tag: "@remotion/media" }, fallbackMessage);
5584
5641
  setShouldFallbackToNativeVideo(true);
5585
5642
  };
5586
5643
  if (result.type === "unknown-container-format") {
@@ -5622,7 +5679,7 @@ var VideoForPreviewAssertedShowing = ({
5622
5679
  if (action === "fail") {
5623
5680
  throw errorToUse;
5624
5681
  }
5625
- Internals20.Log.error({ logLevel, tag: "@remotion/media" }, "[VideoForPreview] Failed to initialize MediaPlayer", errorToUse);
5682
+ Internals21.Log.error({ logLevel, tag: "@remotion/media" }, "[VideoForPreview] Failed to initialize MediaPlayer", errorToUse);
5626
5683
  setShouldFallbackToNativeVideo(true);
5627
5684
  });
5628
5685
  } catch (error) {
@@ -5636,12 +5693,12 @@ var VideoForPreviewAssertedShowing = ({
5636
5693
  if (action === "fail") {
5637
5694
  throw errorToUse;
5638
5695
  }
5639
- Internals20.Log.error({ logLevel, tag: "@remotion/media" }, "[VideoForPreview] MediaPlayer initialization failed", errorToUse);
5696
+ Internals21.Log.error({ logLevel, tag: "@remotion/media" }, "[VideoForPreview] MediaPlayer initialization failed", errorToUse);
5640
5697
  setShouldFallbackToNativeVideo(true);
5641
5698
  }
5642
5699
  return () => {
5643
5700
  if (mediaPlayerRef.current) {
5644
- Internals20.Log.trace({ logLevel, tag: "@remotion/media" }, `[VideoForPreview] Disposing MediaPlayer`);
5701
+ Internals21.Log.trace({ logLevel, tag: "@remotion/media" }, `[VideoForPreview] Disposing MediaPlayer`);
5645
5702
  mediaPlayerRef.current.dispose();
5646
5703
  mediaPlayerRef.current = null;
5647
5704
  }
@@ -5665,7 +5722,7 @@ var VideoForPreviewAssertedShowing = ({
5665
5722
  ]);
5666
5723
  warnAboutObjectFitInStyleOrClassName({ style, className, logLevel });
5667
5724
  const classNameValue = useMemo4(() => {
5668
- return [Internals20.OBJECTFIT_CONTAIN_CLASS_NAME, className].filter(Internals20.truthy).join(" ");
5725
+ return [Internals21.OBJECTFIT_CONTAIN_CLASS_NAME, className].filter(Internals21.truthy).join(" ");
5669
5726
  }, [className]);
5670
5727
  useCommonEffects({
5671
5728
  mediaPlayerRef,
@@ -5789,7 +5846,7 @@ import {
5789
5846
  useState as useState5
5790
5847
  } from "react";
5791
5848
  import {
5792
- Internals as Internals21,
5849
+ Internals as Internals22,
5793
5850
  Loop,
5794
5851
  random as random2,
5795
5852
  useCurrentFrame as useCurrentFrame4,
@@ -5830,11 +5887,11 @@ var VideoForRendering = ({
5830
5887
  throw new TypeError("No `src` was passed to <Video>.");
5831
5888
  }
5832
5889
  const frame = useCurrentFrame4();
5833
- const absoluteFrame = Internals21.useTimelinePosition();
5890
+ const absoluteFrame = Internals22.useTimelinePosition();
5834
5891
  const { fps } = useVideoConfig4();
5835
- const { registerRenderAsset, unregisterRenderAsset } = useContext5(Internals21.RenderAssetManager);
5836
- const startsAt = Internals21.useMediaStartsAt();
5837
- const sequenceContext = useContext5(Internals21.SequenceContext);
5892
+ const { registerRenderAsset, unregisterRenderAsset } = useContext5(Internals22.RenderAssetManager);
5893
+ const startsAt = Internals22.useMediaStartsAt();
5894
+ const sequenceContext = useContext5(Internals22.SequenceContext);
5838
5895
  const id = useMemo5(() => `media-video-${random2(src)}-${sequenceContext?.cumulatedFrom}-${sequenceContext?.relativeFrom}-${sequenceContext?.durationInFrames}`, [
5839
5896
  src,
5840
5897
  sequenceContext?.cumulatedFrom,
@@ -5846,11 +5903,11 @@ var VideoForRendering = ({
5846
5903
  const canvasRef = useRef3(null);
5847
5904
  const [replaceWithOffthreadVideo, setReplaceWithOffthreadVideo] = useState5(false);
5848
5905
  const [initialRequestInit] = useState5(requestInit);
5849
- const audioEnabled = Internals21.useAudioEnabled();
5850
- const videoEnabled = Internals21.useVideoEnabled();
5906
+ const audioEnabled = Internals22.useAudioEnabled();
5907
+ const videoEnabled = Internals22.useVideoEnabled();
5851
5908
  const maxCacheSize = useMaxMediaCacheSize(logLevel);
5852
5909
  const mediaCache = useRenderMediaCache(logLevel);
5853
- const effectChainState = Internals21.useEffectChainState();
5910
+ const effectChainState = Internals22.useEffectChainState();
5854
5911
  const [error, setError] = useState5(null);
5855
5912
  if (error) {
5856
5913
  throw error;
@@ -5922,7 +5979,7 @@ var VideoForRendering = ({
5922
5979
  return;
5923
5980
  }
5924
5981
  if (window.remotion_isMainTab) {
5925
- Internals21.Log.warn({ logLevel, tag: "@remotion/media" }, fallbackMessage);
5982
+ Internals22.Log.warn({ logLevel, tag: "@remotion/media" }, fallbackMessage);
5926
5983
  }
5927
5984
  setReplaceWithOffthreadVideo({
5928
5985
  durationInSeconds: mediaDurationInSeconds
@@ -5966,7 +6023,7 @@ var VideoForRendering = ({
5966
6023
  context.canvas.style.aspectRatio = `${context.canvas.width} / ${context.canvas.height}`;
5967
6024
  context.drawImage(imageBitmap, 0, 0);
5968
6025
  if (effects.length > 0) {
5969
- const completed = await Internals21.runEffectChain({
6026
+ const completed = await Internals22.runEffectChain({
5970
6027
  state: effectChainState.get(imageBitmap.width, imageBitmap.height),
5971
6028
  source: context.canvas,
5972
6029
  effects,
@@ -5997,12 +6054,12 @@ var VideoForRendering = ({
5997
6054
  frame,
5998
6055
  startsAt
5999
6056
  });
6000
- const volume = Internals21.evaluateVolume({
6057
+ const volume = Internals22.evaluateVolume({
6001
6058
  volume: volumeProp,
6002
6059
  frame: volumePropsFrame,
6003
6060
  mediaVolume: 1
6004
6061
  });
6005
- Internals21.warnAboutTooHighVolume(volume);
6062
+ Internals22.warnAboutTooHighVolume(volume);
6006
6063
  if (audio && volume > 0) {
6007
6064
  applyVolume(audio.data, volume);
6008
6065
  registerRenderAsset({
@@ -6067,7 +6124,7 @@ var VideoForRendering = ({
6067
6124
  ]);
6068
6125
  warnAboutObjectFitInStyleOrClassName({ style, className, logLevel });
6069
6126
  const classNameValue = useMemo5(() => {
6070
- return [Internals21.OBJECTFIT_CONTAIN_CLASS_NAME, className].filter(Internals21.truthy).join(" ");
6127
+ return [Internals22.OBJECTFIT_CONTAIN_CLASS_NAME, className].filter(Internals22.truthy).join(" ");
6071
6128
  }, [className]);
6072
6129
  const styleWithObjectFit = useMemo5(() => {
6073
6130
  return {
@@ -6076,7 +6133,7 @@ var VideoForRendering = ({
6076
6133
  };
6077
6134
  }, [objectFitProp, style]);
6078
6135
  if (replaceWithOffthreadVideo) {
6079
- const fallback = /* @__PURE__ */ jsx5(Internals21.InnerOffthreadVideo, {
6136
+ const fallback = /* @__PURE__ */ jsx5(Internals22.InnerOffthreadVideo, {
6080
6137
  ...props,
6081
6138
  src,
6082
6139
  playbackRate: playbackRate ?? 1,
@@ -6118,7 +6175,7 @@ var VideoForRendering = ({
6118
6175
  }
6119
6176
  return /* @__PURE__ */ jsx5(Loop, {
6120
6177
  layout: "none",
6121
- durationInFrames: Internals21.calculateMediaDuration({
6178
+ durationInFrames: Internals22.calculateMediaDuration({
6122
6179
  trimAfter: trimAfterValue,
6123
6180
  mediaDurationInFrames: replaceWithOffthreadVideo.durationInSeconds * fps,
6124
6181
  playbackRate,
@@ -6147,7 +6204,7 @@ var {
6147
6204
  resolveTrimProps,
6148
6205
  validateMediaProps: validateMediaProps2,
6149
6206
  useCropStyle
6150
- } = Internals22;
6207
+ } = Internals23;
6151
6208
  var videoSchema = {
6152
6209
  src: {
6153
6210
  type: "asset",
@@ -6155,8 +6212,8 @@ var videoSchema = {
6155
6212
  description: "Source",
6156
6213
  keyframable: false
6157
6214
  },
6158
- ...Internals22.baseSchema,
6159
- ...Internals22.premountSchema,
6215
+ ...Internals23.baseSchema,
6216
+ ...Internals23.premountSchema,
6160
6217
  volume: {
6161
6218
  type: "number",
6162
6219
  min: 0,
@@ -6177,7 +6234,7 @@ var videoSchema = {
6177
6234
  },
6178
6235
  muted: { type: "boolean", default: false, description: "Muted" },
6179
6236
  loop: { type: "boolean", default: false, description: "Loop" },
6180
- ...Internals22.transformSchema,
6237
+ ...Internals23.transformSchema,
6181
6238
  ...Interactive2.backgroundSchema,
6182
6239
  ...Interactive2.borderSchema,
6183
6240
  ...Interactive2.borderRadiusSchema,
@@ -6340,10 +6397,10 @@ var VideoInner = ({
6340
6397
  cropBottom,
6341
6398
  ...props
6342
6399
  }) => {
6343
- const sourceStack = controls ? Internals22.getStackForControls(controls) ?? undefined : undefined;
6344
- const fallbackLogLevel = Internals22.useLogLevel();
6345
- const [mediaVolume] = Internals22.useMediaVolumeState();
6346
- const mediaStartsAt = Internals22.useMediaStartsAt();
6400
+ const sourceStack = controls ? Internals23.getStackForControls(controls) ?? undefined : undefined;
6401
+ const fallbackLogLevel = Internals23.useLogLevel();
6402
+ const [mediaVolume] = Internals23.useMediaVolumeState();
6403
+ const mediaStartsAt = Internals23.useMediaStartsAt();
6347
6404
  const videoConfig = useVideoConfig5();
6348
6405
  const sequenceDurationInFrames = Math.min(durationInFrames ?? Infinity, Math.max(0, videoConfig.durationInFrames - (from ?? 0)));
6349
6406
  const videoSequenceDuration = getVideoSequenceDuration({
@@ -6353,7 +6410,7 @@ var VideoInner = ({
6353
6410
  trimAfter,
6354
6411
  trimBefore
6355
6412
  });
6356
- const basicInfo = Internals22.useBasicMediaInTimeline({
6413
+ const basicInfo = Internals23.useBasicMediaInTimeline({
6357
6414
  src,
6358
6415
  volume,
6359
6416
  playbackRate: playbackRate ?? 1,
@@ -6388,11 +6445,11 @@ var VideoInner = ({
6388
6445
  type: "video",
6389
6446
  data: basicInfo
6390
6447
  }), [basicInfo]);
6391
- const memoizedEffects = Internals22.useMemoizedEffects({
6448
+ const memoizedEffects = Internals23.useMemoizedEffects({
6392
6449
  effects: effects ?? [],
6393
6450
  overrideId: controls?.overrideId ?? null
6394
6451
  });
6395
- const memoizedEffectDefinitions = Internals22.useMemoizedEffectDefinitions(effects ?? []);
6452
+ const memoizedEffectDefinitions = Internals23.useMemoizedEffectDefinitions(effects ?? []);
6396
6453
  const refForOutline = React6.useRef(null);
6397
6454
  const {
6398
6455
  effectivePostmountFor,
@@ -6402,7 +6459,7 @@ var VideoInner = ({
6402
6459
  postmountingActive,
6403
6460
  premountingActive,
6404
6461
  premountingStyle
6405
- } = Internals22.usePremounting({
6462
+ } = Internals23.usePremounting({
6406
6463
  from: from ?? 0,
6407
6464
  durationInFrames: videoSequenceDuration ?? Infinity,
6408
6465
  premountFor: premountFor ?? null,
@@ -1,9 +1,10 @@
1
1
  import { Input } from 'mediabunny';
2
2
  import { type MediaRequestInit } from './request-init';
3
- export declare const acquireSharedInput: ({ src, credentials, requestInit, }: {
3
+ export declare const acquireSharedInput: ({ src, credentials, requestInit, logLevel, }: {
4
4
  src: string;
5
5
  credentials: RequestCredentials | undefined;
6
6
  requestInit: MediaRequestInit | undefined;
7
+ logLevel: "error" | "info" | "trace" | "verbose" | "warn";
7
8
  }) => {
8
9
  input: Input<import("mediabunny").Source>;
9
10
  cacheKey: string;
@@ -0,0 +1,3 @@
1
+ export declare const getMaxVideoCacheSize: (logLevel: "error" | "info" | "trace" | "verbose" | "warn") => number;
2
+ export declare const getMaxSourceCacheSizeFromBudget: (budget: number) => number;
3
+ export declare const getMaxSourceCacheSize: (logLevel: "error" | "info" | "trace" | "verbose" | "warn") => number;
@@ -18,6 +18,7 @@ export type KeyframeBank = {
18
18
  timestamps: number[];
19
19
  };
20
20
  getLastUsed: () => number;
21
+ isBusy: () => boolean;
21
22
  canSatisfyTimestamp: (timestamp: number) => boolean;
22
23
  getRangeOfTimestamps: () => {
23
24
  firstTimestamp: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/media",
3
- "version": "4.0.507",
3
+ "version": "4.0.508",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "module": "dist/esm/index.mjs",
@@ -23,7 +23,7 @@
23
23
  },
24
24
  "dependencies": {
25
25
  "mediabunny": "1.50.8",
26
- "remotion": "4.0.507",
26
+ "remotion": "4.0.508",
27
27
  "zod": "4.4.3"
28
28
  },
29
29
  "peerDependencies": {
@@ -31,8 +31,8 @@
31
31
  "react-dom": ">=16.8.0"
32
32
  },
33
33
  "devDependencies": {
34
- "@remotion/eslint-config-internal": "4.0.507",
35
- "@remotion/player": "4.0.507",
34
+ "@remotion/eslint-config-internal": "4.0.508",
35
+ "@remotion/player": "4.0.508",
36
36
  "@vitest/browser-webdriverio": "4.0.9",
37
37
  "eslint": "9.19.0",
38
38
  "react": "19.2.3",