@remotion/media 4.0.469 → 4.0.471
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/esm/index.mjs
CHANGED
|
@@ -2060,14 +2060,14 @@ var useCommonEffects = ({
|
|
|
2060
2060
|
}, [durationInFrames, mediaPlayerReady, mediaPlayerRef, currentTimeRef]);
|
|
2061
2061
|
useLayoutEffect(() => {
|
|
2062
2062
|
const mediaPlayer = mediaPlayerRef.current;
|
|
2063
|
-
if (!mediaPlayer
|
|
2063
|
+
if (!mediaPlayer) {
|
|
2064
2064
|
return;
|
|
2065
2065
|
}
|
|
2066
2066
|
mediaPlayer.setIsPremounting(isPremounting);
|
|
2067
2067
|
}, [isPremounting, mediaPlayerReady, mediaPlayerRef]);
|
|
2068
2068
|
useLayoutEffect(() => {
|
|
2069
2069
|
const mediaPlayer = mediaPlayerRef.current;
|
|
2070
|
-
if (!mediaPlayer
|
|
2070
|
+
if (!mediaPlayer) {
|
|
2071
2071
|
return;
|
|
2072
2072
|
}
|
|
2073
2073
|
mediaPlayer.setIsPostmounting(isPostmounting);
|
|
@@ -4663,14 +4663,17 @@ var Audio = Internals16.wrapInSchema(AudioInner, audioSchema);
|
|
|
4663
4663
|
Internals16.addSequenceStackTraces(Audio);
|
|
4664
4664
|
|
|
4665
4665
|
// src/video/video.tsx
|
|
4666
|
-
import { useMemo as useMemo6, useState as useState6 } from "react";
|
|
4666
|
+
import React5, { useMemo as useMemo6, useState as useState6 } from "react";
|
|
4667
4667
|
import {
|
|
4668
|
+
Internals as Internals20,
|
|
4669
|
+
Sequence as Sequence2,
|
|
4670
|
+
useRemotionEnvironment as useRemotionEnvironment4,
|
|
4668
4671
|
useVideoConfig as useVideoConfig5
|
|
4669
4672
|
} from "remotion";
|
|
4670
|
-
import { Internals as Internals20, Sequence as Sequence2, useRemotionEnvironment as useRemotionEnvironment4 } from "remotion";
|
|
4671
4673
|
|
|
4672
4674
|
// src/video/video-for-preview.tsx
|
|
4673
4675
|
import {
|
|
4676
|
+
useCallback,
|
|
4674
4677
|
useContext as useContext4,
|
|
4675
4678
|
useEffect as useEffect2,
|
|
4676
4679
|
useLayoutEffect as useLayoutEffect3,
|
|
@@ -4770,7 +4773,8 @@ var VideoForPreviewAssertedShowing = ({
|
|
|
4770
4773
|
objectFit: objectFitProp,
|
|
4771
4774
|
_experimentalInitiallyDrawCachedFrame,
|
|
4772
4775
|
effects,
|
|
4773
|
-
setMediaDurationInSeconds
|
|
4776
|
+
setMediaDurationInSeconds,
|
|
4777
|
+
refForOutline
|
|
4774
4778
|
}) => {
|
|
4775
4779
|
const src = usePreload2(unpreloadedSrc);
|
|
4776
4780
|
const canvasRef = useRef2(null);
|
|
@@ -4787,6 +4791,13 @@ var VideoForPreviewAssertedShowing = ({
|
|
|
4787
4791
|
const { playbackRate: globalPlaybackRate } = Internals18.usePlaybackRate();
|
|
4788
4792
|
const sharedAudioContext = useContext4(SharedAudioContext2);
|
|
4789
4793
|
const buffer = useBufferState2();
|
|
4794
|
+
const canvasRefCallback = useCallback((canvas) => {
|
|
4795
|
+
canvasRef.current = canvas;
|
|
4796
|
+
refForOutline.current = canvas;
|
|
4797
|
+
}, [refForOutline]);
|
|
4798
|
+
const fallbackVideoRef = useCallback((video) => {
|
|
4799
|
+
refForOutline.current = video;
|
|
4800
|
+
}, [refForOutline]);
|
|
4790
4801
|
const [mediaMuted] = useMediaMutedState2();
|
|
4791
4802
|
const [mediaVolume] = useMediaVolumeState2();
|
|
4792
4803
|
const volumePropFrame = useFrameForVolumeProp2(loopVolumeCurveBehavior);
|
|
@@ -5061,6 +5072,7 @@ var VideoForPreviewAssertedShowing = ({
|
|
|
5061
5072
|
}, [objectFitProp, style]);
|
|
5062
5073
|
if (shouldFallbackToNativeVideo && !disallowFallbackToOffthreadVideo) {
|
|
5063
5074
|
return /* @__PURE__ */ jsx4(Html5Video, {
|
|
5075
|
+
ref: fallbackVideoRef,
|
|
5064
5076
|
src,
|
|
5065
5077
|
style: actualStyle,
|
|
5066
5078
|
className,
|
|
@@ -5081,7 +5093,7 @@ var VideoForPreviewAssertedShowing = ({
|
|
|
5081
5093
|
return null;
|
|
5082
5094
|
}
|
|
5083
5095
|
return /* @__PURE__ */ jsx4("canvas", {
|
|
5084
|
-
ref:
|
|
5096
|
+
ref: canvasRefCallback,
|
|
5085
5097
|
style: actualStyle,
|
|
5086
5098
|
className: classNameValue
|
|
5087
5099
|
});
|
|
@@ -5161,7 +5173,8 @@ var VideoForRendering = ({
|
|
|
5161
5173
|
onError,
|
|
5162
5174
|
credentials,
|
|
5163
5175
|
requestInit,
|
|
5164
|
-
objectFit: objectFitProp
|
|
5176
|
+
objectFit: objectFitProp,
|
|
5177
|
+
effects
|
|
5165
5178
|
}) => {
|
|
5166
5179
|
if (!src) {
|
|
5167
5180
|
throw new TypeError("No `src` was passed to <Video>.");
|
|
@@ -5186,6 +5199,7 @@ var VideoForRendering = ({
|
|
|
5186
5199
|
const audioEnabled = Internals19.useAudioEnabled();
|
|
5187
5200
|
const videoEnabled = Internals19.useVideoEnabled();
|
|
5188
5201
|
const maxCacheSize = useMaxMediaCacheSize(logLevel);
|
|
5202
|
+
const effectChainState = Internals19.useEffectChainState();
|
|
5189
5203
|
const [error, setError] = useState5(null);
|
|
5190
5204
|
if (error) {
|
|
5191
5205
|
throw error;
|
|
@@ -5232,7 +5246,7 @@ var VideoForRendering = ({
|
|
|
5232
5246
|
maxCacheSize,
|
|
5233
5247
|
credentials,
|
|
5234
5248
|
requestInit: initialRequestInit
|
|
5235
|
-
}).then((result) => {
|
|
5249
|
+
}).then(async (result) => {
|
|
5236
5250
|
const handleError = (err, clientSideError, fallbackMessage, mediaDurationInSeconds) => {
|
|
5237
5251
|
if (environment.isClientSideRendering) {
|
|
5238
5252
|
cancelRender3(clientSideError);
|
|
@@ -5287,6 +5301,20 @@ var VideoForRendering = ({
|
|
|
5287
5301
|
context.canvas.height = imageBitmap.height;
|
|
5288
5302
|
context.canvas.style.aspectRatio = `${context.canvas.width} / ${context.canvas.height}`;
|
|
5289
5303
|
context.drawImage(imageBitmap, 0, 0);
|
|
5304
|
+
if (effects.length > 0) {
|
|
5305
|
+
const completed = await Internals19.runEffectChain({
|
|
5306
|
+
state: effectChainState.get(imageBitmap.width, imageBitmap.height),
|
|
5307
|
+
source: context.canvas,
|
|
5308
|
+
effects,
|
|
5309
|
+
output: context.canvas,
|
|
5310
|
+
width: imageBitmap.width,
|
|
5311
|
+
height: imageBitmap.height
|
|
5312
|
+
});
|
|
5313
|
+
if (!completed) {
|
|
5314
|
+
imageBitmap.close();
|
|
5315
|
+
return;
|
|
5316
|
+
}
|
|
5317
|
+
}
|
|
5290
5318
|
}
|
|
5291
5319
|
imageBitmap.close();
|
|
5292
5320
|
} else if (videoEnabled) {
|
|
@@ -5365,6 +5393,8 @@ var VideoForRendering = ({
|
|
|
5365
5393
|
headless,
|
|
5366
5394
|
onError,
|
|
5367
5395
|
credentials,
|
|
5396
|
+
effectChainState,
|
|
5397
|
+
effects,
|
|
5368
5398
|
initialRequestInit
|
|
5369
5399
|
]);
|
|
5370
5400
|
warnAboutObjectFitInStyleOrClassName({ style, className, logLevel });
|
|
@@ -5497,7 +5527,8 @@ var InnerVideo = ({
|
|
|
5497
5527
|
objectFit,
|
|
5498
5528
|
_experimentalInitiallyDrawCachedFrame,
|
|
5499
5529
|
effects,
|
|
5500
|
-
setMediaDurationInSeconds
|
|
5530
|
+
setMediaDurationInSeconds,
|
|
5531
|
+
refForOutline
|
|
5501
5532
|
}) => {
|
|
5502
5533
|
const environment = useRemotionEnvironment4();
|
|
5503
5534
|
if (typeof src !== "string") {
|
|
@@ -5541,7 +5572,8 @@ var InnerVideo = ({
|
|
|
5541
5572
|
onError,
|
|
5542
5573
|
credentials,
|
|
5543
5574
|
requestInit,
|
|
5544
|
-
objectFit
|
|
5575
|
+
objectFit,
|
|
5576
|
+
effects
|
|
5545
5577
|
});
|
|
5546
5578
|
}
|
|
5547
5579
|
return /* @__PURE__ */ jsx6(VideoForPreview, {
|
|
@@ -5571,7 +5603,8 @@ var InnerVideo = ({
|
|
|
5571
5603
|
controls,
|
|
5572
5604
|
objectFit,
|
|
5573
5605
|
effects,
|
|
5574
|
-
_experimentalInitiallyDrawCachedFrame
|
|
5606
|
+
_experimentalInitiallyDrawCachedFrame,
|
|
5607
|
+
refForOutline
|
|
5575
5608
|
});
|
|
5576
5609
|
};
|
|
5577
5610
|
var VideoInner = ({
|
|
@@ -5654,6 +5687,7 @@ var VideoInner = ({
|
|
|
5654
5687
|
overrideId: controls?.overrideId ?? null
|
|
5655
5688
|
});
|
|
5656
5689
|
const memoizedEffectDefinitions = Internals20.useMemoizedEffectDefinitions(effects ?? []);
|
|
5690
|
+
const refForOutline = React5.useRef(null);
|
|
5657
5691
|
if (sequenceDurationInFrames === 0) {
|
|
5658
5692
|
return null;
|
|
5659
5693
|
}
|
|
@@ -5668,6 +5702,7 @@ var VideoInner = ({
|
|
|
5668
5702
|
_experimentalControls: controls,
|
|
5669
5703
|
_remotionInternalLoopDisplay: loopDisplay,
|
|
5670
5704
|
_remotionInternalEffects: memoizedEffectDefinitions,
|
|
5705
|
+
_remotionInternalRefForOutline: refForOutline,
|
|
5671
5706
|
showInTimeline: showInTimeline ?? true,
|
|
5672
5707
|
hidden,
|
|
5673
5708
|
children: /* @__PURE__ */ jsx6(InnerVideo, {
|
|
@@ -5700,7 +5735,8 @@ var VideoInner = ({
|
|
|
5700
5735
|
objectFit: objectFit ?? "contain",
|
|
5701
5736
|
_experimentalInitiallyDrawCachedFrame: _experimentalInitiallyDrawCachedFrame ?? false,
|
|
5702
5737
|
effects: memoizedEffects,
|
|
5703
|
-
setMediaDurationInSeconds
|
|
5738
|
+
setMediaDurationInSeconds,
|
|
5739
|
+
refForOutline
|
|
5704
5740
|
})
|
|
5705
5741
|
});
|
|
5706
5742
|
};
|
|
@@ -30,6 +30,7 @@ type VideoForPreviewProps = {
|
|
|
30
30
|
readonly setMediaDurationInSeconds: (durationInSeconds: number) => void;
|
|
31
31
|
readonly _experimentalInitiallyDrawCachedFrame: boolean;
|
|
32
32
|
readonly effects: EffectDefinitionAndStack<unknown>[];
|
|
33
|
+
readonly refForOutline: React.RefObject<HTMLElement | null>;
|
|
33
34
|
};
|
|
34
35
|
export declare const VideoForPreview: React.FC<VideoForPreviewProps & {
|
|
35
36
|
readonly controls: SequenceControls | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { LogLevel, LoopVolumeCurveBehavior, OnVideoFrame, VolumeProp } from 'remotion';
|
|
2
|
+
import type { EffectDefinitionAndStack, LogLevel, LoopVolumeCurveBehavior, OnVideoFrame, VolumeProp } from 'remotion';
|
|
3
3
|
import { type MediaOnError } from '../on-error';
|
|
4
4
|
import type { MediaRequestInit } from '../request-init';
|
|
5
5
|
import type { FallbackOffthreadVideoProps, VideoObjectFit } from './props';
|
|
@@ -28,6 +28,7 @@ type InnerVideoProps = {
|
|
|
28
28
|
readonly credentials: RequestCredentials | undefined;
|
|
29
29
|
readonly requestInit: MediaRequestInit | undefined;
|
|
30
30
|
readonly objectFit: VideoObjectFit;
|
|
31
|
+
readonly effects: EffectDefinitionAndStack<unknown>[];
|
|
31
32
|
};
|
|
32
33
|
export declare const VideoForRendering: React.FC<InnerVideoProps>;
|
|
33
34
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/media",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.471",
|
|
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.45.0",
|
|
26
|
-
"remotion": "4.0.
|
|
26
|
+
"remotion": "4.0.471",
|
|
27
27
|
"zod": "4.3.6"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"react-dom": ">=16.8.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@remotion/eslint-config-internal": "4.0.
|
|
34
|
+
"@remotion/eslint-config-internal": "4.0.471",
|
|
35
35
|
"@vitest/browser-webdriverio": "4.0.9",
|
|
36
36
|
"eslint": "9.19.0",
|
|
37
37
|
"react": "19.2.3",
|