@remotion/studio 4.0.372 → 4.0.374

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.
@@ -17615,7 +17615,7 @@ var loadPlaybackRate = () => {
17615
17615
 
17616
17616
  // src/components/PlaybackRatePersistor.tsx
17617
17617
  var PlaybackRatePersistor = () => {
17618
- const { setPlaybackRate, playbackRate } = useContext49(Internals40.Timeline.TimelineContext);
17618
+ const { setPlaybackRate, playbackRate } = useContext49(Internals40.TimelineContext);
17619
17619
  useEffect54(() => {
17620
17620
  setPlaybackRate(loadPlaybackRate());
17621
17621
  }, [setPlaybackRate]);
@@ -17924,7 +17924,35 @@ var TimelineZoomControls = () => {
17924
17924
  import ReactDOM8 from "react-dom/client";
17925
17925
  import { Internals as Internals44 } from "remotion";
17926
17926
  import { jsx as jsx176 } from "react/jsx-runtime";
17927
- var compose = ({
17927
+ var svgToImageBitmap = (svg) => {
17928
+ const computedStyle = getComputedStyle(svg);
17929
+ const { transform: originalTransform } = computedStyle;
17930
+ svg.style.transform = "none";
17931
+ const svgDimensions = svg.getBoundingClientRect();
17932
+ svg.style.transform = originalTransform;
17933
+ if (svgDimensions.width === 0 || svgDimensions.height === 0) {
17934
+ return Promise.resolve(null);
17935
+ }
17936
+ const svgData = new XMLSerializer().serializeToString(svg);
17937
+ return new Promise((resolve, reject) => {
17938
+ const image = new Image(svgDimensions.width, svgDimensions.height);
17939
+ const url = "data:image/svg+xml;base64," + window.btoa(svgData);
17940
+ image.onload = function() {
17941
+ resolve({
17942
+ image,
17943
+ width: svgDimensions.width,
17944
+ height: svgDimensions.height,
17945
+ left: svgDimensions.left,
17946
+ top: svgDimensions.top
17947
+ });
17948
+ };
17949
+ image.onerror = () => {
17950
+ reject(new Error("Failed to convert SVG to image"));
17951
+ };
17952
+ image.src = url;
17953
+ });
17954
+ };
17955
+ var compose = async ({
17928
17956
  composables,
17929
17957
  width,
17930
17958
  height
@@ -17935,7 +17963,15 @@ var compose = ({
17935
17963
  throw new Error("Could not get context");
17936
17964
  }
17937
17965
  for (const composable of composables) {
17938
- context.drawImage(composable, 0, 0);
17966
+ if (composable.type === "canvas") {
17967
+ const boundingClientRect = composable.element.getBoundingClientRect();
17968
+ context.drawImage(composable.element, boundingClientRect.left, boundingClientRect.top);
17969
+ } else if (composable.type === "svg") {
17970
+ const imageBitmap = await svgToImageBitmap(composable.element);
17971
+ if (imageBitmap) {
17972
+ context.drawImage(imageBitmap.image, imageBitmap.left, imageBitmap.top);
17973
+ }
17974
+ }
17939
17975
  }
17940
17976
  return canvas;
17941
17977
  };
@@ -17944,86 +17980,75 @@ var findCanvasElements = (element) => {
17944
17980
  const composables = [];
17945
17981
  Array.from(canvasElements).forEach((canvasElement) => {
17946
17982
  const canvas = canvasElement;
17947
- composables.push(canvas);
17983
+ composables.push({
17984
+ type: "canvas",
17985
+ element: canvas
17986
+ });
17948
17987
  });
17949
17988
  return composables;
17950
17989
  };
17951
- var waitForReady = (timeoutInMilliseconds) => {
17990
+ var findSvgElements = (element) => {
17991
+ const svgElements = element.querySelectorAll("svg");
17992
+ const composables = [];
17993
+ Array.from(svgElements).forEach((svgElement) => {
17994
+ const svg = svgElement;
17995
+ composables.push({
17996
+ type: "svg",
17997
+ element: svg
17998
+ });
17999
+ });
18000
+ return composables;
18001
+ };
18002
+ var waitForReady = (timeoutInMilliseconds, scope) => {
17952
18003
  const { promise, resolve, reject } = Promise.withResolvers();
17953
18004
  const start = Date.now();
17954
18005
  const interval = setInterval(() => {
17955
- if (window.remotion_renderReady === true) {
18006
+ if (scope.remotion_renderReady === true) {
17956
18007
  resolve(true);
17957
18008
  clearInterval(interval);
17958
18009
  return;
17959
18010
  }
17960
- if (window.remotion_cancelledError !== undefined) {
17961
- reject(window.remotion_cancelledError);
18011
+ if (scope.remotion_cancelledError !== undefined) {
18012
+ reject(scope.remotion_cancelledError);
17962
18013
  clearInterval(interval);
17963
18014
  return;
17964
18015
  }
17965
18016
  if (Date.now() - start > timeoutInMilliseconds + 3000) {
17966
- reject(new Error(Object.values(window.remotion_delayRenderTimeouts).map((d) => d.label).join(", ")));
18017
+ reject(new Error(Object.values(scope.remotion_delayRenderTimeouts).map((d) => d.label).join(", ")));
17967
18018
  clearInterval(interval);
17968
18019
  }
17969
18020
  }, 50);
17970
18021
  return promise;
17971
18022
  };
17972
- var renderStillOnWeb = async ({
18023
+ var COMP_ID = "markup";
18024
+ var internalRenderStillOnWeb = async ({
17973
18025
  Component,
17974
18026
  width,
17975
18027
  height,
17976
18028
  fps,
17977
18029
  durationInFrames,
17978
- frame: frame2
18030
+ frame: frame2,
18031
+ delayRenderTimeoutInMilliseconds,
18032
+ logLevel
17979
18033
  }) => {
17980
18034
  const div = document.createElement("div");
17981
18035
  div.style.display = "flex";
17982
18036
  div.style.backgroundColor = "transparent";
17983
- div.style.position = "absolute";
18037
+ div.style.position = "fixed";
17984
18038
  div.style.width = `${width}px`;
17985
18039
  div.style.height = `${height}px`;
18040
+ div.style.zIndex = "-9999";
17986
18041
  document.body.appendChild(div);
17987
- const delayRenderTimeoutInMilliseconds = 1e4;
17988
18042
  if (!ReactDOM8.createRoot) {
17989
18043
  throw new Error("@remotion/web-renderer requires React 18 or higher");
17990
18044
  }
17991
- const compositionManagerContext = {
17992
- currentCompositionMetadata: {
17993
- durationInFrames,
17994
- fps,
17995
- height,
17996
- width,
17997
- props: {},
17998
- defaultCodec: null,
17999
- defaultOutName: null,
18000
- defaultVideoImageFormat: null,
18001
- defaultPixelFormat: null,
18002
- defaultProResProfile: null
18003
- },
18004
- folders: [],
18005
- compositions: [
18006
- {
18007
- id: "markup",
18008
- component: Component,
18009
- nonce: 0,
18010
- defaultProps: undefined,
18011
- folderName: null,
18012
- parentFolderName: null,
18013
- schema: null,
18014
- calculateMetadata: null,
18015
- durationInFrames,
18016
- fps,
18017
- height,
18018
- width
18019
- }
18020
- ],
18021
- canvasContent: {
18022
- type: "composition",
18023
- compositionId: "markup"
18024
- }
18025
- };
18026
18045
  const root = ReactDOM8.createRoot(div);
18046
+ const delayRenderScope = {
18047
+ remotion_renderReady: true,
18048
+ remotion_delayRenderTimeouts: {},
18049
+ remotion_puppeteerTimeout: delayRenderTimeoutInMilliseconds,
18050
+ remotion_attempt: 0
18051
+ };
18027
18052
  root.render(/* @__PURE__ */ jsx176(Internals44.RemotionEnvironmentContext, {
18028
18053
  value: {
18029
18054
  isStudio: false,
@@ -18032,54 +18057,80 @@ var renderStillOnWeb = async ({
18032
18057
  isReadOnlyStudio: false,
18033
18058
  isClientSideRendering: true
18034
18059
  },
18035
- children: /* @__PURE__ */ jsx176(Internals44.RemotionRoot, {
18036
- audioEnabled: true,
18037
- videoEnabled: true,
18038
- logLevel: "info",
18039
- numberOfAudioTags: 0,
18040
- onlyRenderComposition: null,
18041
- currentCompositionMetadata: {
18042
- props: {},
18043
- durationInFrames,
18044
- fps,
18045
- height,
18046
- width,
18047
- defaultCodec: null,
18048
- defaultOutName: null,
18049
- defaultVideoImageFormat: null,
18050
- defaultPixelFormat: null,
18051
- defaultProResProfile: null
18052
- },
18053
- audioLatencyHint: "interactive",
18054
- children: /* @__PURE__ */ jsx176(Internals44.CanUseRemotionHooks, {
18055
- value: true,
18056
- children: /* @__PURE__ */ jsx176(Internals44.CompositionManager.Provider, {
18057
- value: compositionManagerContext,
18058
- children: /* @__PURE__ */ jsx176(Component, {})
18060
+ children: /* @__PURE__ */ jsx176(Internals44.DelayRenderContextType.Provider, {
18061
+ value: delayRenderScope,
18062
+ children: /* @__PURE__ */ jsx176(Internals44.CompositionManagerProvider, {
18063
+ initialCanvasContent: {
18064
+ type: "composition",
18065
+ compositionId: COMP_ID
18066
+ },
18067
+ onlyRenderComposition: null,
18068
+ currentCompositionMetadata: {
18069
+ props: {},
18070
+ durationInFrames,
18071
+ fps,
18072
+ height,
18073
+ width,
18074
+ defaultCodec: null,
18075
+ defaultOutName: null,
18076
+ defaultVideoImageFormat: null,
18077
+ defaultPixelFormat: null,
18078
+ defaultProResProfile: null
18079
+ },
18080
+ initialCompositions: [
18081
+ {
18082
+ id: COMP_ID,
18083
+ component: Component,
18084
+ nonce: 0,
18085
+ defaultProps: undefined,
18086
+ folderName: null,
18087
+ parentFolderName: null,
18088
+ schema: null,
18089
+ calculateMetadata: null,
18090
+ durationInFrames,
18091
+ fps,
18092
+ height,
18093
+ width
18094
+ }
18095
+ ],
18096
+ children: /* @__PURE__ */ jsx176(Internals44.RemotionRoot, {
18097
+ audioEnabled: false,
18098
+ videoEnabled: true,
18099
+ logLevel,
18100
+ numberOfAudioTags: 0,
18101
+ audioLatencyHint: "interactive",
18102
+ frameState: {
18103
+ [COMP_ID]: frame2
18104
+ },
18105
+ children: /* @__PURE__ */ jsx176(Internals44.CanUseRemotionHooks, {
18106
+ value: true,
18107
+ children: /* @__PURE__ */ jsx176(Component, {})
18108
+ })
18059
18109
  })
18060
18110
  })
18061
18111
  })
18062
18112
  }));
18063
- window.remotion_setFrame(frame2, "markup", frame2);
18064
- await waitForReady(delayRenderTimeoutInMilliseconds);
18113
+ await waitForReady(delayRenderTimeoutInMilliseconds, delayRenderScope);
18065
18114
  const canvasElements = findCanvasElements(div);
18066
- const composed = compose({
18067
- composables: canvasElements,
18115
+ const svgElements = findSvgElements(div);
18116
+ const composed = await compose({
18117
+ composables: [...canvasElements, ...svgElements],
18068
18118
  width,
18069
18119
  height
18070
18120
  });
18071
18121
  const imageData = await composed.convertToBlob({
18072
18122
  type: "image/png"
18073
18123
  });
18074
- const blob = new Blob([imageData], { type: "image/png" });
18075
- const url = URL.createObjectURL(blob);
18076
- const a = document.createElement("a");
18077
- a.href = url;
18078
- a.download = "composed.png";
18079
- a.click();
18080
- URL.revokeObjectURL(url);
18081
18124
  root.unmount();
18082
18125
  div.remove();
18126
+ return imageData;
18127
+ };
18128
+ var renderStillOnWeb = (options) => {
18129
+ return internalRenderStillOnWeb({
18130
+ ...options,
18131
+ delayRenderTimeoutInMilliseconds: options.delayRenderTimeoutInMilliseconds ?? 30000,
18132
+ logLevel: options.logLevel ?? "info"
18133
+ });
18083
18134
  };
18084
18135
 
18085
18136
  // src/components/WebRender/TriggerWebRender.tsx
@@ -18106,6 +18157,13 @@ var TriggerWebRender = () => {
18106
18157
  fps: video.fps,
18107
18158
  durationInFrames: video.durationInFrames,
18108
18159
  frame: frame2
18160
+ }).then((blob) => {
18161
+ const url = URL.createObjectURL(blob);
18162
+ const a = document.createElement("a");
18163
+ a.href = url;
18164
+ a.download = "composed.png";
18165
+ a.click();
18166
+ URL.revokeObjectURL(url);
18109
18167
  });
18110
18168
  }, [video, frame2]);
18111
18169
  return /* @__PURE__ */ jsx177(Button, {
@@ -18168,7 +18226,7 @@ var padding2 = {
18168
18226
  width: TIMELINE_PADDING
18169
18227
  };
18170
18228
  var PreviewToolbar = ({ readOnlyStudio, bufferStateDelayInMilliseconds }) => {
18171
- const { playbackRate, setPlaybackRate } = useContext53(Internals46.Timeline.TimelineContext);
18229
+ const { playbackRate, setPlaybackRate } = useContext53(Internals46.TimelineContext);
18172
18230
  const { mediaMuted } = useContext53(Internals46.MediaVolumeContext);
18173
18231
  const { setMediaMuted } = useContext53(Internals46.SetMediaVolumeContext);
18174
18232
  const isVideoComposition = useIsVideoComposition();
@@ -20449,7 +20507,7 @@ import { Internals as Internals52 } from "remotion";
20449
20507
  var lastTimelinePositionWhileScrolling = null;
20450
20508
  var TimelinePlayCursorSyncer = () => {
20451
20509
  const video = Internals52.useVideo();
20452
- const timelineContext = useContext65(Internals52.Timeline.TimelineContext);
20510
+ const timelineContext = useContext65(Internals52.TimelineContext);
20453
20511
  const timelinePosition = Internals52.Timeline.useTimelinePosition();
20454
20512
  const { canvasContent } = useContext65(Internals52.CompositionManager);
20455
20513
  const { zoom: zoomMap } = useContext65(TimelineZoomCtx);
@@ -20613,7 +20671,7 @@ var getTimelineSequenceLayout = ({
20613
20671
  // src/helpers/use-max-media-duration.ts
20614
20672
  import { getVideoMetadata as getVideoMetadata2 } from "@remotion/media-utils";
20615
20673
 
20616
- // ../../node_modules/.bun/mediabunny@1.24.2/node_modules/mediabunny/dist/modules/src/misc.js
20674
+ // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/misc.js
20617
20675
  /*!
20618
20676
  * Copyright (c) 2025-present, Vanilagy and contributors
20619
20677
  *
@@ -20965,13 +21023,13 @@ class CallSerializer {
20965
21023
  return this.currentPromise = this.currentPromise.then(fn);
20966
21024
  }
20967
21025
  }
20968
- var isSafariCache = null;
20969
- var isSafari = () => {
20970
- if (isSafariCache !== null) {
20971
- return isSafariCache;
21026
+ var isWebKitCache = null;
21027
+ var isWebKit = () => {
21028
+ if (isWebKitCache !== null) {
21029
+ return isWebKitCache;
20972
21030
  }
20973
- const result = !!(typeof navigator !== "undefined" && navigator.vendor?.match(/apple/i) && !navigator.userAgent?.match(/crios/i) && !navigator.userAgent?.match(/fxios/i) && !navigator.userAgent?.match(/Opera|OPT\//));
20974
- isSafariCache = result;
21031
+ const result = !!(typeof navigator !== "undefined" && navigator.vendor?.match(/apple/i));
21032
+ isWebKitCache = result;
20975
21033
  return result;
20976
21034
  };
20977
21035
  var isFirefoxCache = null;
@@ -21002,7 +21060,7 @@ var isNumber = (x) => {
21002
21060
  return typeof x === "number" && !Number.isNaN(x);
21003
21061
  };
21004
21062
 
21005
- // ../../node_modules/.bun/mediabunny@1.24.2/node_modules/mediabunny/dist/modules/src/tags.js
21063
+ // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/tags.js
21006
21064
  /*!
21007
21065
  * Copyright (c) 2025-present, Vanilagy and contributors
21008
21066
  *
@@ -21045,7 +21103,7 @@ class AttachedFile {
21045
21103
  }
21046
21104
  }
21047
21105
 
21048
- // ../../node_modules/.bun/mediabunny@1.24.2/node_modules/mediabunny/dist/modules/src/codec.js
21106
+ // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/codec.js
21049
21107
  /*!
21050
21108
  * Copyright (c) 2025-present, Vanilagy and contributors
21051
21109
  *
@@ -21318,7 +21376,7 @@ var parsePcmCodec = (codec) => {
21318
21376
  return { dataType, sampleSize, littleEndian, silentValue };
21319
21377
  };
21320
21378
 
21321
- // ../../node_modules/.bun/mediabunny@1.24.2/node_modules/mediabunny/dist/modules/src/codec-data.js
21379
+ // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/codec-data.js
21322
21380
  /*!
21323
21381
  * Copyright (c) 2025-present, Vanilagy and contributors
21324
21382
  *
@@ -22478,7 +22536,7 @@ var readVorbisComments = (bytes, metadataTags) => {
22478
22536
  }
22479
22537
  };
22480
22538
 
22481
- // ../../node_modules/.bun/mediabunny@1.24.2/node_modules/mediabunny/dist/modules/src/demuxer.js
22539
+ // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/demuxer.js
22482
22540
  /*!
22483
22541
  * Copyright (c) 2025-present, Vanilagy and contributors
22484
22542
  *
@@ -22493,7 +22551,7 @@ class Demuxer {
22493
22551
  }
22494
22552
  }
22495
22553
 
22496
- // ../../node_modules/.bun/mediabunny@1.24.2/node_modules/mediabunny/dist/modules/src/custom-coder.js
22554
+ // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/custom-coder.js
22497
22555
  /*!
22498
22556
  * Copyright (c) 2025-present, Vanilagy and contributors
22499
22557
  *
@@ -22504,7 +22562,7 @@ class Demuxer {
22504
22562
  var customVideoDecoders = [];
22505
22563
  var customAudioDecoders = [];
22506
22564
 
22507
- // ../../node_modules/.bun/mediabunny@1.24.2/node_modules/mediabunny/dist/modules/src/packet.js
22565
+ // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/packet.js
22508
22566
  /*!
22509
22567
  * Copyright (c) 2025-present, Vanilagy and contributors
22510
22568
  *
@@ -22636,7 +22694,7 @@ class EncodedPacket {
22636
22694
  }
22637
22695
  }
22638
22696
 
22639
- // ../../node_modules/.bun/mediabunny@1.24.2/node_modules/mediabunny/dist/modules/src/sample.js
22697
+ // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/sample.js
22640
22698
  /*!
22641
22699
  * Copyright (c) 2025-present, Vanilagy and contributors
22642
22700
  *
@@ -23084,7 +23142,7 @@ var validateCropRectangle = (crop, prefix) => {
23084
23142
  };
23085
23143
  var AUDIO_SAMPLE_FORMATS = new Set(["f32", "f32-planar", "s16", "s16-planar", "s32", "s32-planar", "u8", "u8-planar"]);
23086
23144
 
23087
- // ../../node_modules/.bun/mediabunny@1.24.2/node_modules/mediabunny/dist/modules/src/media-sink.js
23145
+ // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/media-sink.js
23088
23146
  /*!
23089
23147
  * Copyright (c) 2025-present, Vanilagy and contributors
23090
23148
  *
@@ -23678,7 +23736,7 @@ class VideoDecoderWrapper extends DecoderWrapper {
23678
23736
  this.customDecoderCallSerializer.call(() => this.customDecoder.decode(packet)).then(() => this.customDecoderQueueSize--);
23679
23737
  } else {
23680
23738
  assert(this.decoder);
23681
- if (!isSafari()) {
23739
+ if (!isWebKit()) {
23682
23740
  insertSorted(this.inputTimestamps, packet.timestamp, (x) => x);
23683
23741
  }
23684
23742
  this.decoder.decode(packet.toEncodedVideoChunk());
@@ -23768,7 +23826,7 @@ class VideoDecoderWrapper extends DecoderWrapper {
23768
23826
  });
23769
23827
  }
23770
23828
  sampleHandler(sample) {
23771
- if (isSafari()) {
23829
+ if (isWebKit()) {
23772
23830
  if (this.sampleQueue.length > 0 && sample.timestamp >= last(this.sampleQueue).timestamp) {
23773
23831
  for (const sample2 of this.sampleQueue) {
23774
23832
  this.finalizeAndEmitSample(sample2);
@@ -23826,7 +23884,7 @@ class VideoDecoderWrapper extends DecoderWrapper {
23826
23884
  this.currentAlphaPacketIndex = 0;
23827
23885
  this.alphaRaslSkipped = false;
23828
23886
  }
23829
- if (isSafari()) {
23887
+ if (isWebKit()) {
23830
23888
  for (const sample of this.sampleQueue) {
23831
23889
  this.finalizeAndEmitSample(sample);
23832
23890
  }
@@ -24014,7 +24072,7 @@ class VideoSampleSink extends BaseMediaSampleSink {
24014
24072
  }
24015
24073
  }
24016
24074
 
24017
- // ../../node_modules/.bun/mediabunny@1.24.2/node_modules/mediabunny/dist/modules/src/input-track.js
24075
+ // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/input-track.js
24018
24076
  /*!
24019
24077
  * Copyright (c) 2025-present, Vanilagy and contributors
24020
24078
  *
@@ -24220,7 +24278,7 @@ class InputAudioTrack extends InputTrack {
24220
24278
  }
24221
24279
  }
24222
24280
 
24223
- // ../../node_modules/.bun/mediabunny@1.24.2/node_modules/mediabunny/dist/modules/src/isobmff/isobmff-misc.js
24281
+ // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/isobmff/isobmff-misc.js
24224
24282
  /*!
24225
24283
  * Copyright (c) 2025-present, Vanilagy and contributors
24226
24284
  *
@@ -24238,7 +24296,7 @@ var buildIsobmffMimeType = (info) => {
24238
24296
  return string;
24239
24297
  };
24240
24298
 
24241
- // ../../node_modules/.bun/mediabunny@1.24.2/node_modules/mediabunny/dist/modules/src/isobmff/isobmff-reader.js
24299
+ // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/isobmff/isobmff-reader.js
24242
24300
  /*!
24243
24301
  * Copyright (c) 2025-present, Vanilagy and contributors
24244
24302
  *
@@ -24314,7 +24372,7 @@ var readDataBox = (slice) => {
24314
24372
  }
24315
24373
  };
24316
24374
 
24317
- // ../../node_modules/.bun/mediabunny@1.24.2/node_modules/mediabunny/dist/modules/src/isobmff/isobmff-demuxer.js
24375
+ // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/isobmff/isobmff-demuxer.js
24318
24376
  /*!
24319
24377
  * Copyright (c) 2025-present, Vanilagy and contributors
24320
24378
  *
@@ -26570,7 +26628,7 @@ var sampleTableIsEmpty = (sampleTable) => {
26570
26628
  return sampleTable.sampleSizes.length === 0;
26571
26629
  };
26572
26630
 
26573
- // ../../node_modules/.bun/mediabunny@1.24.2/node_modules/mediabunny/dist/modules/src/matroska/ebml.js
26631
+ // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/matroska/ebml.js
26574
26632
  /*!
26575
26633
  * Copyright (c) 2025-present, Vanilagy and contributors
26576
26634
  *
@@ -26888,7 +26946,7 @@ function assertDefinedSize(size4) {
26888
26946
  }
26889
26947
  }
26890
26948
 
26891
- // ../../node_modules/.bun/mediabunny@1.24.2/node_modules/mediabunny/dist/modules/src/matroska/matroska-misc.js
26949
+ // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/matroska/matroska-misc.js
26892
26950
  /*!
26893
26951
  * Copyright (c) 2025-present, Vanilagy and contributors
26894
26952
  *
@@ -26906,7 +26964,7 @@ var buildMatroskaMimeType = (info) => {
26906
26964
  return string;
26907
26965
  };
26908
26966
 
26909
- // ../../node_modules/.bun/mediabunny@1.24.2/node_modules/mediabunny/dist/modules/src/matroska/matroska-demuxer.js
26967
+ // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/matroska/matroska-demuxer.js
26910
26968
  /*!
26911
26969
  * Copyright (c) 2025-present, Vanilagy and contributors
26912
26970
  *
@@ -27366,10 +27424,10 @@ class MatroskaDemuxer extends Demuxer {
27366
27424
  }
27367
27425
  assert(frameSizes.length === frameCount);
27368
27426
  blocks.splice(blockIndex, 1);
27427
+ const blockDuration = originalBlock.duration || frameCount * (track.defaultDuration ?? 0);
27369
27428
  for (let i = 0;i < frameCount; i++) {
27370
27429
  const frameSize = frameSizes[i];
27371
27430
  const frameData = readBytes(slice, frameSize);
27372
- const blockDuration = originalBlock.duration || frameCount * (track.defaultDuration ?? 0);
27373
27431
  const frameTimestamp = originalBlock.timestamp + blockDuration * i / frameCount;
27374
27432
  const frameDuration = blockDuration / frameCount;
27375
27433
  blocks.splice(blockIndex + i, 0, {
@@ -28779,7 +28837,7 @@ var sortBlocksByReferences = (blocks) => {
28779
28837
  return result;
28780
28838
  };
28781
28839
 
28782
- // ../../node_modules/.bun/mediabunny@1.24.2/node_modules/mediabunny/dist/modules/shared/mp3-misc.js
28840
+ // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/shared/mp3-misc.js
28783
28841
  /*!
28784
28842
  * Copyright (c) 2025-present, Vanilagy and contributors
28785
28843
  *
@@ -29021,7 +29079,7 @@ var decodeSynchsafe = (synchsafed) => {
29021
29079
  return unsynchsafed;
29022
29080
  };
29023
29081
 
29024
- // ../../node_modules/.bun/mediabunny@1.24.2/node_modules/mediabunny/dist/modules/src/id3.js
29082
+ // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/id3.js
29025
29083
  /*!
29026
29084
  * Copyright (c) 2025-present, Vanilagy and contributors
29027
29085
  *
@@ -29721,7 +29779,7 @@ class Id3V2Reader {
29721
29779
  }
29722
29780
  }
29723
29781
 
29724
- // ../../node_modules/.bun/mediabunny@1.24.2/node_modules/mediabunny/dist/modules/src/mp3/mp3-reader.js
29782
+ // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/mp3/mp3-reader.js
29725
29783
  /*!
29726
29784
  * Copyright (c) 2025-present, Vanilagy and contributors
29727
29785
  *
@@ -29747,7 +29805,7 @@ var readNextFrameHeader = async (reader, startPos, until) => {
29747
29805
  return null;
29748
29806
  };
29749
29807
 
29750
- // ../../node_modules/.bun/mediabunny@1.24.2/node_modules/mediabunny/dist/modules/src/mp3/mp3-demuxer.js
29808
+ // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/mp3/mp3-demuxer.js
29751
29809
  /*!
29752
29810
  * Copyright (c) 2025-present, Vanilagy and contributors
29753
29811
  *
@@ -30007,7 +30065,7 @@ class Mp3AudioTrackBacking {
30007
30065
  }
30008
30066
  }
30009
30067
 
30010
- // ../../node_modules/.bun/mediabunny@1.24.2/node_modules/mediabunny/dist/modules/src/ogg/ogg-misc.js
30068
+ // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/ogg/ogg-misc.js
30011
30069
  /*!
30012
30070
  * Copyright (c) 2025-present, Vanilagy and contributors
30013
30071
  *
@@ -30078,7 +30136,7 @@ var buildOggMimeType = (info) => {
30078
30136
  return string;
30079
30137
  };
30080
30138
 
30081
- // ../../node_modules/.bun/mediabunny@1.24.2/node_modules/mediabunny/dist/modules/src/ogg/ogg-reader.js
30139
+ // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/ogg/ogg-reader.js
30082
30140
  /*!
30083
30141
  * Copyright (c) 2025-present, Vanilagy and contributors
30084
30142
  *
@@ -30142,7 +30200,7 @@ var findNextPageHeader = (slice, until) => {
30142
30200
  return false;
30143
30201
  };
30144
30202
 
30145
- // ../../node_modules/.bun/mediabunny@1.24.2/node_modules/mediabunny/dist/modules/src/ogg/ogg-demuxer.js
30203
+ // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/ogg/ogg-demuxer.js
30146
30204
  /*!
30147
30205
  * Copyright (c) 2025-present, Vanilagy and contributors
30148
30206
  *
@@ -30797,7 +30855,7 @@ var findPreviousPacketEndPosition = (pageList, startPage, startSegmentIndex) =>
30797
30855
  return { page: previousPage, segmentIndex: previousPage.lacingValues.length - 1 };
30798
30856
  };
30799
30857
 
30800
- // ../../node_modules/.bun/mediabunny@1.24.2/node_modules/mediabunny/dist/modules/src/wave/wave-demuxer.js
30858
+ // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/wave/wave-demuxer.js
30801
30859
  /*!
30802
30860
  * Copyright (c) 2025-present, Vanilagy and contributors
30803
30861
  *
@@ -31213,7 +31271,7 @@ class WaveAudioTrackBacking {
31213
31271
  }
31214
31272
  }
31215
31273
 
31216
- // ../../node_modules/.bun/mediabunny@1.24.2/node_modules/mediabunny/dist/modules/src/adts/adts-reader.js
31274
+ // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/adts/adts-reader.js
31217
31275
  /*!
31218
31276
  * Copyright (c) 2025-present, Vanilagy and contributors
31219
31277
  *
@@ -31274,7 +31332,7 @@ var readFrameHeader2 = (slice) => {
31274
31332
  };
31275
31333
  };
31276
31334
 
31277
- // ../../node_modules/.bun/mediabunny@1.24.2/node_modules/mediabunny/dist/modules/src/adts/adts-demuxer.js
31335
+ // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/adts/adts-demuxer.js
31278
31336
  /*!
31279
31337
  * Copyright (c) 2025-present, Vanilagy and contributors
31280
31338
  *
@@ -31490,7 +31548,7 @@ class AdtsAudioTrackBacking {
31490
31548
  }
31491
31549
  }
31492
31550
 
31493
- // ../../node_modules/.bun/mediabunny@1.24.2/node_modules/mediabunny/dist/modules/src/flac/flac-misc.js
31551
+ // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/flac/flac-misc.js
31494
31552
  /*!
31495
31553
  * Copyright (c) 2025-present, Vanilagy and contributors
31496
31554
  *
@@ -31625,7 +31683,7 @@ var calculateCrc8 = (data) => {
31625
31683
  return crc;
31626
31684
  };
31627
31685
 
31628
- // ../../node_modules/.bun/mediabunny@1.24.2/node_modules/mediabunny/dist/modules/src/flac/flac-demuxer.js
31686
+ // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/flac/flac-demuxer.js
31629
31687
  /*!
31630
31688
  * Copyright (c) 2025-present, Vanilagy and contributors
31631
31689
  *
@@ -31796,14 +31854,25 @@ class FlacDemuxer extends Demuxer {
31796
31854
  }
31797
31855
  slice.skip(-2);
31798
31856
  const lengthIfNextFlacFrameHeaderIsLegit = slice.filePos - startPos;
31799
- const nextIsLegit = this.readFlacFrameHeader({
31857
+ const nextFrameHeader = this.readFlacFrameHeader({
31800
31858
  slice,
31801
31859
  isFirstPacket: false
31802
31860
  });
31803
- if (!nextIsLegit) {
31861
+ if (!nextFrameHeader) {
31804
31862
  slice.skip(-1);
31805
31863
  continue;
31806
31864
  }
31865
+ if (this.blockingBit === 0) {
31866
+ if (nextFrameHeader.num - frameHeader.num !== 1) {
31867
+ slice.skip(-1);
31868
+ continue;
31869
+ }
31870
+ } else {
31871
+ if (nextFrameHeader.num - frameHeader.num !== frameHeader.blockSize) {
31872
+ slice.skip(-1);
31873
+ continue;
31874
+ }
31875
+ }
31807
31876
  return {
31808
31877
  num: frameHeader.num,
31809
31878
  blockSize: frameHeader.blockSize,
@@ -31862,6 +31931,9 @@ class FlacDemuxer extends Demuxer {
31862
31931
  if (sampleRate === null) {
31863
31932
  return null;
31864
31933
  }
31934
+ if (sampleRate !== this.audioInfo.sampleRate) {
31935
+ return null;
31936
+ }
31865
31937
  const size4 = slice.filePos - startOffset;
31866
31938
  const crc = readU8(slice);
31867
31939
  slice.skip(-size4);
@@ -32029,7 +32101,7 @@ class FlacAudioTrackBacking {
32029
32101
  }
32030
32102
  }
32031
32103
 
32032
- // ../../node_modules/.bun/mediabunny@1.24.2/node_modules/mediabunny/dist/modules/src/input-format.js
32104
+ // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/input-format.js
32033
32105
  /*!
32034
32106
  * Copyright (c) 2025-present, Vanilagy and contributors
32035
32107
  *
@@ -32351,7 +32423,7 @@ var ADTS = new AdtsInputFormat;
32351
32423
  var FLAC = new FlacInputFormat;
32352
32424
  var ALL_FORMATS = [MP4, QTFF, MATROSKA, WEBM, WAVE, OGG, FLAC, MP3, ADTS];
32353
32425
 
32354
- // ../../node_modules/.bun/mediabunny@1.24.2/node_modules/mediabunny/dist/modules/src/source.js
32426
+ // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/source.js
32355
32427
  var nodeAlias = (() => ({}));
32356
32428
  /*!
32357
32429
  * Copyright (c) 2025-present, Vanilagy and contributors
@@ -32469,7 +32541,7 @@ class UrlSource extends Source {
32469
32541
  return this._orchestrator.read(start, end);
32470
32542
  }
32471
32543
  async _runWorker(worker) {
32472
- while (!worker.aborted) {
32544
+ while (true) {
32473
32545
  const existing = this._existingResponses.get(worker);
32474
32546
  this._existingResponses.delete(worker);
32475
32547
  let abortController = existing?.abortController;
@@ -32518,6 +32590,9 @@ class UrlSource extends Source {
32518
32590
  throw error;
32519
32591
  }
32520
32592
  }
32593
+ if (worker.aborted) {
32594
+ break;
32595
+ }
32521
32596
  const { done, value } = readResult;
32522
32597
  if (done) {
32523
32598
  this._orchestrator.forgetWorker(worker);
@@ -32530,6 +32605,9 @@ class UrlSource extends Source {
32530
32605
  this.onread?.(worker.currentPos, worker.currentPos + value.length);
32531
32606
  this._orchestrator.supplyWorkerData(worker, value);
32532
32607
  }
32608
+ if (worker.aborted) {
32609
+ break;
32610
+ }
32533
32611
  }
32534
32612
  worker.running = false;
32535
32613
  }
@@ -32721,7 +32799,7 @@ class ReadOrchestrator {
32721
32799
  currentPos: startPos,
32722
32800
  targetPos,
32723
32801
  running: false,
32724
- aborted: false,
32802
+ aborted: this.disposed,
32725
32803
  pendingSlices: [],
32726
32804
  age: this.nextAge++
32727
32805
  };
@@ -32760,9 +32838,7 @@ class ReadOrchestrator {
32760
32838
  });
32761
32839
  }
32762
32840
  supplyWorkerData(worker, bytes) {
32763
- if (this.disposed) {
32764
- return;
32765
- }
32841
+ assert(!worker.aborted);
32766
32842
  const start = worker.currentPos;
32767
32843
  const end = start + bytes.length;
32768
32844
  this.insertIntoCache({
@@ -32889,7 +32965,7 @@ class ReadOrchestrator {
32889
32965
  }
32890
32966
  }
32891
32967
 
32892
- // ../../node_modules/.bun/mediabunny@1.24.2/node_modules/mediabunny/dist/modules/src/input.js
32968
+ // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/input.js
32893
32969
  /*!
32894
32970
  * Copyright (c) 2025-present, Vanilagy and contributors
32895
32971
  *
@@ -32996,7 +33072,7 @@ class InputDisposedError extends Error {
32996
33072
  }
32997
33073
  }
32998
33074
 
32999
- // ../../node_modules/.bun/mediabunny@1.24.2/node_modules/mediabunny/dist/modules/src/reader.js
33075
+ // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/reader.js
33000
33076
  /*!
33001
33077
  * Copyright (c) 2025-present, Vanilagy and contributors
33002
33078
  *
@@ -33214,7 +33290,7 @@ var readAscii = (slice, length) => {
33214
33290
  }
33215
33291
  return str;
33216
33292
  };
33217
- // ../../node_modules/.bun/mediabunny@1.24.2/node_modules/mediabunny/dist/modules/src/index.js
33293
+ // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/index.js
33218
33294
  /*!
33219
33295
  * Copyright (c) 2025-present, Vanilagy and contributors
33220
33296
  *
@@ -33549,7 +33625,7 @@ import { useVideoConfig as useVideoConfig5 } from "remotion";
33549
33625
  async function extractFrames({
33550
33626
  src,
33551
33627
  timestampsInSeconds,
33552
- onFrame,
33628
+ onVideoSample,
33553
33629
  signal
33554
33630
  }) {
33555
33631
  const input2 = new Input({
@@ -33590,8 +33666,7 @@ async function extractFrames({
33590
33666
  if (!videoSample) {
33591
33667
  continue;
33592
33668
  }
33593
- const videoFrame = videoSample.toVideoFrame();
33594
- onFrame(videoFrame);
33669
+ onVideoSample(videoSample);
33595
33670
  }
33596
33671
  } catch (error) {
33597
33672
  if (error instanceof InputDisposedError) {
@@ -33607,11 +33682,15 @@ async function extractFrames({
33607
33682
  }
33608
33683
 
33609
33684
  // src/helpers/frame-database.ts
33610
- var makeFrameDatabaseKey = (src, timestamp) => `${src}|${timestamp}`;
33685
+ var KEY_SEPARATOR = "|";
33686
+ var makeFrameDatabaseKey = (src, timestamp) => `${src}${KEY_SEPARATOR}${timestamp}`;
33687
+ var getFrameDatabaseKeyPrefix = (src) => {
33688
+ return `${src}${KEY_SEPARATOR}`;
33689
+ };
33611
33690
  var frameDatabase = new Map;
33612
33691
  var aspectRatioCache = new Map;
33613
33692
  var getTimestampFromFrameDatabaseKey = (key4) => {
33614
- const split = key4.split("|");
33693
+ const split = key4.split(KEY_SEPARATOR);
33615
33694
  return Number(split[split.length - 1]);
33616
33695
  };
33617
33696
  var getAspectRatioFromCache = (src) => {
@@ -33632,6 +33711,19 @@ var clearOldFrames = () => {
33632
33711
  frameDatabase.delete(key4);
33633
33712
  }
33634
33713
  };
33714
+ var clearFramesForSrc = (src) => {
33715
+ const keysToRemove = [];
33716
+ const prefix = getFrameDatabaseKeyPrefix(src);
33717
+ for (const [key4, frame2] of frameDatabase.entries()) {
33718
+ if (key4.startsWith(prefix)) {
33719
+ frame2.frame.close();
33720
+ keysToRemove.push(key4);
33721
+ }
33722
+ }
33723
+ for (const key4 of keysToRemove) {
33724
+ frameDatabase.delete(key4);
33725
+ }
33726
+ };
33635
33727
 
33636
33728
  // src/helpers/resize-video-frame.ts
33637
33729
  var calculateNewDimensionsFromScale = ({
@@ -33773,7 +33865,8 @@ var fillWithCachedFrames = ({
33773
33865
  segmentDuration,
33774
33866
  fromSeconds
33775
33867
  }) => {
33776
- const keys = Array.from(frameDatabase.keys()).filter((k) => k.startsWith(src));
33868
+ const prefix = getFrameDatabaseKeyPrefix(src);
33869
+ const keys = Array.from(frameDatabase.keys()).filter((k) => k.startsWith(prefix));
33777
33870
  const targets = Array.from(filledSlots.keys());
33778
33871
  for (const timestamp of targets) {
33779
33872
  let bestKey;
@@ -33842,6 +33935,11 @@ var TimelineVideoInfo = ({ src, visualizationWidth, startFrom, durationInFrames
33842
33935
  const ref = useRef37(null);
33843
33936
  const [error, setError] = useState67(null);
33844
33937
  const aspectRatio = useRef37(getAspectRatioFromCache(src));
33938
+ useEffect67(() => {
33939
+ return () => {
33940
+ clearFramesForSrc(src);
33941
+ };
33942
+ }, [src]);
33845
33943
  useEffect67(() => {
33846
33944
  if (error) {
33847
33945
  return;
@@ -33903,7 +34001,8 @@ var TimelineVideoInfo = ({ src, visualizationWidth, startFrom, durationInFrames
33903
34001
  return Array.from(filledSlots.keys()).map((timestamp) => timestamp / WEBCODECS_TIMESCALE);
33904
34002
  },
33905
34003
  src,
33906
- onFrame: (frame2) => {
34004
+ onVideoSample: (sample) => {
34005
+ const frame2 = sample.toVideoFrame();
33907
34006
  const scale = HEIGHT / frame2.displayHeight * window.devicePixelRatio;
33908
34007
  const transformed = resizeVideoFrame({
33909
34008
  frame: frame2,
@@ -42387,23 +42486,28 @@ var Studio = ({ rootComponent, readOnly }) => {
42387
42486
  useLayoutEffect2(() => {
42388
42487
  injectCSS();
42389
42488
  }, []);
42390
- return /* @__PURE__ */ jsx274(Internals67.RemotionRoot, {
42391
- audioEnabled: window.remotion_audioEnabled,
42392
- videoEnabled: window.remotion_videoEnabled,
42393
- logLevel: window.remotion_logLevel,
42394
- numberOfAudioTags: window.remotion_numberOfAudioTags,
42489
+ return /* @__PURE__ */ jsx274(Internals67.CompositionManagerProvider, {
42395
42490
  onlyRenderComposition: null,
42396
42491
  currentCompositionMetadata: null,
42397
- audioLatencyHint: window.remotion_audioLatencyHint ?? "interactive",
42398
- children: /* @__PURE__ */ jsxs141(EditorContexts, {
42399
- readOnlyStudio: readOnly,
42400
- children: [
42401
- /* @__PURE__ */ jsx274(Editor, {
42402
- readOnlyStudio: readOnly,
42403
- Root: rootComponent
42404
- }),
42405
- readOnly ? null : createPortal(/* @__PURE__ */ jsx274(ServerDisconnected, {}), getServerDisconnectedDomElement())
42406
- ]
42492
+ initialCompositions: [],
42493
+ initialCanvasContent: null,
42494
+ children: /* @__PURE__ */ jsx274(Internals67.RemotionRoot, {
42495
+ frameState: null,
42496
+ audioEnabled: window.remotion_audioEnabled,
42497
+ videoEnabled: window.remotion_videoEnabled,
42498
+ logLevel: window.remotion_logLevel,
42499
+ numberOfAudioTags: window.remotion_numberOfAudioTags,
42500
+ audioLatencyHint: window.remotion_audioLatencyHint ?? "interactive",
42501
+ children: /* @__PURE__ */ jsxs141(EditorContexts, {
42502
+ readOnlyStudio: readOnly,
42503
+ children: [
42504
+ /* @__PURE__ */ jsx274(Editor, {
42505
+ readOnlyStudio: readOnly,
42506
+ Root: rootComponent
42507
+ }),
42508
+ readOnly ? null : createPortal(/* @__PURE__ */ jsx274(ServerDisconnected, {}), getServerDisconnectedDomElement())
42509
+ ]
42510
+ })
42407
42511
  })
42408
42512
  });
42409
42513
  };