@remotion/media 4.0.481 → 4.0.483
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
|
@@ -39,7 +39,7 @@ var __callDispose = (stack, error, hasError) => {
|
|
|
39
39
|
// src/audio/audio.tsx
|
|
40
40
|
import { useMemo as useMemo3, useState as useState3 } from "react";
|
|
41
41
|
import {
|
|
42
|
-
Internals as
|
|
42
|
+
Internals as Internals17,
|
|
43
43
|
Interactive,
|
|
44
44
|
Sequence,
|
|
45
45
|
useRemotionEnvironment as useRemotionEnvironment2,
|
|
@@ -351,9 +351,14 @@ class StaleWaiterError extends Error {
|
|
|
351
351
|
var CONCURRENCY = 1;
|
|
352
352
|
var waiters = [];
|
|
353
353
|
var running = 0;
|
|
354
|
+
var runningEntry = null;
|
|
354
355
|
var processNext = () => {
|
|
355
356
|
if (running >= CONCURRENCY) {
|
|
356
|
-
|
|
357
|
+
if (runningEntry?.waiter.getPriority() === null) {
|
|
358
|
+
runningEntry.cancel();
|
|
359
|
+
} else {
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
357
362
|
}
|
|
358
363
|
const staleWaiters = [];
|
|
359
364
|
for (let i = waiters.length - 1;i >= 0; i--) {
|
|
@@ -388,11 +393,37 @@ var processNext = () => {
|
|
|
388
393
|
}
|
|
389
394
|
const [next] = waiters.splice(bestIndex, 1);
|
|
390
395
|
running++;
|
|
396
|
+
let settled = false;
|
|
397
|
+
let cancelled = false;
|
|
398
|
+
const entry = {
|
|
399
|
+
waiter: next,
|
|
400
|
+
cancel: () => {
|
|
401
|
+
cancelled = true;
|
|
402
|
+
entry.settle();
|
|
403
|
+
},
|
|
404
|
+
settle: () => {
|
|
405
|
+
if (settled) {
|
|
406
|
+
return;
|
|
407
|
+
}
|
|
408
|
+
settled = true;
|
|
409
|
+
running--;
|
|
410
|
+
if (runningEntry === entry) {
|
|
411
|
+
runningEntry = null;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
};
|
|
415
|
+
runningEntry = entry;
|
|
391
416
|
next.fn().then((value) => {
|
|
392
|
-
|
|
417
|
+
entry.settle();
|
|
418
|
+
if (cancelled) {
|
|
419
|
+
return;
|
|
420
|
+
}
|
|
393
421
|
next.onDone(value, processNext);
|
|
394
422
|
}, (err) => {
|
|
395
|
-
|
|
423
|
+
entry.settle();
|
|
424
|
+
if (cancelled) {
|
|
425
|
+
return;
|
|
426
|
+
}
|
|
396
427
|
next.onError(err);
|
|
397
428
|
});
|
|
398
429
|
};
|
|
@@ -2143,7 +2174,7 @@ var {
|
|
|
2143
2174
|
useUnsafeVideoConfig,
|
|
2144
2175
|
Timeline,
|
|
2145
2176
|
SharedAudioContext,
|
|
2146
|
-
|
|
2177
|
+
usePlayerMutedState,
|
|
2147
2178
|
useMediaVolumeState,
|
|
2148
2179
|
useFrameForVolumeProp,
|
|
2149
2180
|
evaluateVolume,
|
|
@@ -2185,7 +2216,7 @@ var AudioForPreviewAssertedShowing = ({
|
|
|
2185
2216
|
const { playbackRate: globalPlaybackRate } = Internals7.usePlaybackRate();
|
|
2186
2217
|
const sharedAudioContext = useContext2(SharedAudioContext);
|
|
2187
2218
|
const buffer = useBufferState();
|
|
2188
|
-
const [
|
|
2219
|
+
const [playerMuted] = usePlayerMutedState();
|
|
2189
2220
|
const [mediaVolume] = useMediaVolumeState();
|
|
2190
2221
|
const volumePropFrame = useFrameForVolumeProp(loopVolumeCurveBehavior ?? "repeat");
|
|
2191
2222
|
const userPreferredVolume = evaluateVolume({
|
|
@@ -2212,7 +2243,7 @@ var AudioForPreviewAssertedShowing = ({
|
|
|
2212
2243
|
if (!bufferingContext) {
|
|
2213
2244
|
throw new Error("useMediaPlayback must be used inside a <BufferingContext>");
|
|
2214
2245
|
}
|
|
2215
|
-
const effectiveMuted = muted ||
|
|
2246
|
+
const effectiveMuted = muted || playerMuted || userPreferredVolume <= 0;
|
|
2216
2247
|
const isPlayerBuffering = Internals7.useIsPlayerBuffering(bufferingContext);
|
|
2217
2248
|
const initialPlaying = useRef(playing && !isPlayerBuffering);
|
|
2218
2249
|
const initialIsPremounting = useRef(isPremounting);
|
|
@@ -2491,7 +2522,7 @@ import { useContext as useContext3, useLayoutEffect as useLayoutEffect2, useMemo
|
|
|
2491
2522
|
import {
|
|
2492
2523
|
cancelRender as cancelRender2,
|
|
2493
2524
|
Html5Audio,
|
|
2494
|
-
Internals as
|
|
2525
|
+
Internals as Internals16,
|
|
2495
2526
|
random,
|
|
2496
2527
|
useCurrentFrame as useCurrentFrame2,
|
|
2497
2528
|
useDelayRender,
|
|
@@ -3596,7 +3627,7 @@ var combineAudioDataAndClosePrevious = (audioDataArray) => {
|
|
|
3596
3627
|
};
|
|
3597
3628
|
|
|
3598
3629
|
// src/get-sink.ts
|
|
3599
|
-
import { Internals as
|
|
3630
|
+
import { Internals as Internals14 } from "remotion";
|
|
3600
3631
|
|
|
3601
3632
|
// src/video-extraction/get-frames-since-keyframe.ts
|
|
3602
3633
|
import {
|
|
@@ -3609,6 +3640,7 @@ import {
|
|
|
3609
3640
|
VideoSampleSink,
|
|
3610
3641
|
WEBM
|
|
3611
3642
|
} from "mediabunny";
|
|
3643
|
+
import { Internals as Internals13 } from "remotion";
|
|
3612
3644
|
|
|
3613
3645
|
// src/browser-can-use-webgl2.ts
|
|
3614
3646
|
var browserCanUseWebGl2 = null;
|
|
@@ -3660,7 +3692,7 @@ var getFormatOrNullOrNetworkError = async (input) => {
|
|
|
3660
3692
|
return null;
|
|
3661
3693
|
}
|
|
3662
3694
|
};
|
|
3663
|
-
var getSinks = async (src, credentials, requestInit) => {
|
|
3695
|
+
var getSinks = async (src, logLevel, credentials, requestInit) => {
|
|
3664
3696
|
const resolvedRequestInit = resolveRequestInit({ credentials, requestInit });
|
|
3665
3697
|
const input = new Input2({
|
|
3666
3698
|
formats: ALL_FORMATS2,
|
|
@@ -3699,7 +3731,7 @@ var getSinks = async (src, credentials, requestInit) => {
|
|
|
3699
3731
|
});
|
|
3700
3732
|
const hasAlpha = startPacket?.sideData.alpha;
|
|
3701
3733
|
if (hasAlpha && !canBrowserUseWebGl2()) {
|
|
3702
|
-
|
|
3734
|
+
Internals13.Log.warn({ logLevel, tag: "@remotion/media" }, `WebGL2 is not available, using the non-fast CPU path to decode alpha for ${src}.`);
|
|
3703
3735
|
}
|
|
3704
3736
|
return {
|
|
3705
3737
|
sampleSink
|
|
@@ -3780,11 +3812,11 @@ var getSink = (src, logLevel, credentials, requestInit) => {
|
|
|
3780
3812
|
});
|
|
3781
3813
|
let promise = sinkPromises[cacheKey];
|
|
3782
3814
|
if (!promise) {
|
|
3783
|
-
|
|
3815
|
+
Internals14.Log.verbose({
|
|
3784
3816
|
logLevel,
|
|
3785
3817
|
tag: "@remotion/media"
|
|
3786
3818
|
}, `Sink for ${src} was not found, creating new sink`);
|
|
3787
|
-
promise = getSinks(src, credentials, normalizedRequestInit);
|
|
3819
|
+
promise = getSinks(src, logLevel, credentials, normalizedRequestInit);
|
|
3788
3820
|
sinkPromises[cacheKey] = promise;
|
|
3789
3821
|
}
|
|
3790
3822
|
return promise;
|
|
@@ -3922,7 +3954,7 @@ var extractAudio = (params) => {
|
|
|
3922
3954
|
};
|
|
3923
3955
|
|
|
3924
3956
|
// src/video-extraction/extract-frame.ts
|
|
3925
|
-
import { Internals as
|
|
3957
|
+
import { Internals as Internals15 } from "remotion";
|
|
3926
3958
|
var extractFrameInternal = async ({
|
|
3927
3959
|
src,
|
|
3928
3960
|
timeInSeconds: unloopedTimeInSeconds,
|
|
@@ -4005,7 +4037,7 @@ var extractFrameInternal = async ({
|
|
|
4005
4037
|
durationInSeconds: await sink.getDuration()
|
|
4006
4038
|
};
|
|
4007
4039
|
} catch (err) {
|
|
4008
|
-
|
|
4040
|
+
Internals15.Log.info({ logLevel, tag: "@remotion/media" }, `Error decoding ${src} at time ${timeInSeconds}: ${err}`, err);
|
|
4009
4041
|
return { type: "cannot-decode", durationInSeconds: mediaDurationInSeconds };
|
|
4010
4042
|
}
|
|
4011
4043
|
};
|
|
@@ -4417,13 +4449,13 @@ var AudioForRendering = ({
|
|
|
4417
4449
|
credentials,
|
|
4418
4450
|
requestInit
|
|
4419
4451
|
}) => {
|
|
4420
|
-
const defaultLogLevel =
|
|
4452
|
+
const defaultLogLevel = Internals16.useLogLevel();
|
|
4421
4453
|
const logLevel = overriddenLogLevel ?? defaultLogLevel;
|
|
4422
4454
|
const frame = useCurrentFrame2();
|
|
4423
|
-
const absoluteFrame =
|
|
4424
|
-
const videoConfig =
|
|
4425
|
-
const { registerRenderAsset, unregisterRenderAsset } = useContext3(
|
|
4426
|
-
const startsAt =
|
|
4455
|
+
const absoluteFrame = Internals16.useTimelinePosition();
|
|
4456
|
+
const videoConfig = Internals16.useUnsafeVideoConfig();
|
|
4457
|
+
const { registerRenderAsset, unregisterRenderAsset } = useContext3(Internals16.RenderAssetManager);
|
|
4458
|
+
const startsAt = Internals16.useMediaStartsAt();
|
|
4427
4459
|
const environment = useRemotionEnvironment();
|
|
4428
4460
|
if (!videoConfig) {
|
|
4429
4461
|
throw new Error("No video config found");
|
|
@@ -4435,7 +4467,7 @@ var AudioForRendering = ({
|
|
|
4435
4467
|
const { delayRender, continueRender } = useDelayRender();
|
|
4436
4468
|
const [replaceWithHtml5Audio, setReplaceWithHtml5Audio] = useState2(false);
|
|
4437
4469
|
const [initialRequestInit] = useState2(requestInit);
|
|
4438
|
-
const sequenceContext = useContext3(
|
|
4470
|
+
const sequenceContext = useContext3(Internals16.SequenceContext);
|
|
4439
4471
|
const id = useMemo2(() => `media-audio-${random(src)}-${sequenceContext?.cumulatedFrom}-${sequenceContext?.relativeFrom}-${sequenceContext?.durationInFrames}`, [
|
|
4440
4472
|
src,
|
|
4441
4473
|
sequenceContext?.cumulatedFrom,
|
|
@@ -4443,7 +4475,7 @@ var AudioForRendering = ({
|
|
|
4443
4475
|
sequenceContext?.durationInFrames
|
|
4444
4476
|
]);
|
|
4445
4477
|
const maxCacheSize = useMaxMediaCacheSize(logLevel);
|
|
4446
|
-
const audioEnabled =
|
|
4478
|
+
const audioEnabled = Internals16.useAudioEnabled();
|
|
4447
4479
|
useLayoutEffect2(() => {
|
|
4448
4480
|
const timestamp = frame / fps;
|
|
4449
4481
|
const durationInSeconds = 1 / fps;
|
|
@@ -4495,7 +4527,7 @@ var AudioForRendering = ({
|
|
|
4495
4527
|
if (action === "fail") {
|
|
4496
4528
|
cancelRender2(errorToUse);
|
|
4497
4529
|
}
|
|
4498
|
-
|
|
4530
|
+
Internals16.Log.warn({ logLevel, tag: "@remotion/media" }, fallbackMessage);
|
|
4499
4531
|
setReplaceWithHtml5Audio(true);
|
|
4500
4532
|
};
|
|
4501
4533
|
if (result.type === "unknown-container-format") {
|
|
@@ -4522,12 +4554,12 @@ var AudioForRendering = ({
|
|
|
4522
4554
|
frame,
|
|
4523
4555
|
startsAt
|
|
4524
4556
|
});
|
|
4525
|
-
const volume =
|
|
4557
|
+
const volume = Internals16.evaluateVolume({
|
|
4526
4558
|
volume: volumeProp,
|
|
4527
4559
|
frame: volumePropsFrame,
|
|
4528
4560
|
mediaVolume: 1
|
|
4529
4561
|
});
|
|
4530
|
-
|
|
4562
|
+
Internals16.warnAboutTooHighVolume(volume);
|
|
4531
4563
|
if (audio && volume > 0) {
|
|
4532
4564
|
applyVolume(audio.data, volume);
|
|
4533
4565
|
registerRenderAsset({
|
|
@@ -4606,9 +4638,9 @@ var AudioForRendering = ({
|
|
|
4606
4638
|
|
|
4607
4639
|
// src/audio/audio.tsx
|
|
4608
4640
|
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
4609
|
-
var { validateMediaProps } =
|
|
4641
|
+
var { validateMediaProps } = Internals17;
|
|
4610
4642
|
var audioSchema = {
|
|
4611
|
-
...
|
|
4643
|
+
...Internals17.baseSchema,
|
|
4612
4644
|
volume: {
|
|
4613
4645
|
type: "number",
|
|
4614
4646
|
min: 0,
|
|
@@ -4642,11 +4674,11 @@ var AudioInner = (props) => {
|
|
|
4642
4674
|
...otherProps
|
|
4643
4675
|
} = props;
|
|
4644
4676
|
const environment = useRemotionEnvironment2();
|
|
4645
|
-
const [mediaVolume] =
|
|
4646
|
-
const mediaStartsAt =
|
|
4677
|
+
const [mediaVolume] = Internals17.useMediaVolumeState();
|
|
4678
|
+
const mediaStartsAt = Internals17.useMediaStartsAt();
|
|
4647
4679
|
const videoConfig = useVideoConfig2();
|
|
4648
4680
|
const sequenceDurationInFrames = Math.min(durationInFrames ?? Infinity, Math.max(0, videoConfig.durationInFrames - (from ?? 0)));
|
|
4649
|
-
const basicInfo =
|
|
4681
|
+
const basicInfo = Internals17.useBasicMediaInTimeline({
|
|
4650
4682
|
src: props.src,
|
|
4651
4683
|
volume: props.volume,
|
|
4652
4684
|
playbackRate: props.playbackRate ?? 1,
|
|
@@ -4718,12 +4750,12 @@ var Audio = Interactive.withSchema({
|
|
|
4718
4750
|
schema: audioSchema,
|
|
4719
4751
|
supportsEffects: false
|
|
4720
4752
|
});
|
|
4721
|
-
|
|
4753
|
+
Internals17.addSequenceStackTraces(Audio);
|
|
4722
4754
|
|
|
4723
4755
|
// src/video/video.tsx
|
|
4724
4756
|
import React6, { useMemo as useMemo6, useState as useState6 } from "react";
|
|
4725
4757
|
import {
|
|
4726
|
-
Internals as
|
|
4758
|
+
Internals as Internals21,
|
|
4727
4759
|
Interactive as Interactive2,
|
|
4728
4760
|
Sequence as Sequence2,
|
|
4729
4761
|
useRemotionEnvironment as useRemotionEnvironment4,
|
|
@@ -4742,7 +4774,7 @@ import {
|
|
|
4742
4774
|
} from "react";
|
|
4743
4775
|
import {
|
|
4744
4776
|
Html5Video,
|
|
4745
|
-
Internals as
|
|
4777
|
+
Internals as Internals19,
|
|
4746
4778
|
useBufferState as useBufferState2,
|
|
4747
4779
|
useCurrentFrame as useCurrentFrame3,
|
|
4748
4780
|
useVideoConfig as useVideoConfig3
|
|
@@ -4772,7 +4804,7 @@ var getCachedVideoFrame = (src) => {
|
|
|
4772
4804
|
};
|
|
4773
4805
|
|
|
4774
4806
|
// src/video/warn-object-fit-css.ts
|
|
4775
|
-
import { Internals as
|
|
4807
|
+
import { Internals as Internals18 } from "remotion";
|
|
4776
4808
|
var OBJECT_FIT_CLASS_PATTERN = /\bobject-(contain|cover|fill|none|scale-down)\b/;
|
|
4777
4809
|
var warnedStyle = false;
|
|
4778
4810
|
var warnedClassName = false;
|
|
@@ -4783,11 +4815,11 @@ var warnAboutObjectFitInStyleOrClassName = ({
|
|
|
4783
4815
|
}) => {
|
|
4784
4816
|
if (!warnedStyle && style?.objectFit) {
|
|
4785
4817
|
warnedStyle = true;
|
|
4786
|
-
|
|
4818
|
+
Internals18.Log.warn({ logLevel, tag: "@remotion/media" }, "Use the `objectFit` prop instead of the `style` prop.");
|
|
4787
4819
|
}
|
|
4788
4820
|
if (!warnedClassName && className && OBJECT_FIT_CLASS_PATTERN.test(className)) {
|
|
4789
4821
|
warnedClassName = true;
|
|
4790
|
-
|
|
4822
|
+
Internals18.Log.warn({ logLevel, tag: "@remotion/media" }, "Use the `objectFit` prop instead of `object-*` CSS class names.");
|
|
4791
4823
|
}
|
|
4792
4824
|
};
|
|
4793
4825
|
|
|
@@ -4797,7 +4829,7 @@ var {
|
|
|
4797
4829
|
useUnsafeVideoConfig: useUnsafeVideoConfig2,
|
|
4798
4830
|
Timeline: Timeline2,
|
|
4799
4831
|
SharedAudioContext: SharedAudioContext2,
|
|
4800
|
-
|
|
4832
|
+
usePlayerMutedState: usePlayerMutedState2,
|
|
4801
4833
|
useMediaVolumeState: useMediaVolumeState2,
|
|
4802
4834
|
useFrameForVolumeProp: useFrameForVolumeProp2,
|
|
4803
4835
|
evaluateVolume: evaluateVolume2,
|
|
@@ -4805,7 +4837,7 @@ var {
|
|
|
4805
4837
|
usePreload: usePreload2,
|
|
4806
4838
|
SequenceContext: SequenceContext2,
|
|
4807
4839
|
useEffectChainState
|
|
4808
|
-
} =
|
|
4840
|
+
} = Internals19;
|
|
4809
4841
|
var VideoForPreviewAssertedShowing = ({
|
|
4810
4842
|
src: unpreloadedSrc,
|
|
4811
4843
|
style,
|
|
@@ -4848,7 +4880,7 @@ var VideoForPreviewAssertedShowing = ({
|
|
|
4848
4880
|
const [mediaPlayerReady, setMediaPlayerReady] = useState4(false);
|
|
4849
4881
|
const [shouldFallbackToNativeVideo, setShouldFallbackToNativeVideo] = useState4(false);
|
|
4850
4882
|
const [playing] = Timeline2.usePlayingState();
|
|
4851
|
-
const { playbackRate: globalPlaybackRate } =
|
|
4883
|
+
const { playbackRate: globalPlaybackRate } = Internals19.usePlaybackRate();
|
|
4852
4884
|
const sharedAudioContext = useContext4(SharedAudioContext2);
|
|
4853
4885
|
const buffer = useBufferState2();
|
|
4854
4886
|
const canvasRefCallback = useCallback((canvas) => {
|
|
@@ -4858,7 +4890,7 @@ var VideoForPreviewAssertedShowing = ({
|
|
|
4858
4890
|
const fallbackVideoRef = useCallback((video) => {
|
|
4859
4891
|
refForOutline.current = video;
|
|
4860
4892
|
}, [refForOutline]);
|
|
4861
|
-
const [
|
|
4893
|
+
const [playerMuted] = usePlayerMutedState2();
|
|
4862
4894
|
const [mediaVolume] = useMediaVolumeState2();
|
|
4863
4895
|
const volumePropFrame = useFrameForVolumeProp2(loopVolumeCurveBehavior);
|
|
4864
4896
|
const userPreferredVolume = evaluateVolume2({
|
|
@@ -4883,12 +4915,12 @@ var VideoForPreviewAssertedShowing = ({
|
|
|
4883
4915
|
const currentTimeRef = useRef2(currentTime);
|
|
4884
4916
|
currentTimeRef.current = currentTime;
|
|
4885
4917
|
const preloadedSrc = usePreload2(src);
|
|
4886
|
-
const buffering = useContext4(
|
|
4918
|
+
const buffering = useContext4(Internals19.BufferingContextReact);
|
|
4887
4919
|
if (!buffering) {
|
|
4888
4920
|
throw new Error("useMediaPlayback must be used inside a <BufferingContext>");
|
|
4889
4921
|
}
|
|
4890
|
-
const effectiveMuted = muted ||
|
|
4891
|
-
const isPlayerBuffering =
|
|
4922
|
+
const effectiveMuted = muted || playerMuted || userPreferredVolume <= 0;
|
|
4923
|
+
const isPlayerBuffering = Internals19.useIsPlayerBuffering(buffering);
|
|
4892
4924
|
const initialPlaying = useRef2(playing && !isPlayerBuffering);
|
|
4893
4925
|
const initialIsPremounting = useRef2(isPremounting);
|
|
4894
4926
|
const initialIsPostmounting = useRef2(isPostmounting);
|
|
@@ -4999,7 +5031,7 @@ var VideoForPreviewAssertedShowing = ({
|
|
|
4999
5031
|
if (action === "fail") {
|
|
5000
5032
|
throw errorToUse;
|
|
5001
5033
|
}
|
|
5002
|
-
|
|
5034
|
+
Internals19.Log.warn({ logLevel, tag: "@remotion/media" }, fallbackMessage);
|
|
5003
5035
|
setShouldFallbackToNativeVideo(true);
|
|
5004
5036
|
};
|
|
5005
5037
|
if (result.type === "unknown-container-format") {
|
|
@@ -5034,7 +5066,7 @@ var VideoForPreviewAssertedShowing = ({
|
|
|
5034
5066
|
if (action === "fail") {
|
|
5035
5067
|
throw errorToUse;
|
|
5036
5068
|
}
|
|
5037
|
-
|
|
5069
|
+
Internals19.Log.error({ logLevel, tag: "@remotion/media" }, "[VideoForPreview] Failed to initialize MediaPlayer", errorToUse);
|
|
5038
5070
|
setShouldFallbackToNativeVideo(true);
|
|
5039
5071
|
});
|
|
5040
5072
|
} catch (error) {
|
|
@@ -5048,12 +5080,12 @@ var VideoForPreviewAssertedShowing = ({
|
|
|
5048
5080
|
if (action === "fail") {
|
|
5049
5081
|
throw errorToUse;
|
|
5050
5082
|
}
|
|
5051
|
-
|
|
5083
|
+
Internals19.Log.error({ logLevel, tag: "@remotion/media" }, "[VideoForPreview] MediaPlayer initialization failed", errorToUse);
|
|
5052
5084
|
setShouldFallbackToNativeVideo(true);
|
|
5053
5085
|
}
|
|
5054
5086
|
return () => {
|
|
5055
5087
|
if (mediaPlayerRef.current) {
|
|
5056
|
-
|
|
5088
|
+
Internals19.Log.trace({ logLevel, tag: "@remotion/media" }, `[VideoForPreview] Disposing MediaPlayer`);
|
|
5057
5089
|
mediaPlayerRef.current.dispose();
|
|
5058
5090
|
mediaPlayerRef.current = null;
|
|
5059
5091
|
}
|
|
@@ -5078,7 +5110,7 @@ var VideoForPreviewAssertedShowing = ({
|
|
|
5078
5110
|
]);
|
|
5079
5111
|
warnAboutObjectFitInStyleOrClassName({ style, className, logLevel });
|
|
5080
5112
|
const classNameValue = useMemo4(() => {
|
|
5081
|
-
return [
|
|
5113
|
+
return [Internals19.OBJECTFIT_CONTAIN_CLASS_NAME, className].filter(Internals19.truthy).join(" ");
|
|
5082
5114
|
}, [className]);
|
|
5083
5115
|
useCommonEffects({
|
|
5084
5116
|
mediaPlayerRef,
|
|
@@ -5202,7 +5234,7 @@ import {
|
|
|
5202
5234
|
useState as useState5
|
|
5203
5235
|
} from "react";
|
|
5204
5236
|
import {
|
|
5205
|
-
Internals as
|
|
5237
|
+
Internals as Internals20,
|
|
5206
5238
|
Loop,
|
|
5207
5239
|
random as random2,
|
|
5208
5240
|
useCurrentFrame as useCurrentFrame4,
|
|
@@ -5243,11 +5275,11 @@ var VideoForRendering = ({
|
|
|
5243
5275
|
throw new TypeError("No `src` was passed to <Video>.");
|
|
5244
5276
|
}
|
|
5245
5277
|
const frame = useCurrentFrame4();
|
|
5246
|
-
const absoluteFrame =
|
|
5278
|
+
const absoluteFrame = Internals20.useTimelinePosition();
|
|
5247
5279
|
const { fps } = useVideoConfig4();
|
|
5248
|
-
const { registerRenderAsset, unregisterRenderAsset } = useContext5(
|
|
5249
|
-
const startsAt =
|
|
5250
|
-
const sequenceContext = useContext5(
|
|
5280
|
+
const { registerRenderAsset, unregisterRenderAsset } = useContext5(Internals20.RenderAssetManager);
|
|
5281
|
+
const startsAt = Internals20.useMediaStartsAt();
|
|
5282
|
+
const sequenceContext = useContext5(Internals20.SequenceContext);
|
|
5251
5283
|
const id = useMemo5(() => `media-video-${random2(src)}-${sequenceContext?.cumulatedFrom}-${sequenceContext?.relativeFrom}-${sequenceContext?.durationInFrames}`, [
|
|
5252
5284
|
src,
|
|
5253
5285
|
sequenceContext?.cumulatedFrom,
|
|
@@ -5259,10 +5291,10 @@ var VideoForRendering = ({
|
|
|
5259
5291
|
const canvasRef = useRef3(null);
|
|
5260
5292
|
const [replaceWithOffthreadVideo, setReplaceWithOffthreadVideo] = useState5(false);
|
|
5261
5293
|
const [initialRequestInit] = useState5(requestInit);
|
|
5262
|
-
const audioEnabled =
|
|
5263
|
-
const videoEnabled =
|
|
5294
|
+
const audioEnabled = Internals20.useAudioEnabled();
|
|
5295
|
+
const videoEnabled = Internals20.useVideoEnabled();
|
|
5264
5296
|
const maxCacheSize = useMaxMediaCacheSize(logLevel);
|
|
5265
|
-
const effectChainState =
|
|
5297
|
+
const effectChainState = Internals20.useEffectChainState();
|
|
5266
5298
|
const [error, setError] = useState5(null);
|
|
5267
5299
|
if (error) {
|
|
5268
5300
|
throw error;
|
|
@@ -5327,7 +5359,7 @@ var VideoForRendering = ({
|
|
|
5327
5359
|
return;
|
|
5328
5360
|
}
|
|
5329
5361
|
if (window.remotion_isMainTab) {
|
|
5330
|
-
|
|
5362
|
+
Internals20.Log.warn({ logLevel, tag: "@remotion/media" }, fallbackMessage);
|
|
5331
5363
|
}
|
|
5332
5364
|
setReplaceWithOffthreadVideo({
|
|
5333
5365
|
durationInSeconds: mediaDurationInSeconds
|
|
@@ -5365,7 +5397,7 @@ var VideoForRendering = ({
|
|
|
5365
5397
|
context.canvas.style.aspectRatio = `${context.canvas.width} / ${context.canvas.height}`;
|
|
5366
5398
|
context.drawImage(imageBitmap, 0, 0);
|
|
5367
5399
|
if (effects.length > 0) {
|
|
5368
|
-
const completed = await
|
|
5400
|
+
const completed = await Internals20.runEffectChain({
|
|
5369
5401
|
state: effectChainState.get(imageBitmap.width, imageBitmap.height),
|
|
5370
5402
|
source: context.canvas,
|
|
5371
5403
|
effects,
|
|
@@ -5396,12 +5428,12 @@ var VideoForRendering = ({
|
|
|
5396
5428
|
frame,
|
|
5397
5429
|
startsAt
|
|
5398
5430
|
});
|
|
5399
|
-
const volume =
|
|
5431
|
+
const volume = Internals20.evaluateVolume({
|
|
5400
5432
|
volume: volumeProp,
|
|
5401
5433
|
frame: volumePropsFrame,
|
|
5402
5434
|
mediaVolume: 1
|
|
5403
5435
|
});
|
|
5404
|
-
|
|
5436
|
+
Internals20.warnAboutTooHighVolume(volume);
|
|
5405
5437
|
if (audio && volume > 0) {
|
|
5406
5438
|
applyVolume(audio.data, volume);
|
|
5407
5439
|
registerRenderAsset({
|
|
@@ -5462,7 +5494,7 @@ var VideoForRendering = ({
|
|
|
5462
5494
|
]);
|
|
5463
5495
|
warnAboutObjectFitInStyleOrClassName({ style, className, logLevel });
|
|
5464
5496
|
const classNameValue = useMemo5(() => {
|
|
5465
|
-
return [
|
|
5497
|
+
return [Internals20.OBJECTFIT_CONTAIN_CLASS_NAME, className].filter(Internals20.truthy).join(" ");
|
|
5466
5498
|
}, [className]);
|
|
5467
5499
|
const styleWithObjectFit = useMemo5(() => {
|
|
5468
5500
|
return {
|
|
@@ -5471,7 +5503,7 @@ var VideoForRendering = ({
|
|
|
5471
5503
|
};
|
|
5472
5504
|
}, [objectFitProp, style]);
|
|
5473
5505
|
if (replaceWithOffthreadVideo) {
|
|
5474
|
-
const fallback = /* @__PURE__ */ jsx5(
|
|
5506
|
+
const fallback = /* @__PURE__ */ jsx5(Internals20.InnerOffthreadVideo, {
|
|
5475
5507
|
...props,
|
|
5476
5508
|
src,
|
|
5477
5509
|
playbackRate: playbackRate ?? 1,
|
|
@@ -5513,7 +5545,7 @@ var VideoForRendering = ({
|
|
|
5513
5545
|
}
|
|
5514
5546
|
return /* @__PURE__ */ jsx5(Loop, {
|
|
5515
5547
|
layout: "none",
|
|
5516
|
-
durationInFrames:
|
|
5548
|
+
durationInFrames: Internals20.calculateMediaDuration({
|
|
5517
5549
|
trimAfter: trimAfterValue,
|
|
5518
5550
|
mediaDurationInFrames: replaceWithOffthreadVideo.durationInSeconds * fps,
|
|
5519
5551
|
playbackRate,
|
|
@@ -5537,9 +5569,9 @@ var VideoForRendering = ({
|
|
|
5537
5569
|
|
|
5538
5570
|
// src/video/video.tsx
|
|
5539
5571
|
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
5540
|
-
var { validateMediaTrimProps, resolveTrimProps, validateMediaProps: validateMediaProps2 } =
|
|
5572
|
+
var { validateMediaTrimProps, resolveTrimProps, validateMediaProps: validateMediaProps2 } = Internals21;
|
|
5541
5573
|
var videoSchema = {
|
|
5542
|
-
...
|
|
5574
|
+
...Internals21.baseSchema,
|
|
5543
5575
|
volume: {
|
|
5544
5576
|
type: "number",
|
|
5545
5577
|
min: 0,
|
|
@@ -5559,7 +5591,7 @@ var videoSchema = {
|
|
|
5559
5591
|
keyframable: false
|
|
5560
5592
|
},
|
|
5561
5593
|
loop: { type: "boolean", default: false, description: "Loop" },
|
|
5562
|
-
...
|
|
5594
|
+
...Internals21.transformSchema
|
|
5563
5595
|
};
|
|
5564
5596
|
var InnerVideo = ({
|
|
5565
5597
|
src,
|
|
@@ -5711,12 +5743,12 @@ var VideoInner = ({
|
|
|
5711
5743
|
hidden,
|
|
5712
5744
|
...props
|
|
5713
5745
|
}) => {
|
|
5714
|
-
const fallbackLogLevel =
|
|
5715
|
-
const [mediaVolume] =
|
|
5716
|
-
const mediaStartsAt =
|
|
5746
|
+
const fallbackLogLevel = Internals21.useLogLevel();
|
|
5747
|
+
const [mediaVolume] = Internals21.useMediaVolumeState();
|
|
5748
|
+
const mediaStartsAt = Internals21.useMediaStartsAt();
|
|
5717
5749
|
const videoConfig = useVideoConfig5();
|
|
5718
5750
|
const sequenceDurationInFrames = Math.min(durationInFrames ?? Infinity, Math.max(0, videoConfig.durationInFrames - (from ?? 0)));
|
|
5719
|
-
const basicInfo =
|
|
5751
|
+
const basicInfo = Internals21.useBasicMediaInTimeline({
|
|
5720
5752
|
src,
|
|
5721
5753
|
volume,
|
|
5722
5754
|
playbackRate: playbackRate ?? 1,
|
|
@@ -5751,11 +5783,11 @@ var VideoInner = ({
|
|
|
5751
5783
|
type: "video",
|
|
5752
5784
|
data: basicInfo
|
|
5753
5785
|
}), [basicInfo]);
|
|
5754
|
-
const memoizedEffects =
|
|
5786
|
+
const memoizedEffects = Internals21.useMemoizedEffects({
|
|
5755
5787
|
effects: effects ?? [],
|
|
5756
5788
|
overrideId: controls?.overrideId ?? null
|
|
5757
5789
|
});
|
|
5758
|
-
const memoizedEffectDefinitions =
|
|
5790
|
+
const memoizedEffectDefinitions = Internals21.useMemoizedEffectDefinitions(effects ?? []);
|
|
5759
5791
|
const refForOutline = React6.useRef(null);
|
|
5760
5792
|
if (sequenceDurationInFrames === 0) {
|
|
5761
5793
|
return null;
|
|
@@ -5818,7 +5850,7 @@ var Video = Interactive2.withSchema({
|
|
|
5818
5850
|
schema: videoSchema,
|
|
5819
5851
|
supportsEffects: true
|
|
5820
5852
|
});
|
|
5821
|
-
|
|
5853
|
+
Internals21.addSequenceStackTraces(Video);
|
|
5822
5854
|
|
|
5823
5855
|
// src/index.ts
|
|
5824
5856
|
var experimental_Audio = Audio;
|
|
@@ -8,7 +8,7 @@ type AudioSinks = {
|
|
|
8
8
|
};
|
|
9
9
|
export type AudioSinkResult = AudioSinks | 'no-audio-track' | 'cannot-decode-audio' | 'unknown-container-format' | 'network-error';
|
|
10
10
|
export type VideoSinkResult = VideoSinks | 'no-video-track' | 'cannot-decode' | 'cannot-decode-alpha' | 'unknown-container-format' | 'network-error';
|
|
11
|
-
export declare const getSinks: (src: string, credentials: RequestCredentials | undefined, requestInit?: MediaRequestInit | undefined) => Promise<{
|
|
11
|
+
export declare const getSinks: (src: string, logLevel: "error" | "info" | "trace" | "verbose" | "warn", credentials: RequestCredentials | undefined, requestInit?: MediaRequestInit | undefined) => Promise<{
|
|
12
12
|
getVideo: () => Promise<VideoSinkResult>;
|
|
13
13
|
getAudio: (index: number | null) => Promise<AudioSinkResult>;
|
|
14
14
|
actualMatroskaTimestamps: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/media",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.483",
|
|
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.47.0",
|
|
26
|
-
"remotion": "4.0.
|
|
26
|
+
"remotion": "4.0.483",
|
|
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.483",
|
|
35
35
|
"@vitest/browser-webdriverio": "4.0.9",
|
|
36
36
|
"eslint": "9.19.0",
|
|
37
37
|
"react": "19.2.3",
|