@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.
- package/dist/Studio.js +3 -3
- package/dist/components/PlaybackRatePersistor.js +1 -1
- package/dist/components/PreviewToolbar.js +1 -1
- package/dist/components/Timeline/TimelinePlayCursorSyncer.js +1 -1
- package/dist/components/Timeline/TimelineVideoInfo.js +10 -2
- package/dist/components/WebRender/TriggerWebRender.js +7 -0
- package/dist/esm/{chunk-f8dxt5wd.js → chunk-1bd2r4wv.js} +261 -157
- package/dist/esm/{chunk-dbhfqh6h.js → chunk-df4kyjv3.js} +224 -156
- package/dist/esm/{chunk-yntt83xt.js → chunk-dx9vebsw.js} +202 -114
- package/dist/esm/internals.mjs +204 -116
- package/dist/esm/previewEntry.mjs +204 -116
- package/dist/esm/renderEntry.mjs +30 -20
- package/dist/helpers/extract-frames.d.ts +3 -2
- package/dist/helpers/extract-frames.js +2 -3
- package/dist/helpers/frame-database.d.ts +2 -0
- package/dist/helpers/frame-database.js +22 -3
- package/dist/renderEntry.js +3 -3
- package/package.json +9 -9
- package/dist/can-decode.d.ts +0 -1
- package/dist/can-decode.js +0 -24
- package/dist/esm/chunk-bgfkgcmg.js +0 -25
|
@@ -17914,7 +17914,7 @@ var loadPlaybackRate = () => {
|
|
|
17914
17914
|
|
|
17915
17915
|
// src/components/PlaybackRatePersistor.tsx
|
|
17916
17916
|
var PlaybackRatePersistor = () => {
|
|
17917
|
-
const { setPlaybackRate, playbackRate } = useContext49(Internals40.
|
|
17917
|
+
const { setPlaybackRate, playbackRate } = useContext49(Internals40.TimelineContext);
|
|
17918
17918
|
useEffect54(() => {
|
|
17919
17919
|
setPlaybackRate(loadPlaybackRate());
|
|
17920
17920
|
}, [setPlaybackRate]);
|
|
@@ -18223,7 +18223,35 @@ var TimelineZoomControls = () => {
|
|
|
18223
18223
|
import ReactDOM8 from "react-dom/client";
|
|
18224
18224
|
import { Internals as Internals44 } from "remotion";
|
|
18225
18225
|
import { jsx as jsx177 } from "react/jsx-runtime";
|
|
18226
|
-
var
|
|
18226
|
+
var svgToImageBitmap = (svg) => {
|
|
18227
|
+
const computedStyle = getComputedStyle(svg);
|
|
18228
|
+
const { transform: originalTransform } = computedStyle;
|
|
18229
|
+
svg.style.transform = "none";
|
|
18230
|
+
const svgDimensions = svg.getBoundingClientRect();
|
|
18231
|
+
svg.style.transform = originalTransform;
|
|
18232
|
+
if (svgDimensions.width === 0 || svgDimensions.height === 0) {
|
|
18233
|
+
return Promise.resolve(null);
|
|
18234
|
+
}
|
|
18235
|
+
const svgData = new XMLSerializer().serializeToString(svg);
|
|
18236
|
+
return new Promise((resolve, reject) => {
|
|
18237
|
+
const image = new Image(svgDimensions.width, svgDimensions.height);
|
|
18238
|
+
const url = "data:image/svg+xml;base64," + window.btoa(svgData);
|
|
18239
|
+
image.onload = function() {
|
|
18240
|
+
resolve({
|
|
18241
|
+
image,
|
|
18242
|
+
width: svgDimensions.width,
|
|
18243
|
+
height: svgDimensions.height,
|
|
18244
|
+
left: svgDimensions.left,
|
|
18245
|
+
top: svgDimensions.top
|
|
18246
|
+
});
|
|
18247
|
+
};
|
|
18248
|
+
image.onerror = () => {
|
|
18249
|
+
reject(new Error("Failed to convert SVG to image"));
|
|
18250
|
+
};
|
|
18251
|
+
image.src = url;
|
|
18252
|
+
});
|
|
18253
|
+
};
|
|
18254
|
+
var compose = async ({
|
|
18227
18255
|
composables,
|
|
18228
18256
|
width,
|
|
18229
18257
|
height
|
|
@@ -18234,7 +18262,15 @@ var compose = ({
|
|
|
18234
18262
|
throw new Error("Could not get context");
|
|
18235
18263
|
}
|
|
18236
18264
|
for (const composable of composables) {
|
|
18237
|
-
|
|
18265
|
+
if (composable.type === "canvas") {
|
|
18266
|
+
const boundingClientRect = composable.element.getBoundingClientRect();
|
|
18267
|
+
context.drawImage(composable.element, boundingClientRect.left, boundingClientRect.top);
|
|
18268
|
+
} else if (composable.type === "svg") {
|
|
18269
|
+
const imageBitmap = await svgToImageBitmap(composable.element);
|
|
18270
|
+
if (imageBitmap) {
|
|
18271
|
+
context.drawImage(imageBitmap.image, imageBitmap.left, imageBitmap.top);
|
|
18272
|
+
}
|
|
18273
|
+
}
|
|
18238
18274
|
}
|
|
18239
18275
|
return canvas;
|
|
18240
18276
|
};
|
|
@@ -18243,86 +18279,75 @@ var findCanvasElements = (element) => {
|
|
|
18243
18279
|
const composables = [];
|
|
18244
18280
|
Array.from(canvasElements).forEach((canvasElement) => {
|
|
18245
18281
|
const canvas = canvasElement;
|
|
18246
|
-
composables.push(
|
|
18282
|
+
composables.push({
|
|
18283
|
+
type: "canvas",
|
|
18284
|
+
element: canvas
|
|
18285
|
+
});
|
|
18286
|
+
});
|
|
18287
|
+
return composables;
|
|
18288
|
+
};
|
|
18289
|
+
var findSvgElements = (element) => {
|
|
18290
|
+
const svgElements = element.querySelectorAll("svg");
|
|
18291
|
+
const composables = [];
|
|
18292
|
+
Array.from(svgElements).forEach((svgElement) => {
|
|
18293
|
+
const svg = svgElement;
|
|
18294
|
+
composables.push({
|
|
18295
|
+
type: "svg",
|
|
18296
|
+
element: svg
|
|
18297
|
+
});
|
|
18247
18298
|
});
|
|
18248
18299
|
return composables;
|
|
18249
18300
|
};
|
|
18250
|
-
var waitForReady = (timeoutInMilliseconds) => {
|
|
18301
|
+
var waitForReady = (timeoutInMilliseconds, scope) => {
|
|
18251
18302
|
const { promise, resolve, reject } = Promise.withResolvers();
|
|
18252
18303
|
const start = Date.now();
|
|
18253
18304
|
const interval = setInterval(() => {
|
|
18254
|
-
if (
|
|
18305
|
+
if (scope.remotion_renderReady === true) {
|
|
18255
18306
|
resolve(true);
|
|
18256
18307
|
clearInterval(interval);
|
|
18257
18308
|
return;
|
|
18258
18309
|
}
|
|
18259
|
-
if (
|
|
18260
|
-
reject(
|
|
18310
|
+
if (scope.remotion_cancelledError !== undefined) {
|
|
18311
|
+
reject(scope.remotion_cancelledError);
|
|
18261
18312
|
clearInterval(interval);
|
|
18262
18313
|
return;
|
|
18263
18314
|
}
|
|
18264
18315
|
if (Date.now() - start > timeoutInMilliseconds + 3000) {
|
|
18265
|
-
reject(new Error(Object.values(
|
|
18316
|
+
reject(new Error(Object.values(scope.remotion_delayRenderTimeouts).map((d) => d.label).join(", ")));
|
|
18266
18317
|
clearInterval(interval);
|
|
18267
18318
|
}
|
|
18268
18319
|
}, 50);
|
|
18269
18320
|
return promise;
|
|
18270
18321
|
};
|
|
18271
|
-
var
|
|
18322
|
+
var COMP_ID = "markup";
|
|
18323
|
+
var internalRenderStillOnWeb = async ({
|
|
18272
18324
|
Component,
|
|
18273
18325
|
width,
|
|
18274
18326
|
height,
|
|
18275
18327
|
fps,
|
|
18276
18328
|
durationInFrames,
|
|
18277
|
-
frame: frame2
|
|
18329
|
+
frame: frame2,
|
|
18330
|
+
delayRenderTimeoutInMilliseconds,
|
|
18331
|
+
logLevel
|
|
18278
18332
|
}) => {
|
|
18279
18333
|
const div = document.createElement("div");
|
|
18280
18334
|
div.style.display = "flex";
|
|
18281
18335
|
div.style.backgroundColor = "transparent";
|
|
18282
|
-
div.style.position = "
|
|
18336
|
+
div.style.position = "fixed";
|
|
18283
18337
|
div.style.width = `${width}px`;
|
|
18284
18338
|
div.style.height = `${height}px`;
|
|
18339
|
+
div.style.zIndex = "-9999";
|
|
18285
18340
|
document.body.appendChild(div);
|
|
18286
|
-
const delayRenderTimeoutInMilliseconds = 1e4;
|
|
18287
18341
|
if (!ReactDOM8.createRoot) {
|
|
18288
18342
|
throw new Error("@remotion/web-renderer requires React 18 or higher");
|
|
18289
18343
|
}
|
|
18290
|
-
const compositionManagerContext = {
|
|
18291
|
-
currentCompositionMetadata: {
|
|
18292
|
-
durationInFrames,
|
|
18293
|
-
fps,
|
|
18294
|
-
height,
|
|
18295
|
-
width,
|
|
18296
|
-
props: {},
|
|
18297
|
-
defaultCodec: null,
|
|
18298
|
-
defaultOutName: null,
|
|
18299
|
-
defaultVideoImageFormat: null,
|
|
18300
|
-
defaultPixelFormat: null,
|
|
18301
|
-
defaultProResProfile: null
|
|
18302
|
-
},
|
|
18303
|
-
folders: [],
|
|
18304
|
-
compositions: [
|
|
18305
|
-
{
|
|
18306
|
-
id: "markup",
|
|
18307
|
-
component: Component,
|
|
18308
|
-
nonce: 0,
|
|
18309
|
-
defaultProps: undefined,
|
|
18310
|
-
folderName: null,
|
|
18311
|
-
parentFolderName: null,
|
|
18312
|
-
schema: null,
|
|
18313
|
-
calculateMetadata: null,
|
|
18314
|
-
durationInFrames,
|
|
18315
|
-
fps,
|
|
18316
|
-
height,
|
|
18317
|
-
width
|
|
18318
|
-
}
|
|
18319
|
-
],
|
|
18320
|
-
canvasContent: {
|
|
18321
|
-
type: "composition",
|
|
18322
|
-
compositionId: "markup"
|
|
18323
|
-
}
|
|
18324
|
-
};
|
|
18325
18344
|
const root = ReactDOM8.createRoot(div);
|
|
18345
|
+
const delayRenderScope = {
|
|
18346
|
+
remotion_renderReady: true,
|
|
18347
|
+
remotion_delayRenderTimeouts: {},
|
|
18348
|
+
remotion_puppeteerTimeout: delayRenderTimeoutInMilliseconds,
|
|
18349
|
+
remotion_attempt: 0
|
|
18350
|
+
};
|
|
18326
18351
|
root.render(/* @__PURE__ */ jsx177(Internals44.RemotionEnvironmentContext, {
|
|
18327
18352
|
value: {
|
|
18328
18353
|
isStudio: false,
|
|
@@ -18331,54 +18356,80 @@ var renderStillOnWeb = async ({
|
|
|
18331
18356
|
isReadOnlyStudio: false,
|
|
18332
18357
|
isClientSideRendering: true
|
|
18333
18358
|
},
|
|
18334
|
-
children: /* @__PURE__ */ jsx177(Internals44.
|
|
18335
|
-
|
|
18336
|
-
|
|
18337
|
-
|
|
18338
|
-
|
|
18339
|
-
|
|
18340
|
-
|
|
18341
|
-
|
|
18342
|
-
|
|
18343
|
-
|
|
18344
|
-
|
|
18345
|
-
|
|
18346
|
-
|
|
18347
|
-
|
|
18348
|
-
|
|
18349
|
-
|
|
18350
|
-
|
|
18351
|
-
|
|
18352
|
-
|
|
18353
|
-
|
|
18354
|
-
|
|
18355
|
-
|
|
18356
|
-
|
|
18357
|
-
|
|
18359
|
+
children: /* @__PURE__ */ jsx177(Internals44.DelayRenderContextType.Provider, {
|
|
18360
|
+
value: delayRenderScope,
|
|
18361
|
+
children: /* @__PURE__ */ jsx177(Internals44.CompositionManagerProvider, {
|
|
18362
|
+
initialCanvasContent: {
|
|
18363
|
+
type: "composition",
|
|
18364
|
+
compositionId: COMP_ID
|
|
18365
|
+
},
|
|
18366
|
+
onlyRenderComposition: null,
|
|
18367
|
+
currentCompositionMetadata: {
|
|
18368
|
+
props: {},
|
|
18369
|
+
durationInFrames,
|
|
18370
|
+
fps,
|
|
18371
|
+
height,
|
|
18372
|
+
width,
|
|
18373
|
+
defaultCodec: null,
|
|
18374
|
+
defaultOutName: null,
|
|
18375
|
+
defaultVideoImageFormat: null,
|
|
18376
|
+
defaultPixelFormat: null,
|
|
18377
|
+
defaultProResProfile: null
|
|
18378
|
+
},
|
|
18379
|
+
initialCompositions: [
|
|
18380
|
+
{
|
|
18381
|
+
id: COMP_ID,
|
|
18382
|
+
component: Component,
|
|
18383
|
+
nonce: 0,
|
|
18384
|
+
defaultProps: undefined,
|
|
18385
|
+
folderName: null,
|
|
18386
|
+
parentFolderName: null,
|
|
18387
|
+
schema: null,
|
|
18388
|
+
calculateMetadata: null,
|
|
18389
|
+
durationInFrames,
|
|
18390
|
+
fps,
|
|
18391
|
+
height,
|
|
18392
|
+
width
|
|
18393
|
+
}
|
|
18394
|
+
],
|
|
18395
|
+
children: /* @__PURE__ */ jsx177(Internals44.RemotionRoot, {
|
|
18396
|
+
audioEnabled: false,
|
|
18397
|
+
videoEnabled: true,
|
|
18398
|
+
logLevel,
|
|
18399
|
+
numberOfAudioTags: 0,
|
|
18400
|
+
audioLatencyHint: "interactive",
|
|
18401
|
+
frameState: {
|
|
18402
|
+
[COMP_ID]: frame2
|
|
18403
|
+
},
|
|
18404
|
+
children: /* @__PURE__ */ jsx177(Internals44.CanUseRemotionHooks, {
|
|
18405
|
+
value: true,
|
|
18406
|
+
children: /* @__PURE__ */ jsx177(Component, {})
|
|
18407
|
+
})
|
|
18358
18408
|
})
|
|
18359
18409
|
})
|
|
18360
18410
|
})
|
|
18361
18411
|
}));
|
|
18362
|
-
|
|
18363
|
-
await waitForReady(delayRenderTimeoutInMilliseconds);
|
|
18412
|
+
await waitForReady(delayRenderTimeoutInMilliseconds, delayRenderScope);
|
|
18364
18413
|
const canvasElements = findCanvasElements(div);
|
|
18365
|
-
const
|
|
18366
|
-
|
|
18414
|
+
const svgElements = findSvgElements(div);
|
|
18415
|
+
const composed = await compose({
|
|
18416
|
+
composables: [...canvasElements, ...svgElements],
|
|
18367
18417
|
width,
|
|
18368
18418
|
height
|
|
18369
18419
|
});
|
|
18370
18420
|
const imageData = await composed.convertToBlob({
|
|
18371
18421
|
type: "image/png"
|
|
18372
18422
|
});
|
|
18373
|
-
const blob = new Blob([imageData], { type: "image/png" });
|
|
18374
|
-
const url = URL.createObjectURL(blob);
|
|
18375
|
-
const a = document.createElement("a");
|
|
18376
|
-
a.href = url;
|
|
18377
|
-
a.download = "composed.png";
|
|
18378
|
-
a.click();
|
|
18379
|
-
URL.revokeObjectURL(url);
|
|
18380
18423
|
root.unmount();
|
|
18381
18424
|
div.remove();
|
|
18425
|
+
return imageData;
|
|
18426
|
+
};
|
|
18427
|
+
var renderStillOnWeb = (options) => {
|
|
18428
|
+
return internalRenderStillOnWeb({
|
|
18429
|
+
...options,
|
|
18430
|
+
delayRenderTimeoutInMilliseconds: options.delayRenderTimeoutInMilliseconds ?? 30000,
|
|
18431
|
+
logLevel: options.logLevel ?? "info"
|
|
18432
|
+
});
|
|
18382
18433
|
};
|
|
18383
18434
|
|
|
18384
18435
|
// src/components/WebRender/TriggerWebRender.tsx
|
|
@@ -18405,6 +18456,13 @@ var TriggerWebRender = () => {
|
|
|
18405
18456
|
fps: video.fps,
|
|
18406
18457
|
durationInFrames: video.durationInFrames,
|
|
18407
18458
|
frame: frame2
|
|
18459
|
+
}).then((blob) => {
|
|
18460
|
+
const url = URL.createObjectURL(blob);
|
|
18461
|
+
const a = document.createElement("a");
|
|
18462
|
+
a.href = url;
|
|
18463
|
+
a.download = "composed.png";
|
|
18464
|
+
a.click();
|
|
18465
|
+
URL.revokeObjectURL(url);
|
|
18408
18466
|
});
|
|
18409
18467
|
}, [video, frame2]);
|
|
18410
18468
|
return /* @__PURE__ */ jsx178(Button, {
|
|
@@ -18467,7 +18525,7 @@ var padding2 = {
|
|
|
18467
18525
|
width: TIMELINE_PADDING
|
|
18468
18526
|
};
|
|
18469
18527
|
var PreviewToolbar = ({ readOnlyStudio, bufferStateDelayInMilliseconds }) => {
|
|
18470
|
-
const { playbackRate, setPlaybackRate } = useContext53(Internals46.
|
|
18528
|
+
const { playbackRate, setPlaybackRate } = useContext53(Internals46.TimelineContext);
|
|
18471
18529
|
const { mediaMuted } = useContext53(Internals46.MediaVolumeContext);
|
|
18472
18530
|
const { setMediaMuted } = useContext53(Internals46.SetMediaVolumeContext);
|
|
18473
18531
|
const isVideoComposition = useIsVideoComposition();
|
|
@@ -20748,7 +20806,7 @@ import { Internals as Internals52 } from "remotion";
|
|
|
20748
20806
|
var lastTimelinePositionWhileScrolling = null;
|
|
20749
20807
|
var TimelinePlayCursorSyncer = () => {
|
|
20750
20808
|
const video = Internals52.useVideo();
|
|
20751
|
-
const timelineContext = useContext65(Internals52.
|
|
20809
|
+
const timelineContext = useContext65(Internals52.TimelineContext);
|
|
20752
20810
|
const timelinePosition = Internals52.Timeline.useTimelinePosition();
|
|
20753
20811
|
const { canvasContent } = useContext65(Internals52.CompositionManager);
|
|
20754
20812
|
const { zoom: zoomMap } = useContext65(TimelineZoomCtx);
|
|
@@ -32103,6 +32161,12 @@ class FlacDemuxer extends Demuxer {
|
|
|
32103
32161
|
slice.skip(-1);
|
|
32104
32162
|
continue;
|
|
32105
32163
|
}
|
|
32164
|
+
if (nextIsLegit.num - frameHeader.num !== 1) {
|
|
32165
|
+
console.log("skipping", nextIsLegit.num, frameHeader.num);
|
|
32166
|
+
slice.skip(-1);
|
|
32167
|
+
continue;
|
|
32168
|
+
}
|
|
32169
|
+
console.log(frameHeader.num, nextIsLegit.num, slice.filePos);
|
|
32106
32170
|
return {
|
|
32107
32171
|
num: frameHeader.num,
|
|
32108
32172
|
blockSize: frameHeader.blockSize,
|
|
@@ -32768,7 +32832,7 @@ class UrlSource extends Source {
|
|
|
32768
32832
|
return this._orchestrator.read(start, end);
|
|
32769
32833
|
}
|
|
32770
32834
|
async _runWorker(worker) {
|
|
32771
|
-
while (
|
|
32835
|
+
while (!worker.aborted) {
|
|
32772
32836
|
const existing = this._existingResponses.get(worker);
|
|
32773
32837
|
this._existingResponses.delete(worker);
|
|
32774
32838
|
let abortController = existing?.abortController;
|
|
@@ -32817,9 +32881,6 @@ class UrlSource extends Source {
|
|
|
32817
32881
|
throw error;
|
|
32818
32882
|
}
|
|
32819
32883
|
}
|
|
32820
|
-
if (worker.aborted) {
|
|
32821
|
-
break;
|
|
32822
|
-
}
|
|
32823
32884
|
const { done, value } = readResult;
|
|
32824
32885
|
if (done) {
|
|
32825
32886
|
this._orchestrator.forgetWorker(worker);
|
|
@@ -32832,9 +32893,6 @@ class UrlSource extends Source {
|
|
|
32832
32893
|
this.onread?.(worker.currentPos, worker.currentPos + value.length);
|
|
32833
32894
|
this._orchestrator.supplyWorkerData(worker, value);
|
|
32834
32895
|
}
|
|
32835
|
-
if (worker.aborted) {
|
|
32836
|
-
break;
|
|
32837
|
-
}
|
|
32838
32896
|
}
|
|
32839
32897
|
worker.running = false;
|
|
32840
32898
|
}
|
|
@@ -33026,7 +33084,7 @@ class ReadOrchestrator {
|
|
|
33026
33084
|
currentPos: startPos,
|
|
33027
33085
|
targetPos,
|
|
33028
33086
|
running: false,
|
|
33029
|
-
aborted:
|
|
33087
|
+
aborted: false,
|
|
33030
33088
|
pendingSlices: [],
|
|
33031
33089
|
age: this.nextAge++
|
|
33032
33090
|
};
|
|
@@ -33065,7 +33123,9 @@ class ReadOrchestrator {
|
|
|
33065
33123
|
});
|
|
33066
33124
|
}
|
|
33067
33125
|
supplyWorkerData(worker, bytes) {
|
|
33068
|
-
|
|
33126
|
+
if (this.disposed) {
|
|
33127
|
+
return;
|
|
33128
|
+
}
|
|
33069
33129
|
const start = worker.currentPos;
|
|
33070
33130
|
const end = start + bytes.length;
|
|
33071
33131
|
this.insertIntoCache({
|
|
@@ -33852,7 +33912,7 @@ import { useVideoConfig as useVideoConfig5 } from "remotion";
|
|
|
33852
33912
|
async function extractFrames({
|
|
33853
33913
|
src,
|
|
33854
33914
|
timestampsInSeconds,
|
|
33855
|
-
|
|
33915
|
+
onVideoSample,
|
|
33856
33916
|
signal
|
|
33857
33917
|
}) {
|
|
33858
33918
|
const input2 = new Input({
|
|
@@ -33893,8 +33953,7 @@ async function extractFrames({
|
|
|
33893
33953
|
if (!videoSample) {
|
|
33894
33954
|
continue;
|
|
33895
33955
|
}
|
|
33896
|
-
|
|
33897
|
-
onFrame(videoFrame);
|
|
33956
|
+
onVideoSample(videoSample);
|
|
33898
33957
|
}
|
|
33899
33958
|
} catch (error) {
|
|
33900
33959
|
if (error instanceof InputDisposedError) {
|
|
@@ -33910,11 +33969,15 @@ async function extractFrames({
|
|
|
33910
33969
|
}
|
|
33911
33970
|
|
|
33912
33971
|
// src/helpers/frame-database.ts
|
|
33913
|
-
var
|
|
33972
|
+
var KEY_SEPARATOR = "|";
|
|
33973
|
+
var makeFrameDatabaseKey = (src, timestamp) => `${src}${KEY_SEPARATOR}${timestamp}`;
|
|
33974
|
+
var getFrameDatabaseKeyPrefix = (src) => {
|
|
33975
|
+
return `${src}${KEY_SEPARATOR}`;
|
|
33976
|
+
};
|
|
33914
33977
|
var frameDatabase = new Map;
|
|
33915
33978
|
var aspectRatioCache = new Map;
|
|
33916
33979
|
var getTimestampFromFrameDatabaseKey = (key4) => {
|
|
33917
|
-
const split = key4.split(
|
|
33980
|
+
const split = key4.split(KEY_SEPARATOR);
|
|
33918
33981
|
return Number(split[split.length - 1]);
|
|
33919
33982
|
};
|
|
33920
33983
|
var getAspectRatioFromCache = (src) => {
|
|
@@ -33935,6 +33998,19 @@ var clearOldFrames = () => {
|
|
|
33935
33998
|
frameDatabase.delete(key4);
|
|
33936
33999
|
}
|
|
33937
34000
|
};
|
|
34001
|
+
var clearFramesForSrc = (src) => {
|
|
34002
|
+
const keysToRemove = [];
|
|
34003
|
+
const prefix = getFrameDatabaseKeyPrefix(src);
|
|
34004
|
+
for (const [key4, frame2] of frameDatabase.entries()) {
|
|
34005
|
+
if (key4.startsWith(prefix)) {
|
|
34006
|
+
frame2.frame.close();
|
|
34007
|
+
keysToRemove.push(key4);
|
|
34008
|
+
}
|
|
34009
|
+
}
|
|
34010
|
+
for (const key4 of keysToRemove) {
|
|
34011
|
+
frameDatabase.delete(key4);
|
|
34012
|
+
}
|
|
34013
|
+
};
|
|
33938
34014
|
|
|
33939
34015
|
// src/helpers/resize-video-frame.ts
|
|
33940
34016
|
var calculateNewDimensionsFromScale = ({
|
|
@@ -34076,7 +34152,8 @@ var fillWithCachedFrames = ({
|
|
|
34076
34152
|
segmentDuration,
|
|
34077
34153
|
fromSeconds
|
|
34078
34154
|
}) => {
|
|
34079
|
-
const
|
|
34155
|
+
const prefix = getFrameDatabaseKeyPrefix(src);
|
|
34156
|
+
const keys = Array.from(frameDatabase.keys()).filter((k) => k.startsWith(prefix));
|
|
34080
34157
|
const targets = Array.from(filledSlots.keys());
|
|
34081
34158
|
for (const timestamp of targets) {
|
|
34082
34159
|
let bestKey;
|
|
@@ -34145,6 +34222,11 @@ var TimelineVideoInfo = ({ src, visualizationWidth, startFrom, durationInFrames
|
|
|
34145
34222
|
const ref = useRef37(null);
|
|
34146
34223
|
const [error, setError] = useState68(null);
|
|
34147
34224
|
const aspectRatio = useRef37(getAspectRatioFromCache(src));
|
|
34225
|
+
useEffect67(() => {
|
|
34226
|
+
return () => {
|
|
34227
|
+
clearFramesForSrc(src);
|
|
34228
|
+
};
|
|
34229
|
+
}, [src]);
|
|
34148
34230
|
useEffect67(() => {
|
|
34149
34231
|
if (error) {
|
|
34150
34232
|
return;
|
|
@@ -34206,7 +34288,8 @@ var TimelineVideoInfo = ({ src, visualizationWidth, startFrom, durationInFrames
|
|
|
34206
34288
|
return Array.from(filledSlots.keys()).map((timestamp) => timestamp / WEBCODECS_TIMESCALE);
|
|
34207
34289
|
},
|
|
34208
34290
|
src,
|
|
34209
|
-
|
|
34291
|
+
onVideoSample: (sample) => {
|
|
34292
|
+
const frame2 = sample.toVideoFrame();
|
|
34210
34293
|
const scale = HEIGHT / frame2.displayHeight * window.devicePixelRatio;
|
|
34211
34294
|
const transformed = resizeVideoFrame({
|
|
34212
34295
|
frame: frame2,
|
|
@@ -42690,23 +42773,28 @@ var Studio = ({ rootComponent, readOnly }) => {
|
|
|
42690
42773
|
useLayoutEffect2(() => {
|
|
42691
42774
|
injectCSS();
|
|
42692
42775
|
}, []);
|
|
42693
|
-
return /* @__PURE__ */ jsx275(Internals67.
|
|
42694
|
-
audioEnabled: window.remotion_audioEnabled,
|
|
42695
|
-
videoEnabled: window.remotion_videoEnabled,
|
|
42696
|
-
logLevel: window.remotion_logLevel,
|
|
42697
|
-
numberOfAudioTags: window.remotion_numberOfAudioTags,
|
|
42776
|
+
return /* @__PURE__ */ jsx275(Internals67.CompositionManagerProvider, {
|
|
42698
42777
|
onlyRenderComposition: null,
|
|
42699
42778
|
currentCompositionMetadata: null,
|
|
42700
|
-
|
|
42701
|
-
|
|
42702
|
-
|
|
42703
|
-
|
|
42704
|
-
|
|
42705
|
-
|
|
42706
|
-
|
|
42707
|
-
|
|
42708
|
-
|
|
42709
|
-
|
|
42779
|
+
initialCompositions: [],
|
|
42780
|
+
initialCanvasContent: null,
|
|
42781
|
+
children: /* @__PURE__ */ jsx275(Internals67.RemotionRoot, {
|
|
42782
|
+
frameState: null,
|
|
42783
|
+
audioEnabled: window.remotion_audioEnabled,
|
|
42784
|
+
videoEnabled: window.remotion_videoEnabled,
|
|
42785
|
+
logLevel: window.remotion_logLevel,
|
|
42786
|
+
numberOfAudioTags: window.remotion_numberOfAudioTags,
|
|
42787
|
+
audioLatencyHint: window.remotion_audioLatencyHint ?? "interactive",
|
|
42788
|
+
children: /* @__PURE__ */ jsxs141(EditorContexts, {
|
|
42789
|
+
readOnlyStudio: readOnly,
|
|
42790
|
+
children: [
|
|
42791
|
+
/* @__PURE__ */ jsx275(Editor, {
|
|
42792
|
+
readOnlyStudio: readOnly,
|
|
42793
|
+
Root: rootComponent
|
|
42794
|
+
}),
|
|
42795
|
+
readOnly ? null : createPortal(/* @__PURE__ */ jsx275(ServerDisconnected, {}), getServerDisconnectedDomElement())
|
|
42796
|
+
]
|
|
42797
|
+
})
|
|
42710
42798
|
})
|
|
42711
42799
|
});
|
|
42712
42800
|
};
|
package/dist/esm/renderEntry.mjs
CHANGED
|
@@ -142,12 +142,8 @@ var renderToDOM = (content) => {
|
|
|
142
142
|
var renderContent = (Root) => {
|
|
143
143
|
const bundleMode = getBundleMode();
|
|
144
144
|
if (bundleMode.type === "composition") {
|
|
145
|
-
const markup = /* @__PURE__ */
|
|
146
|
-
|
|
147
|
-
videoEnabled: window.remotion_videoEnabled,
|
|
148
|
-
logLevel: window.remotion_logLevel,
|
|
149
|
-
numberOfAudioTags: 0,
|
|
150
|
-
audioLatencyHint: window.remotion_audioLatencyHint ?? "interactive",
|
|
145
|
+
const markup = /* @__PURE__ */ jsx(Internals.CompositionManagerProvider, {
|
|
146
|
+
initialCanvasContent: null,
|
|
151
147
|
onlyRenderComposition: bundleMode.compositionName,
|
|
152
148
|
currentCompositionMetadata: {
|
|
153
149
|
props: NoReactInternals.deserializeJSONWithSpecialTypes(bundleMode.serializedResolvedPropsWithSchema),
|
|
@@ -161,25 +157,39 @@ var renderContent = (Root) => {
|
|
|
161
157
|
defaultPixelFormat: bundleMode.compositionDefaultPixelFormat,
|
|
162
158
|
defaultProResProfile: bundleMode.compositionDefaultProResProfile
|
|
163
159
|
},
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
160
|
+
initialCompositions: [],
|
|
161
|
+
children: /* @__PURE__ */ jsxs(Internals.RemotionRoot, {
|
|
162
|
+
frameState: null,
|
|
163
|
+
audioEnabled: window.remotion_audioEnabled,
|
|
164
|
+
videoEnabled: window.remotion_videoEnabled,
|
|
165
|
+
logLevel: window.remotion_logLevel,
|
|
166
|
+
numberOfAudioTags: 0,
|
|
167
|
+
audioLatencyHint: window.remotion_audioLatencyHint ?? "interactive",
|
|
168
|
+
children: [
|
|
169
|
+
/* @__PURE__ */ jsx(Root, {}),
|
|
170
|
+
/* @__PURE__ */ jsx(GetVideoComposition, {
|
|
171
|
+
state: bundleMode
|
|
172
|
+
})
|
|
173
|
+
]
|
|
174
|
+
})
|
|
170
175
|
});
|
|
171
176
|
renderToDOM(markup);
|
|
172
177
|
}
|
|
173
178
|
if (bundleMode.type === "evaluation") {
|
|
174
|
-
const markup = /* @__PURE__ */ jsx(Internals.
|
|
175
|
-
|
|
176
|
-
videoEnabled: window.remotion_videoEnabled,
|
|
177
|
-
logLevel: window.remotion_logLevel,
|
|
178
|
-
numberOfAudioTags: 0,
|
|
179
|
+
const markup = /* @__PURE__ */ jsx(Internals.CompositionManagerProvider, {
|
|
180
|
+
initialCanvasContent: null,
|
|
179
181
|
onlyRenderComposition: null,
|
|
180
182
|
currentCompositionMetadata: null,
|
|
181
|
-
|
|
182
|
-
children: /* @__PURE__ */ jsx(
|
|
183
|
+
initialCompositions: [],
|
|
184
|
+
children: /* @__PURE__ */ jsx(Internals.RemotionRoot, {
|
|
185
|
+
frameState: null,
|
|
186
|
+
audioEnabled: window.remotion_audioEnabled,
|
|
187
|
+
videoEnabled: window.remotion_videoEnabled,
|
|
188
|
+
logLevel: window.remotion_logLevel,
|
|
189
|
+
numberOfAudioTags: 0,
|
|
190
|
+
audioLatencyHint: window.remotion_audioLatencyHint ?? "interactive",
|
|
191
|
+
children: /* @__PURE__ */ jsx(Root, {})
|
|
192
|
+
})
|
|
183
193
|
});
|
|
184
194
|
renderToDOM(markup);
|
|
185
195
|
}
|
|
@@ -190,7 +200,7 @@ var renderContent = (Root) => {
|
|
|
190
200
|
renderToDOM(/* @__PURE__ */ jsx("div", {
|
|
191
201
|
children: /* @__PURE__ */ jsx(DelayedSpinner, {})
|
|
192
202
|
}));
|
|
193
|
-
import("./chunk-
|
|
203
|
+
import("./chunk-df4kyjv3.js").then(({ StudioInternals }) => {
|
|
194
204
|
window.remotion_isStudio = true;
|
|
195
205
|
window.remotion_isReadOnlyStudio = true;
|
|
196
206
|
Internals.enableSequenceStackTraces();
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { VideoSample } from 'mediabunny';
|
|
1
2
|
type Options = {
|
|
2
3
|
track: {
|
|
3
4
|
width: number;
|
|
@@ -10,8 +11,8 @@ export type ExtractFramesTimestampsInSecondsFn = (options: Options) => Promise<n
|
|
|
10
11
|
export type ExtractFramesProps = {
|
|
11
12
|
src: string;
|
|
12
13
|
timestampsInSeconds: number[] | ExtractFramesTimestampsInSecondsFn;
|
|
13
|
-
|
|
14
|
+
onVideoSample: (sample: VideoSample) => void;
|
|
14
15
|
signal?: AbortSignal;
|
|
15
16
|
};
|
|
16
|
-
export declare function extractFrames({ src, timestampsInSeconds,
|
|
17
|
+
export declare function extractFrames({ src, timestampsInSeconds, onVideoSample, signal, }: ExtractFramesProps): Promise<void>;
|
|
17
18
|
export {};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.extractFrames = extractFrames;
|
|
4
4
|
const mediabunny_1 = require("mediabunny");
|
|
5
|
-
async function extractFrames({ src, timestampsInSeconds,
|
|
5
|
+
async function extractFrames({ src, timestampsInSeconds, onVideoSample, signal, }) {
|
|
6
6
|
const input = new mediabunny_1.Input({
|
|
7
7
|
formats: mediabunny_1.ALL_FORMATS,
|
|
8
8
|
source: new mediabunny_1.UrlSource(src),
|
|
@@ -43,8 +43,7 @@ async function extractFrames({ src, timestampsInSeconds, onFrame, signal, }) {
|
|
|
43
43
|
if (!videoSample) {
|
|
44
44
|
continue;
|
|
45
45
|
}
|
|
46
|
-
|
|
47
|
-
onFrame(videoFrame);
|
|
46
|
+
onVideoSample(videoSample);
|
|
48
47
|
}
|
|
49
48
|
}
|
|
50
49
|
catch (error) {
|
|
@@ -2,6 +2,7 @@ export type FrameDatabaseKey = string & {
|
|
|
2
2
|
__brand: 'FrameDatabaseKey';
|
|
3
3
|
};
|
|
4
4
|
export declare const makeFrameDatabaseKey: (src: string, timestamp: number) => FrameDatabaseKey;
|
|
5
|
+
export declare const getFrameDatabaseKeyPrefix: (src: string) => string;
|
|
5
6
|
type VideoFrameAndLastUsed = {
|
|
6
7
|
frame: VideoFrame;
|
|
7
8
|
lastUsed: number;
|
|
@@ -11,4 +12,5 @@ export declare const aspectRatioCache: Map<string, number>;
|
|
|
11
12
|
export declare const getTimestampFromFrameDatabaseKey: (key: FrameDatabaseKey) => number;
|
|
12
13
|
export declare const getAspectRatioFromCache: (src: string) => number | null;
|
|
13
14
|
export declare const clearOldFrames: () => void;
|
|
15
|
+
export declare const clearFramesForSrc: (src: string) => void;
|
|
14
16
|
export {};
|