@remotion/web-renderer 4.0.433 → 4.0.435
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/drawing/filter.d.ts +4 -0
- package/dist/esm/index.mjs +59 -4
- package/dist/render-media-on-web.d.ts +11 -0
- package/package.json +7 -7
package/dist/esm/index.mjs
CHANGED
|
@@ -2892,6 +2892,20 @@ var drawOutline = ({
|
|
|
2892
2892
|
ctx.setLineDash(originalLineDash);
|
|
2893
2893
|
};
|
|
2894
2894
|
|
|
2895
|
+
// src/drawing/filter.ts
|
|
2896
|
+
var setFilter = ({
|
|
2897
|
+
ctx,
|
|
2898
|
+
filter
|
|
2899
|
+
}) => {
|
|
2900
|
+
const previousFilter = ctx.filter;
|
|
2901
|
+
if (filter && filter !== "none") {
|
|
2902
|
+
ctx.filter = filter;
|
|
2903
|
+
}
|
|
2904
|
+
return () => {
|
|
2905
|
+
ctx.filter = previousFilter;
|
|
2906
|
+
};
|
|
2907
|
+
};
|
|
2908
|
+
|
|
2895
2909
|
// src/drawing/opacity.ts
|
|
2896
2910
|
var setOpacity = ({
|
|
2897
2911
|
ctx,
|
|
@@ -2970,6 +2984,10 @@ var drawElement = async ({
|
|
|
2970
2984
|
ctx: context,
|
|
2971
2985
|
opacity
|
|
2972
2986
|
});
|
|
2987
|
+
const finishFilter = setFilter({
|
|
2988
|
+
ctx: context,
|
|
2989
|
+
filter: computedStyle.filter
|
|
2990
|
+
});
|
|
2973
2991
|
drawBorderRadius({
|
|
2974
2992
|
ctx: context,
|
|
2975
2993
|
computedStyle,
|
|
@@ -3024,6 +3042,7 @@ var drawElement = async ({
|
|
|
3024
3042
|
finishTransform();
|
|
3025
3043
|
return {
|
|
3026
3044
|
cleanupAfterChildren: () => {
|
|
3045
|
+
finishFilter();
|
|
3027
3046
|
finishOpacity();
|
|
3028
3047
|
finishOverflowHidden();
|
|
3029
3048
|
}
|
|
@@ -3626,7 +3645,8 @@ var drawText = ({
|
|
|
3626
3645
|
webkitTextStrokeWidth,
|
|
3627
3646
|
webkitTextStrokeColor,
|
|
3628
3647
|
textShadow: textShadowValue,
|
|
3629
|
-
paintOrder
|
|
3648
|
+
paintOrder,
|
|
3649
|
+
filter
|
|
3630
3650
|
} = computedStyle;
|
|
3631
3651
|
const isVertical = writingMode !== "horizontal-tb";
|
|
3632
3652
|
if (isVertical) {
|
|
@@ -3637,6 +3657,10 @@ var drawText = ({
|
|
|
3637
3657
|
return;
|
|
3638
3658
|
}
|
|
3639
3659
|
contextToDraw.save();
|
|
3660
|
+
const finishFilter = setFilter({
|
|
3661
|
+
ctx: contextToDraw,
|
|
3662
|
+
filter
|
|
3663
|
+
});
|
|
3640
3664
|
const fontSizePx = parseFloat(fontSize);
|
|
3641
3665
|
contextToDraw.font = `${fontStyle} ${fontWeight} ${fontSizePx}px ${fontFamily}`;
|
|
3642
3666
|
contextToDraw.fillStyle = onlyBackgroundClipText ? "black" : webkitTextFillColor;
|
|
@@ -3691,6 +3715,7 @@ var drawText = ({
|
|
|
3691
3715
|
}
|
|
3692
3716
|
}
|
|
3693
3717
|
span.textContent = originalText;
|
|
3718
|
+
finishFilter();
|
|
3694
3719
|
contextToDraw.restore();
|
|
3695
3720
|
};
|
|
3696
3721
|
return drawFn;
|
|
@@ -4063,6 +4088,7 @@ var createWebFsTarget = async () => {
|
|
|
4063
4088
|
};
|
|
4064
4089
|
|
|
4065
4090
|
// src/render-media-on-web.tsx
|
|
4091
|
+
var MAX_RECENT_FRAME_TIMINGS = 150;
|
|
4066
4092
|
var internalRenderMediaOnWeb = async ({
|
|
4067
4093
|
composition,
|
|
4068
4094
|
inputProps,
|
|
@@ -4198,6 +4224,10 @@ var internalRenderMediaOnWeb = async ({
|
|
|
4198
4224
|
}) : null, 0);
|
|
4199
4225
|
const totalFrames = realFrameRange[1] - realFrameRange[0] + 1;
|
|
4200
4226
|
const durationInSeconds = totalFrames / resolved.fps;
|
|
4227
|
+
const renderStart = Date.now();
|
|
4228
|
+
let doneIn = null;
|
|
4229
|
+
let renderEstimatedTime = 0;
|
|
4230
|
+
const recentFrameTimings = [];
|
|
4201
4231
|
if (videoSampleSource) {
|
|
4202
4232
|
outputWithCleanup.output.addVideoTrack(videoSampleSource.videoSampleSource, {
|
|
4203
4233
|
maximumPacketCount: Math.ceil(totalFrames * 1.33)
|
|
@@ -4217,10 +4247,21 @@ var internalRenderMediaOnWeb = async ({
|
|
|
4217
4247
|
if (signal?.aborted) {
|
|
4218
4248
|
throw new Error("renderMediaOnWeb() was cancelled");
|
|
4219
4249
|
}
|
|
4250
|
+
let timeOfLastFrame = Date.now();
|
|
4220
4251
|
const progress = {
|
|
4221
4252
|
renderedFrames: 0,
|
|
4222
4253
|
encodedFrames: 0
|
|
4223
4254
|
};
|
|
4255
|
+
const getProgressPayload = () => {
|
|
4256
|
+
const overallProgress = Math.round((70 * progress.renderedFrames + 30 * progress.encodedFrames) / totalFrames) / 100;
|
|
4257
|
+
return {
|
|
4258
|
+
renderedFrames: progress.renderedFrames,
|
|
4259
|
+
encodedFrames: progress.encodedFrames,
|
|
4260
|
+
doneIn,
|
|
4261
|
+
renderEstimatedTime,
|
|
4262
|
+
progress: overallProgress
|
|
4263
|
+
};
|
|
4264
|
+
};
|
|
4224
4265
|
for (let frame = realFrameRange[0];frame <= realFrameRange[1]; frame++) {
|
|
4225
4266
|
if (signal?.aborted) {
|
|
4226
4267
|
throw new Error("renderMediaOnWeb() was cancelled");
|
|
@@ -4274,8 +4315,19 @@ var internalRenderMediaOnWeb = async ({
|
|
|
4274
4315
|
});
|
|
4275
4316
|
}
|
|
4276
4317
|
}
|
|
4318
|
+
const now = Date.now();
|
|
4319
|
+
const timeToRenderInMilliseconds = now - timeOfLastFrame;
|
|
4320
|
+
timeOfLastFrame = now;
|
|
4277
4321
|
progress.renderedFrames++;
|
|
4278
|
-
|
|
4322
|
+
recentFrameTimings.push(timeToRenderInMilliseconds);
|
|
4323
|
+
if (recentFrameTimings.length > MAX_RECENT_FRAME_TIMINGS) {
|
|
4324
|
+
recentFrameTimings.shift();
|
|
4325
|
+
}
|
|
4326
|
+
const recentTimingsSum = recentFrameTimings.reduce((sum, time) => sum + time, 0);
|
|
4327
|
+
const newAverage = recentTimingsSum / recentFrameTimings.length;
|
|
4328
|
+
const remainingFrames = totalFrames - progress.renderedFrames;
|
|
4329
|
+
renderEstimatedTime = Math.round(remainingFrames * newAverage);
|
|
4330
|
+
throttledOnProgress?.(getProgressPayload());
|
|
4279
4331
|
const audioCombineStart = performance.now();
|
|
4280
4332
|
const assets = collectAssets.current.collectAssets();
|
|
4281
4333
|
if (onArtifact) {
|
|
@@ -4302,12 +4354,15 @@ var internalRenderMediaOnWeb = async ({
|
|
|
4302
4354
|
await Promise.all(encodingPromises);
|
|
4303
4355
|
internalState.addAddSampleTime(performance.now() - addSampleStart);
|
|
4304
4356
|
progress.encodedFrames++;
|
|
4305
|
-
|
|
4357
|
+
if (progress.encodedFrames === totalFrames) {
|
|
4358
|
+
doneIn = Date.now() - renderStart;
|
|
4359
|
+
}
|
|
4360
|
+
throttledOnProgress?.(getProgressPayload());
|
|
4306
4361
|
if (signal?.aborted) {
|
|
4307
4362
|
throw new Error("renderMediaOnWeb() was cancelled");
|
|
4308
4363
|
}
|
|
4309
4364
|
}
|
|
4310
|
-
onProgress?.(
|
|
4365
|
+
onProgress?.(getProgressPayload());
|
|
4311
4366
|
videoSampleSource?.videoSampleSource.close();
|
|
4312
4367
|
audioSampleSource?.audioSampleSource.close();
|
|
4313
4368
|
await outputWithCleanup.output.finalize();
|
|
@@ -22,8 +22,19 @@ type MandatoryRenderMediaOnWebOptions<Schema extends $ZodObject, Props extends R
|
|
|
22
22
|
composition: CompositionCalculateMetadataOrExplicit<Schema, Props>;
|
|
23
23
|
};
|
|
24
24
|
export type RenderMediaOnWebProgress = {
|
|
25
|
+
/**
|
|
26
|
+
* @deprecated Kept for backward compatibility. Use `progress` for overall
|
|
27
|
+
* status updates.
|
|
28
|
+
*/
|
|
25
29
|
renderedFrames: number;
|
|
26
30
|
encodedFrames: number;
|
|
31
|
+
/**
|
|
32
|
+
* The total time in milliseconds from render start until all frames were
|
|
33
|
+
* encoded, or `null` while encoding is still in progress.
|
|
34
|
+
*/
|
|
35
|
+
doneIn: number | null;
|
|
36
|
+
renderEstimatedTime: number;
|
|
37
|
+
progress: number;
|
|
27
38
|
};
|
|
28
39
|
export type RenderMediaOnWebResult = {
|
|
29
40
|
getBlob: () => Promise<Blob>;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"url": "https://github.com/remotion-dev/remotion/tree/main/packages/web-renderer"
|
|
4
4
|
},
|
|
5
5
|
"name": "@remotion/web-renderer",
|
|
6
|
-
"version": "4.0.
|
|
6
|
+
"version": "4.0.435",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"scripts": {
|
|
@@ -22,16 +22,16 @@
|
|
|
22
22
|
"@mediabunny/mp3-encoder": "1.37.0",
|
|
23
23
|
"@mediabunny/aac-encoder": "1.37.0",
|
|
24
24
|
"@mediabunny/flac-encoder": "1.37.0",
|
|
25
|
-
"@remotion/licensing": "4.0.
|
|
26
|
-
"remotion": "4.0.
|
|
25
|
+
"@remotion/licensing": "4.0.435",
|
|
26
|
+
"remotion": "4.0.435",
|
|
27
27
|
"mediabunny": "1.37.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@react-three/fiber": "9.2.0",
|
|
31
|
-
"@remotion/eslint-config-internal": "4.0.
|
|
32
|
-
"@remotion/player": "4.0.
|
|
33
|
-
"@remotion/media": "4.0.
|
|
34
|
-
"@remotion/three": "4.0.
|
|
31
|
+
"@remotion/eslint-config-internal": "4.0.435",
|
|
32
|
+
"@remotion/player": "4.0.435",
|
|
33
|
+
"@remotion/media": "4.0.435",
|
|
34
|
+
"@remotion/three": "4.0.435",
|
|
35
35
|
"@types/three": "0.170.0",
|
|
36
36
|
"@typescript/native-preview": "7.0.0-dev.20260217.1",
|
|
37
37
|
"@vitejs/plugin-react": "4.3.4",
|