@remotion/media 4.0.454 → 4.0.456
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/audio/audio-for-preview.d.ts +3 -4
- package/dist/audio/audio.d.ts +22 -2
- package/dist/audio/props.d.ts +2 -12
- package/dist/debug-overlay/preview-overlay.d.ts +1 -1
- package/dist/esm/index.mjs +370 -358
- package/dist/helpers/resolve-audio-track.d.ts +6 -0
- package/dist/index.d.ts +24 -6
- package/dist/media-player.d.ts +9 -1
- package/dist/show-in-timeline.d.ts +3 -1
- package/dist/use-media-in-timeline.d.ts +3 -2
- package/dist/video/props.d.ts +4 -12
- package/dist/video/video-for-preview.d.ts +3 -2
- package/dist/video/video-for-rendering.d.ts +0 -1
- package/dist/video/video.d.ts +2 -5
- package/dist/video-iterator-manager.d.ts +6 -2
- package/package.json +3 -3
package/dist/esm/index.mjs
CHANGED
|
@@ -37,20 +37,53 @@ var __callDispose = (stack, error, hasError) => {
|
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
// src/audio/audio.tsx
|
|
40
|
-
import {
|
|
40
|
+
import { useState as useState3 } from "react";
|
|
41
|
+
import { useMemo as useMemo3 } from "react";
|
|
42
|
+
import {
|
|
43
|
+
useVideoConfig as useVideoConfig2
|
|
44
|
+
} from "remotion";
|
|
45
|
+
import { Internals as Internals16, Sequence, useRemotionEnvironment as useRemotionEnvironment2 } from "remotion";
|
|
46
|
+
|
|
47
|
+
// src/show-in-timeline.ts
|
|
48
|
+
import { Internals } from "remotion";
|
|
49
|
+
var getLoopDisplay = ({
|
|
50
|
+
loop,
|
|
51
|
+
mediaDurationInSeconds,
|
|
52
|
+
playbackRate,
|
|
53
|
+
trimAfter,
|
|
54
|
+
trimBefore,
|
|
55
|
+
sequenceDurationInFrames,
|
|
56
|
+
compFps
|
|
57
|
+
}) => {
|
|
58
|
+
if (!loop || !mediaDurationInSeconds) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const durationInFrames = Internals.calculateMediaDuration({
|
|
62
|
+
mediaDurationInFrames: mediaDurationInSeconds * compFps,
|
|
63
|
+
playbackRate,
|
|
64
|
+
trimAfter,
|
|
65
|
+
trimBefore
|
|
66
|
+
});
|
|
67
|
+
const maxTimes = sequenceDurationInFrames / durationInFrames;
|
|
68
|
+
return {
|
|
69
|
+
numberOfTimes: maxTimes,
|
|
70
|
+
startOffset: 0,
|
|
71
|
+
durationInFrames
|
|
72
|
+
};
|
|
73
|
+
};
|
|
41
74
|
|
|
42
75
|
// src/audio/audio-for-preview.tsx
|
|
43
|
-
import { useContext as
|
|
76
|
+
import { useContext as useContext2, useEffect, useMemo, useRef, useState } from "react";
|
|
44
77
|
import {
|
|
45
|
-
Internals as
|
|
78
|
+
Internals as Internals7,
|
|
46
79
|
Audio as RemotionAudio,
|
|
47
80
|
useBufferState,
|
|
48
81
|
useCurrentFrame,
|
|
49
|
-
useVideoConfig
|
|
82
|
+
useVideoConfig
|
|
50
83
|
} from "remotion";
|
|
51
84
|
|
|
52
85
|
// src/get-time-in-seconds.ts
|
|
53
|
-
import { Internals } from "remotion";
|
|
86
|
+
import { Internals as Internals2 } from "remotion";
|
|
54
87
|
var getTimeInSeconds = ({
|
|
55
88
|
loop,
|
|
56
89
|
mediaDurationInSeconds,
|
|
@@ -65,7 +98,7 @@ var getTimeInSeconds = ({
|
|
|
65
98
|
if (mediaDurationInSeconds === null && loop && ifNoMediaDuration === "fail") {
|
|
66
99
|
throw new Error(`Could not determine duration of ${src}, but "loop" was set.`);
|
|
67
100
|
}
|
|
68
|
-
const loopDuration = loop ?
|
|
101
|
+
const loopDuration = loop ? Internals2.calculateMediaDuration({
|
|
69
102
|
trimAfter,
|
|
70
103
|
mediaDurationInFrames: mediaDurationInSeconds ? mediaDurationInSeconds * fps : Infinity,
|
|
71
104
|
playbackRate: 1,
|
|
@@ -91,7 +124,7 @@ var calculateEndTime = ({
|
|
|
91
124
|
if (mediaDurationInSeconds === null && ifNoMediaDuration === "fail") {
|
|
92
125
|
throw new Error(`Could not determine duration of ${src}, but "loop" was set.`);
|
|
93
126
|
}
|
|
94
|
-
const mediaDuration =
|
|
127
|
+
const mediaDuration = Internals2.calculateMediaDuration({
|
|
95
128
|
trimAfter,
|
|
96
129
|
mediaDurationInFrames: mediaDurationInSeconds ? mediaDurationInSeconds * fps : Infinity,
|
|
97
130
|
playbackRate: 1,
|
|
@@ -102,11 +135,11 @@ var calculateEndTime = ({
|
|
|
102
135
|
|
|
103
136
|
// src/media-player.ts
|
|
104
137
|
import { ALL_FORMATS, Input, UrlSource } from "mediabunny";
|
|
105
|
-
import { Internals as
|
|
138
|
+
import { Internals as Internals5 } from "remotion";
|
|
106
139
|
|
|
107
140
|
// src/audio-iterator-manager.ts
|
|
108
141
|
import { AudioBufferSink, InputDisposedError } from "mediabunny";
|
|
109
|
-
import { Internals as
|
|
142
|
+
import { Internals as Internals3 } from "remotion";
|
|
110
143
|
|
|
111
144
|
// src/make-iterator-with-priming.ts
|
|
112
145
|
var AUDIO_PRIMING_SECONDS = 0.5;
|
|
@@ -451,7 +484,7 @@ var audioIteratorManager = ({
|
|
|
451
484
|
node.connect(gainNode);
|
|
452
485
|
const started = scheduleAudioNode(node, mediaTimestamp, originalUnloopedMediaTimestamp, currentTime);
|
|
453
486
|
if (started.type === "not-started") {
|
|
454
|
-
|
|
487
|
+
Internals3.Log.verbose({ logLevel, tag: "audio-scheduling" }, "not started, disconnected: %s %s", mediaTimestamp.toFixed(3), buffer.duration.toFixed(3));
|
|
455
488
|
node.disconnect();
|
|
456
489
|
return;
|
|
457
490
|
}
|
|
@@ -765,6 +798,21 @@ var getDurationOrCompute = async (input) => {
|
|
|
765
798
|
}) ?? input.computeDuration(undefined, { skipLiveWait: true });
|
|
766
799
|
};
|
|
767
800
|
|
|
801
|
+
// src/helpers/resolve-audio-track.ts
|
|
802
|
+
var resolveAudioTrack = async ({
|
|
803
|
+
videoTrack,
|
|
804
|
+
audioTracks,
|
|
805
|
+
audioStreamIndex
|
|
806
|
+
}) => {
|
|
807
|
+
if (audioStreamIndex !== null) {
|
|
808
|
+
return audioTracks[audioStreamIndex] ?? null;
|
|
809
|
+
}
|
|
810
|
+
if (videoTrack) {
|
|
811
|
+
return await videoTrack.getPrimaryPairableAudioTrack() ?? null;
|
|
812
|
+
}
|
|
813
|
+
return audioTracks[0] ?? null;
|
|
814
|
+
};
|
|
815
|
+
|
|
768
816
|
// src/is-type-of-error.ts
|
|
769
817
|
function isNetworkError(error) {
|
|
770
818
|
if (error.message.includes("Failed to fetch") || error.message.includes("Load failed") || error.message.includes("NetworkError when attempting to fetch resource")) {
|
|
@@ -793,7 +841,7 @@ var makeNonceManager = () => {
|
|
|
793
841
|
|
|
794
842
|
// src/video-iterator-manager.ts
|
|
795
843
|
import { CanvasSink } from "mediabunny";
|
|
796
|
-
import { Internals as
|
|
844
|
+
import { Internals as Internals4 } from "remotion";
|
|
797
845
|
|
|
798
846
|
// src/canvas-ahead-of-time.ts
|
|
799
847
|
var canvasesAheadOfTime = (videoSink, startTimestamp) => {
|
|
@@ -1020,6 +1068,7 @@ var createVideoIterator = async (timeToSeek, cache) => {
|
|
|
1020
1068
|
};
|
|
1021
1069
|
|
|
1022
1070
|
// src/video-iterator-manager.ts
|
|
1071
|
+
var { runEffectChain } = Internals4;
|
|
1023
1072
|
var videoIteratorManager = async ({
|
|
1024
1073
|
delayPlaybackHandleIfNotPremounting,
|
|
1025
1074
|
canvas,
|
|
@@ -1030,7 +1079,10 @@ var videoIteratorManager = async ({
|
|
|
1030
1079
|
videoTrack,
|
|
1031
1080
|
getLoopSegmentMediaEndTimestamp,
|
|
1032
1081
|
getStartTime,
|
|
1033
|
-
getIsLooping
|
|
1082
|
+
getIsLooping,
|
|
1083
|
+
getEffects,
|
|
1084
|
+
getEffectChainState,
|
|
1085
|
+
getCurrentFrame
|
|
1034
1086
|
}) => {
|
|
1035
1087
|
let videoIteratorsCreated = 0;
|
|
1036
1088
|
let videoFrameIterator = null;
|
|
@@ -1050,10 +1102,24 @@ var videoIteratorManager = async ({
|
|
|
1050
1102
|
alpha: true
|
|
1051
1103
|
});
|
|
1052
1104
|
const prewarmedVideoIteratorCache = makePrewarmedVideoIteratorCache(canvasSink);
|
|
1053
|
-
const drawFrame = (frame) => {
|
|
1105
|
+
const drawFrame = async (frame) => {
|
|
1054
1106
|
if (context && canvas) {
|
|
1055
|
-
|
|
1056
|
-
|
|
1107
|
+
const effects = getEffects();
|
|
1108
|
+
const chainState = getEffectChainState(canvas.width, canvas.height);
|
|
1109
|
+
if (effects.length > 0 && chainState && canvas instanceof HTMLCanvasElement) {
|
|
1110
|
+
await runEffectChain({
|
|
1111
|
+
state: chainState,
|
|
1112
|
+
source: frame.canvas,
|
|
1113
|
+
effects,
|
|
1114
|
+
output: canvas,
|
|
1115
|
+
frame: getCurrentFrame(),
|
|
1116
|
+
width: canvas.width,
|
|
1117
|
+
height: canvas.height
|
|
1118
|
+
});
|
|
1119
|
+
} else {
|
|
1120
|
+
context.clearRect(0, 0, canvas.width, canvas.height);
|
|
1121
|
+
context.drawImage(frame.canvas, 0, 0);
|
|
1122
|
+
}
|
|
1057
1123
|
}
|
|
1058
1124
|
framesRendered++;
|
|
1059
1125
|
drawDebugOverlay();
|
|
@@ -1061,7 +1127,7 @@ var videoIteratorManager = async ({
|
|
|
1061
1127
|
if (callback) {
|
|
1062
1128
|
callback(frame.canvas);
|
|
1063
1129
|
}
|
|
1064
|
-
|
|
1130
|
+
Internals4.Log.trace({ logLevel, tag: "@remotion/media" }, `[MediaPlayer] Drew frame ${frame.timestamp.toFixed(3)}s`);
|
|
1065
1131
|
};
|
|
1066
1132
|
const startVideoIterator = async (timeToSeek, nonce) => {
|
|
1067
1133
|
let __stack = [];
|
|
@@ -1084,7 +1150,7 @@ var videoIteratorManager = async ({
|
|
|
1084
1150
|
if (!iterator.initialFrame) {
|
|
1085
1151
|
return;
|
|
1086
1152
|
}
|
|
1087
|
-
drawFrame(iterator.initialFrame);
|
|
1153
|
+
await drawFrame(iterator.initialFrame);
|
|
1088
1154
|
} catch (_catch) {
|
|
1089
1155
|
var _err = _catch, _hasErr = 1;
|
|
1090
1156
|
} finally {
|
|
@@ -1104,7 +1170,7 @@ var videoIteratorManager = async ({
|
|
|
1104
1170
|
}
|
|
1105
1171
|
const videoSatisfyResult = videoFrameIterator.tryToSatisfySeek(newTime);
|
|
1106
1172
|
if (videoSatisfyResult.type === "satisfied") {
|
|
1107
|
-
drawFrame(videoSatisfyResult.frame);
|
|
1173
|
+
await drawFrame(videoSatisfyResult.frame);
|
|
1108
1174
|
return;
|
|
1109
1175
|
}
|
|
1110
1176
|
if (nonce.isStale()) {
|
|
@@ -1158,6 +1224,9 @@ class MediaPlayer {
|
|
|
1158
1224
|
debugOverlay = false;
|
|
1159
1225
|
nonceManager;
|
|
1160
1226
|
onVideoFrameCallback = null;
|
|
1227
|
+
getEffects;
|
|
1228
|
+
getEffectChainState;
|
|
1229
|
+
getCurrentFrame;
|
|
1161
1230
|
initializationPromise = null;
|
|
1162
1231
|
bufferState;
|
|
1163
1232
|
isPremounting;
|
|
@@ -1184,7 +1253,10 @@ class MediaPlayer {
|
|
|
1184
1253
|
playing,
|
|
1185
1254
|
sequenceOffset,
|
|
1186
1255
|
credentials,
|
|
1187
|
-
tagType
|
|
1256
|
+
tagType,
|
|
1257
|
+
getEffects,
|
|
1258
|
+
getEffectChainState,
|
|
1259
|
+
getCurrentFrame
|
|
1188
1260
|
}) {
|
|
1189
1261
|
this.canvas = canvas ?? null;
|
|
1190
1262
|
this.src = src;
|
|
@@ -1213,6 +1285,9 @@ class MediaPlayer {
|
|
|
1213
1285
|
formats: ALL_FORMATS
|
|
1214
1286
|
});
|
|
1215
1287
|
this.tagType = tagType;
|
|
1288
|
+
this.getEffects = getEffects;
|
|
1289
|
+
this.getEffectChainState = getEffectChainState;
|
|
1290
|
+
this.getCurrentFrame = getCurrentFrame;
|
|
1216
1291
|
if (canvas) {
|
|
1217
1292
|
const context = canvas.getContext("2d", {
|
|
1218
1293
|
alpha: true,
|
|
@@ -1276,7 +1351,7 @@ class MediaPlayer {
|
|
|
1276
1351
|
if (isNetworkError(err)) {
|
|
1277
1352
|
throw error;
|
|
1278
1353
|
}
|
|
1279
|
-
|
|
1354
|
+
Internals5.Log.error({ logLevel: this.logLevel, tag: "@remotion/media" }, `[MediaPlayer] Failed to recognize format for ${this.src}`, error);
|
|
1280
1355
|
return { type: "unknown-container-format" };
|
|
1281
1356
|
}
|
|
1282
1357
|
const [durationInSeconds, videoTrack, audioTracks] = await Promise.all([
|
|
@@ -1288,7 +1363,11 @@ class MediaPlayer {
|
|
|
1288
1363
|
return { type: "disposed" };
|
|
1289
1364
|
}
|
|
1290
1365
|
this.totalDuration = durationInSeconds;
|
|
1291
|
-
const audioTrack = await (
|
|
1366
|
+
const audioTrack = await resolveAudioTrack({
|
|
1367
|
+
videoTrack,
|
|
1368
|
+
audioTracks,
|
|
1369
|
+
audioStreamIndex: this.audioStreamIndex
|
|
1370
|
+
});
|
|
1292
1371
|
if (!videoTrack && !audioTrack) {
|
|
1293
1372
|
return { type: "no-tracks" };
|
|
1294
1373
|
}
|
|
@@ -1316,7 +1395,10 @@ class MediaPlayer {
|
|
|
1316
1395
|
drawDebugOverlay: this.drawDebugOverlay,
|
|
1317
1396
|
getLoopSegmentMediaEndTimestamp: () => this.getLoopSegmentMediaEndTimestamp(),
|
|
1318
1397
|
getStartTime: () => this.getStartTime(),
|
|
1319
|
-
getIsLooping: () => this.loop
|
|
1398
|
+
getIsLooping: () => this.loop,
|
|
1399
|
+
getEffects: this.getEffects,
|
|
1400
|
+
getEffectChainState: this.getEffectChainState,
|
|
1401
|
+
getCurrentFrame: this.getCurrentFrame
|
|
1320
1402
|
});
|
|
1321
1403
|
}
|
|
1322
1404
|
const startTime = this.getTrimmedTime(startTimeUnresolved);
|
|
@@ -1376,16 +1458,16 @@ class MediaPlayer {
|
|
|
1376
1458
|
if (this.isDisposalError()) {
|
|
1377
1459
|
return { type: "disposed" };
|
|
1378
1460
|
}
|
|
1379
|
-
|
|
1461
|
+
Internals5.Log.error({ logLevel: this.logLevel, tag: "@remotion/media" }, "[MediaPlayer] Failed to start audio and video iterators", error);
|
|
1380
1462
|
}
|
|
1381
1463
|
return { type: "success", durationInSeconds };
|
|
1382
1464
|
} catch (error) {
|
|
1383
1465
|
const err = error;
|
|
1384
1466
|
if (isNetworkError(err)) {
|
|
1385
|
-
|
|
1467
|
+
Internals5.Log.error({ logLevel: this.logLevel, tag: "@remotion/media" }, `[MediaPlayer] Network/CORS error for ${this.src}`, err);
|
|
1386
1468
|
return { type: "network-error" };
|
|
1387
1469
|
}
|
|
1388
|
-
|
|
1470
|
+
Internals5.Log.error({ logLevel: this.logLevel, tag: "@remotion/media" }, "[MediaPlayer] Failed to initialize", error);
|
|
1389
1471
|
throw error;
|
|
1390
1472
|
}
|
|
1391
1473
|
} catch (_catch) {
|
|
@@ -1673,45 +1755,6 @@ var callOnErrorAndResolve = ({
|
|
|
1673
1755
|
return ["fallback", error];
|
|
1674
1756
|
};
|
|
1675
1757
|
|
|
1676
|
-
// src/show-in-timeline.ts
|
|
1677
|
-
import { useMemo } from "react";
|
|
1678
|
-
import { Internals as Internals5, useVideoConfig } from "remotion";
|
|
1679
|
-
var useLoopDisplay = ({
|
|
1680
|
-
loop,
|
|
1681
|
-
mediaDurationInSeconds,
|
|
1682
|
-
playbackRate,
|
|
1683
|
-
trimAfter,
|
|
1684
|
-
trimBefore
|
|
1685
|
-
}) => {
|
|
1686
|
-
const { durationInFrames: compDuration, fps } = useVideoConfig();
|
|
1687
|
-
const loopDisplay = useMemo(() => {
|
|
1688
|
-
if (!loop || !mediaDurationInSeconds) {
|
|
1689
|
-
return;
|
|
1690
|
-
}
|
|
1691
|
-
const durationInFrames = Internals5.calculateMediaDuration({
|
|
1692
|
-
mediaDurationInFrames: mediaDurationInSeconds * fps,
|
|
1693
|
-
playbackRate,
|
|
1694
|
-
trimAfter,
|
|
1695
|
-
trimBefore
|
|
1696
|
-
});
|
|
1697
|
-
const maxTimes = compDuration / durationInFrames;
|
|
1698
|
-
return {
|
|
1699
|
-
numberOfTimes: maxTimes,
|
|
1700
|
-
startOffset: 0,
|
|
1701
|
-
durationInFrames
|
|
1702
|
-
};
|
|
1703
|
-
}, [
|
|
1704
|
-
compDuration,
|
|
1705
|
-
fps,
|
|
1706
|
-
loop,
|
|
1707
|
-
mediaDurationInSeconds,
|
|
1708
|
-
playbackRate,
|
|
1709
|
-
trimAfter,
|
|
1710
|
-
trimBefore
|
|
1711
|
-
]);
|
|
1712
|
-
return loopDisplay;
|
|
1713
|
-
};
|
|
1714
|
-
|
|
1715
1758
|
// src/use-common-effects.ts
|
|
1716
1759
|
import { useContext, useLayoutEffect } from "react";
|
|
1717
1760
|
import { Internals as Internals6 } from "remotion";
|
|
@@ -1860,110 +1903,6 @@ var useCommonEffects = ({
|
|
|
1860
1903
|
}, [currentTime, logLevel, mediaPlayerReady, label, mediaPlayerRef]);
|
|
1861
1904
|
};
|
|
1862
1905
|
|
|
1863
|
-
// src/use-media-in-timeline.ts
|
|
1864
|
-
import { useContext as useContext2, useEffect, useState } from "react";
|
|
1865
|
-
import { Internals as Internals7 } from "remotion";
|
|
1866
|
-
var useMediaInTimeline = ({
|
|
1867
|
-
volume,
|
|
1868
|
-
mediaVolume,
|
|
1869
|
-
src,
|
|
1870
|
-
mediaType,
|
|
1871
|
-
playbackRate,
|
|
1872
|
-
displayName,
|
|
1873
|
-
stack,
|
|
1874
|
-
showInTimeline,
|
|
1875
|
-
premountDisplay,
|
|
1876
|
-
postmountDisplay,
|
|
1877
|
-
loopDisplay,
|
|
1878
|
-
trimBefore,
|
|
1879
|
-
trimAfter,
|
|
1880
|
-
controls
|
|
1881
|
-
}) => {
|
|
1882
|
-
const parentSequence = useContext2(Internals7.SequenceContext);
|
|
1883
|
-
const startsAt = Internals7.useMediaStartsAt();
|
|
1884
|
-
const { registerSequence, unregisterSequence } = useContext2(Internals7.SequenceManager);
|
|
1885
|
-
const [mediaId] = useState(() => String(Math.random()));
|
|
1886
|
-
const {
|
|
1887
|
-
volumes,
|
|
1888
|
-
duration,
|
|
1889
|
-
doesVolumeChange,
|
|
1890
|
-
nonce,
|
|
1891
|
-
rootId,
|
|
1892
|
-
isStudio,
|
|
1893
|
-
finalDisplayName
|
|
1894
|
-
} = Internals7.useBasicMediaInTimeline({
|
|
1895
|
-
volume,
|
|
1896
|
-
mediaVolume,
|
|
1897
|
-
mediaType,
|
|
1898
|
-
src,
|
|
1899
|
-
displayName,
|
|
1900
|
-
trimBefore,
|
|
1901
|
-
trimAfter,
|
|
1902
|
-
playbackRate
|
|
1903
|
-
});
|
|
1904
|
-
useEffect(() => {
|
|
1905
|
-
if (!src) {
|
|
1906
|
-
throw new Error("No src passed");
|
|
1907
|
-
}
|
|
1908
|
-
if (!isStudio && window.process?.env?.NODE_ENV !== "test") {
|
|
1909
|
-
return;
|
|
1910
|
-
}
|
|
1911
|
-
if (!showInTimeline) {
|
|
1912
|
-
return;
|
|
1913
|
-
}
|
|
1914
|
-
registerSequence({
|
|
1915
|
-
type: mediaType,
|
|
1916
|
-
src,
|
|
1917
|
-
id: mediaId,
|
|
1918
|
-
duration,
|
|
1919
|
-
from: 0,
|
|
1920
|
-
parent: parentSequence?.id ?? null,
|
|
1921
|
-
displayName: finalDisplayName,
|
|
1922
|
-
rootId,
|
|
1923
|
-
volume: volumes,
|
|
1924
|
-
showInTimeline: true,
|
|
1925
|
-
nonce: nonce.get(),
|
|
1926
|
-
startMediaFrom: 0 - startsAt + (trimBefore ?? 0),
|
|
1927
|
-
doesVolumeChange,
|
|
1928
|
-
loopDisplay,
|
|
1929
|
-
playbackRate,
|
|
1930
|
-
stack,
|
|
1931
|
-
premountDisplay,
|
|
1932
|
-
postmountDisplay,
|
|
1933
|
-
controls: controls ?? null
|
|
1934
|
-
});
|
|
1935
|
-
return () => {
|
|
1936
|
-
unregisterSequence(mediaId);
|
|
1937
|
-
};
|
|
1938
|
-
}, [
|
|
1939
|
-
controls,
|
|
1940
|
-
doesVolumeChange,
|
|
1941
|
-
duration,
|
|
1942
|
-
finalDisplayName,
|
|
1943
|
-
isStudio,
|
|
1944
|
-
loopDisplay,
|
|
1945
|
-
mediaId,
|
|
1946
|
-
mediaType,
|
|
1947
|
-
nonce,
|
|
1948
|
-
parentSequence?.id,
|
|
1949
|
-
playbackRate,
|
|
1950
|
-
postmountDisplay,
|
|
1951
|
-
premountDisplay,
|
|
1952
|
-
registerSequence,
|
|
1953
|
-
rootId,
|
|
1954
|
-
showInTimeline,
|
|
1955
|
-
src,
|
|
1956
|
-
stack,
|
|
1957
|
-
startsAt,
|
|
1958
|
-
unregisterSequence,
|
|
1959
|
-
volumes,
|
|
1960
|
-
trimBefore
|
|
1961
|
-
]);
|
|
1962
|
-
return {
|
|
1963
|
-
id: mediaId
|
|
1964
|
-
};
|
|
1965
|
-
};
|
|
1966
|
-
|
|
1967
1906
|
// src/audio/audio-for-preview.tsx
|
|
1968
1907
|
import { jsx } from "react/jsx-runtime";
|
|
1969
1908
|
var {
|
|
@@ -1977,7 +1916,7 @@ var {
|
|
|
1977
1916
|
warnAboutTooHighVolume,
|
|
1978
1917
|
usePreload,
|
|
1979
1918
|
SequenceContext
|
|
1980
|
-
} =
|
|
1919
|
+
} = Internals7;
|
|
1981
1920
|
var AudioForPreviewAssertedShowing = ({
|
|
1982
1921
|
src,
|
|
1983
1922
|
playbackRate,
|
|
@@ -1997,23 +1936,22 @@ var AudioForPreviewAssertedShowing = ({
|
|
|
1997
1936
|
fallbackHtml5AudioProps,
|
|
1998
1937
|
onError,
|
|
1999
1938
|
credentials,
|
|
2000
|
-
|
|
1939
|
+
setMediaDurationInSeconds
|
|
2001
1940
|
}) => {
|
|
2002
1941
|
const videoConfig = useUnsafeVideoConfig();
|
|
2003
1942
|
const frame = useCurrentFrame();
|
|
2004
1943
|
const mediaPlayerRef = useRef(null);
|
|
2005
1944
|
const initialTrimBeforeRef = useRef(trimBefore);
|
|
2006
1945
|
const initialTrimAfterRef = useRef(trimAfter);
|
|
2007
|
-
const [mediaPlayerReady, setMediaPlayerReady] =
|
|
2008
|
-
const [shouldFallbackToNativeAudio, setShouldFallbackToNativeAudio] =
|
|
1946
|
+
const [mediaPlayerReady, setMediaPlayerReady] = useState(false);
|
|
1947
|
+
const [shouldFallbackToNativeAudio, setShouldFallbackToNativeAudio] = useState(false);
|
|
2009
1948
|
const [playing] = Timeline.usePlayingState();
|
|
2010
|
-
const timelineContext =
|
|
1949
|
+
const timelineContext = Internals7.useTimelineContext();
|
|
2011
1950
|
const globalPlaybackRate = timelineContext.playbackRate;
|
|
2012
|
-
const sharedAudioContext =
|
|
1951
|
+
const sharedAudioContext = useContext2(SharedAudioContext);
|
|
2013
1952
|
const buffer = useBufferState();
|
|
2014
1953
|
const [mediaMuted] = useMediaMutedState();
|
|
2015
1954
|
const [mediaVolume] = useMediaVolumeState();
|
|
2016
|
-
const [mediaDurationInSeconds, setMediaDurationInSeconds] = useState2(null);
|
|
2017
1955
|
const volumePropFrame = useFrameForVolumeProp(loopVolumeCurveBehavior ?? "repeat");
|
|
2018
1956
|
const userPreferredVolume = evaluateVolume({
|
|
2019
1957
|
frame: volumePropFrame,
|
|
@@ -2031,39 +1969,16 @@ var AudioForPreviewAssertedShowing = ({
|
|
|
2031
1969
|
const currentTimeRef = useRef(currentTime);
|
|
2032
1970
|
currentTimeRef.current = currentTime;
|
|
2033
1971
|
const preloadedSrc = usePreload(src);
|
|
2034
|
-
const parentSequence =
|
|
1972
|
+
const parentSequence = useContext2(SequenceContext);
|
|
2035
1973
|
const isPremounting = Boolean(parentSequence?.premounting);
|
|
2036
1974
|
const isPostmounting = Boolean(parentSequence?.postmounting);
|
|
2037
1975
|
const sequenceOffset = ((parentSequence?.cumulatedFrom ?? 0) + (parentSequence?.relativeFrom ?? 0)) / videoConfig.fps;
|
|
2038
|
-
const
|
|
2039
|
-
loop,
|
|
2040
|
-
mediaDurationInSeconds,
|
|
2041
|
-
playbackRate,
|
|
2042
|
-
trimAfter,
|
|
2043
|
-
trimBefore
|
|
2044
|
-
});
|
|
2045
|
-
useMediaInTimeline({
|
|
2046
|
-
volume,
|
|
2047
|
-
mediaVolume,
|
|
2048
|
-
mediaType: "audio",
|
|
2049
|
-
src,
|
|
2050
|
-
playbackRate,
|
|
2051
|
-
displayName: name ?? null,
|
|
2052
|
-
stack,
|
|
2053
|
-
showInTimeline,
|
|
2054
|
-
premountDisplay: parentSequence?.premountDisplay ?? null,
|
|
2055
|
-
postmountDisplay: parentSequence?.postmountDisplay ?? null,
|
|
2056
|
-
loopDisplay,
|
|
2057
|
-
trimAfter,
|
|
2058
|
-
trimBefore,
|
|
2059
|
-
controls
|
|
2060
|
-
});
|
|
2061
|
-
const bufferingContext = useContext3(Internals8.BufferingContextReact);
|
|
1976
|
+
const bufferingContext = useContext2(Internals7.BufferingContextReact);
|
|
2062
1977
|
if (!bufferingContext) {
|
|
2063
1978
|
throw new Error("useMediaPlayback must be used inside a <BufferingContext>");
|
|
2064
1979
|
}
|
|
2065
1980
|
const effectiveMuted = muted || mediaMuted || userPreferredVolume <= 0;
|
|
2066
|
-
const isPlayerBuffering =
|
|
1981
|
+
const isPlayerBuffering = Internals7.useIsPlayerBuffering(bufferingContext);
|
|
2067
1982
|
const initialPlaying = useRef(playing && !isPlayerBuffering);
|
|
2068
1983
|
const initialIsPremounting = useRef(isPremounting);
|
|
2069
1984
|
const initialIsPostmounting = useRef(isPostmounting);
|
|
@@ -2095,7 +2010,7 @@ var AudioForPreviewAssertedShowing = ({
|
|
|
2095
2010
|
logLevel,
|
|
2096
2011
|
label: "AudioForPreview"
|
|
2097
2012
|
});
|
|
2098
|
-
|
|
2013
|
+
useEffect(() => {
|
|
2099
2014
|
if (!sharedAudioContext)
|
|
2100
2015
|
return;
|
|
2101
2016
|
if (!sharedAudioContext.audioContext)
|
|
@@ -2138,7 +2053,10 @@ var AudioForPreviewAssertedShowing = ({
|
|
|
2138
2053
|
playing: initialPlaying.current,
|
|
2139
2054
|
sequenceOffset: initialSequenceOffset.current,
|
|
2140
2055
|
credentials,
|
|
2141
|
-
tagType: "audio"
|
|
2056
|
+
tagType: "audio",
|
|
2057
|
+
getEffects: () => [],
|
|
2058
|
+
getEffectChainState: () => null,
|
|
2059
|
+
getCurrentFrame: () => 0
|
|
2142
2060
|
});
|
|
2143
2061
|
mediaPlayerRef.current = player;
|
|
2144
2062
|
player.initialize(currentTimeRef.current, initialMuted.current).then((result) => {
|
|
@@ -2156,7 +2074,7 @@ var AudioForPreviewAssertedShowing = ({
|
|
|
2156
2074
|
if (action === "fail") {
|
|
2157
2075
|
throw errorToUse;
|
|
2158
2076
|
} else {
|
|
2159
|
-
|
|
2077
|
+
Internals7.Log.warn({ logLevel, tag: "@remotion/media" }, fallbackMessage);
|
|
2160
2078
|
setShouldFallbackToNativeAudio(true);
|
|
2161
2079
|
}
|
|
2162
2080
|
};
|
|
@@ -2179,7 +2097,7 @@ var AudioForPreviewAssertedShowing = ({
|
|
|
2179
2097
|
if (result.type === "success") {
|
|
2180
2098
|
setMediaPlayerReady(true);
|
|
2181
2099
|
setMediaDurationInSeconds(result.durationInSeconds);
|
|
2182
|
-
|
|
2100
|
+
Internals7.Log.trace({ logLevel, tag: "@remotion/media" }, `[AudioForPreview] MediaPlayer initialized successfully`);
|
|
2183
2101
|
}
|
|
2184
2102
|
}).catch((error) => {
|
|
2185
2103
|
const [action, errorToUse] = callOnErrorAndResolve({
|
|
@@ -2192,7 +2110,7 @@ var AudioForPreviewAssertedShowing = ({
|
|
|
2192
2110
|
if (action === "fail") {
|
|
2193
2111
|
throw errorToUse;
|
|
2194
2112
|
} else {
|
|
2195
|
-
|
|
2113
|
+
Internals7.Log.error({ logLevel, tag: "@remotion/media" }, "[AudioForPreview] Failed to initialize MediaPlayer", error);
|
|
2196
2114
|
setShouldFallbackToNativeAudio(true);
|
|
2197
2115
|
}
|
|
2198
2116
|
});
|
|
@@ -2207,12 +2125,12 @@ var AudioForPreviewAssertedShowing = ({
|
|
|
2207
2125
|
if (action === "fail") {
|
|
2208
2126
|
throw errorToUse;
|
|
2209
2127
|
}
|
|
2210
|
-
|
|
2128
|
+
Internals7.Log.error({ logLevel, tag: "@remotion/media" }, "[AudioForPreview] MediaPlayer initialization failed", errorToUse);
|
|
2211
2129
|
setShouldFallbackToNativeAudio(true);
|
|
2212
2130
|
}
|
|
2213
2131
|
return () => {
|
|
2214
2132
|
if (mediaPlayerRef.current) {
|
|
2215
|
-
|
|
2133
|
+
Internals7.Log.trace({ logLevel, tag: "@remotion/media" }, `[AudioForPreview] Disposing MediaPlayer`);
|
|
2216
2134
|
mediaPlayerRef.current.dispose();
|
|
2217
2135
|
mediaPlayerRef.current = null;
|
|
2218
2136
|
}
|
|
@@ -2229,7 +2147,8 @@ var AudioForPreviewAssertedShowing = ({
|
|
|
2229
2147
|
disallowFallbackToHtml5Audio,
|
|
2230
2148
|
buffer,
|
|
2231
2149
|
onError,
|
|
2232
|
-
credentials
|
|
2150
|
+
credentials,
|
|
2151
|
+
setMediaDurationInSeconds
|
|
2233
2152
|
]);
|
|
2234
2153
|
if (shouldFallbackToNativeAudio && !disallowFallbackToHtml5Audio) {
|
|
2235
2154
|
return /* @__PURE__ */ jsx(RemotionAudio, {
|
|
@@ -2272,14 +2191,14 @@ var AudioForPreview = ({
|
|
|
2272
2191
|
fallbackHtml5AudioProps,
|
|
2273
2192
|
onError,
|
|
2274
2193
|
credentials,
|
|
2275
|
-
|
|
2194
|
+
setMediaDurationInSeconds
|
|
2276
2195
|
}) => {
|
|
2277
2196
|
const preloadedSrc = usePreload(src);
|
|
2278
|
-
const defaultLogLevel =
|
|
2197
|
+
const defaultLogLevel = Internals7.useLogLevel();
|
|
2279
2198
|
const frame = useCurrentFrame();
|
|
2280
|
-
const videoConfig =
|
|
2199
|
+
const videoConfig = useVideoConfig();
|
|
2281
2200
|
const currentTime = frame / videoConfig.fps;
|
|
2282
|
-
const showShow =
|
|
2201
|
+
const showShow = useMemo(() => {
|
|
2283
2202
|
return getTimeInSeconds({
|
|
2284
2203
|
unloopedTimeInSeconds: currentTime,
|
|
2285
2204
|
playbackRate,
|
|
@@ -2303,6 +2222,9 @@ var AudioForPreview = ({
|
|
|
2303
2222
|
if (!showShow) {
|
|
2304
2223
|
return null;
|
|
2305
2224
|
}
|
|
2225
|
+
if (!setMediaDurationInSeconds) {
|
|
2226
|
+
throw new Error("setMediaDurationInSeconds is required");
|
|
2227
|
+
}
|
|
2306
2228
|
return /* @__PURE__ */ jsx(AudioForPreviewAssertedShowing, {
|
|
2307
2229
|
audioStreamIndex,
|
|
2308
2230
|
src: preloadedSrc,
|
|
@@ -2322,16 +2244,16 @@ var AudioForPreview = ({
|
|
|
2322
2244
|
onError,
|
|
2323
2245
|
credentials,
|
|
2324
2246
|
fallbackHtml5AudioProps,
|
|
2325
|
-
|
|
2247
|
+
setMediaDurationInSeconds
|
|
2326
2248
|
});
|
|
2327
2249
|
};
|
|
2328
2250
|
|
|
2329
2251
|
// src/audio/audio-for-rendering.tsx
|
|
2330
|
-
import { useContext as
|
|
2252
|
+
import { useContext as useContext3, useLayoutEffect as useLayoutEffect2, useMemo as useMemo2, useState as useState2 } from "react";
|
|
2331
2253
|
import {
|
|
2332
2254
|
cancelRender as cancelRender2,
|
|
2333
2255
|
Html5Audio,
|
|
2334
|
-
Internals as
|
|
2256
|
+
Internals as Internals15,
|
|
2335
2257
|
random,
|
|
2336
2258
|
useCurrentFrame as useCurrentFrame2,
|
|
2337
2259
|
useDelayRender,
|
|
@@ -2340,13 +2262,13 @@ import {
|
|
|
2340
2262
|
|
|
2341
2263
|
// src/caches.ts
|
|
2342
2264
|
import React2 from "react";
|
|
2343
|
-
import { cancelRender, Internals as
|
|
2265
|
+
import { cancelRender, Internals as Internals12 } from "remotion";
|
|
2344
2266
|
|
|
2345
2267
|
// src/audio-extraction/audio-manager.ts
|
|
2346
|
-
import { Internals as
|
|
2268
|
+
import { Internals as Internals9 } from "remotion";
|
|
2347
2269
|
|
|
2348
2270
|
// src/audio-extraction/audio-iterator.ts
|
|
2349
|
-
import { Internals as
|
|
2271
|
+
import { Internals as Internals8 } from "remotion";
|
|
2350
2272
|
|
|
2351
2273
|
// src/audio-extraction/audio-cache.ts
|
|
2352
2274
|
var makeAudioCache = () => {
|
|
@@ -2425,7 +2347,7 @@ var warnAboutMatroskaOnce = (src, logLevel) => {
|
|
|
2425
2347
|
return;
|
|
2426
2348
|
}
|
|
2427
2349
|
warned[src] = true;
|
|
2428
|
-
|
|
2350
|
+
Internals8.Log.warn({ logLevel, tag: "@remotion/media" }, `Audio from ${src} will need to be read from the beginning. https://www.remotion.dev/docs/media/support#matroska-limitation`);
|
|
2429
2351
|
};
|
|
2430
2352
|
var makeAudioIterator2 = ({
|
|
2431
2353
|
audioSampleSink,
|
|
@@ -2493,7 +2415,7 @@ var makeAudioIterator2 = ({
|
|
|
2493
2415
|
if (openTimestamps.length > 0) {
|
|
2494
2416
|
const first = openTimestamps[0];
|
|
2495
2417
|
const last = openTimestamps[openTimestamps.length - 1];
|
|
2496
|
-
|
|
2418
|
+
Internals8.Log.verbose({ logLevel, tag: "@remotion/media" }, "Open audio samples for src", src, `${first.toFixed(3)}...${last.toFixed(3)}`);
|
|
2497
2419
|
}
|
|
2498
2420
|
};
|
|
2499
2421
|
const getCacheStats = () => {
|
|
@@ -2590,7 +2512,7 @@ var makeAudioManager = () => {
|
|
|
2590
2512
|
if (seenKeys.has(key)) {
|
|
2591
2513
|
iterator.prepareForDeletion();
|
|
2592
2514
|
iterators.splice(iterators.indexOf(iterator), 1);
|
|
2593
|
-
|
|
2515
|
+
Internals9.Log.verbose({ logLevel, tag: "@remotion/media" }, `Deleted duplicate iterator for ${iterator.src}`);
|
|
2594
2516
|
}
|
|
2595
2517
|
seenKeys.add(key);
|
|
2596
2518
|
}
|
|
@@ -2611,7 +2533,7 @@ var makeAudioManager = () => {
|
|
|
2611
2533
|
attempts++;
|
|
2612
2534
|
}
|
|
2613
2535
|
if ((await getTotalCacheStats()).totalSize > maxCacheSize && attempts >= maxAttempts) {
|
|
2614
|
-
|
|
2536
|
+
Internals9.Log.warn({ logLevel, tag: "@remotion/media" }, `Audio cache: Exceeded max cache size after ${maxAttempts} attempts. Still ${(await getTotalCacheStats()).totalSize} bytes used, target was ${maxCacheSize} bytes.`);
|
|
2615
2537
|
}
|
|
2616
2538
|
for (const iterator of iterators) {
|
|
2617
2539
|
if (iterator.src === src && await iterator.waitForCompletion() && iterator.canSatisfyRequestedTime(timeInSeconds)) {
|
|
@@ -2680,7 +2602,7 @@ var makeAudioManager = () => {
|
|
|
2680
2602
|
};
|
|
2681
2603
|
|
|
2682
2604
|
// src/video-extraction/keyframe-manager.ts
|
|
2683
|
-
import { Internals as
|
|
2605
|
+
import { Internals as Internals11 } from "remotion";
|
|
2684
2606
|
|
|
2685
2607
|
// src/render-timestamp-range.ts
|
|
2686
2608
|
var renderTimestampRange = (timestamps) => {
|
|
@@ -2694,7 +2616,7 @@ var renderTimestampRange = (timestamps) => {
|
|
|
2694
2616
|
};
|
|
2695
2617
|
|
|
2696
2618
|
// src/video-extraction/keyframe-bank.ts
|
|
2697
|
-
import { Internals as
|
|
2619
|
+
import { Internals as Internals10 } from "remotion";
|
|
2698
2620
|
|
|
2699
2621
|
// src/video-extraction/get-allocation-size.ts
|
|
2700
2622
|
var getAllocationSize = (sample) => {
|
|
@@ -2757,7 +2679,7 @@ var makeKeyframeBank = async ({
|
|
|
2757
2679
|
}
|
|
2758
2680
|
}
|
|
2759
2681
|
if (deletedTimestamps.length > 0) {
|
|
2760
|
-
|
|
2682
|
+
Internals10.Log.verbose({ logLevel, tag: "@remotion/media" }, `Deleted ${deletedTimestamps.length} frame${deletedTimestamps.length === 1 ? "" : "s"} ${renderTimestampRange(deletedTimestamps)} for src ${src} because it is lower than ${timestampInSeconds}. Remaining: ${renderTimestampRange(frameTimestamps)}`);
|
|
2761
2683
|
}
|
|
2762
2684
|
};
|
|
2763
2685
|
const hasDecodedEnoughForTimestamp = (timestamp) => {
|
|
@@ -2780,7 +2702,7 @@ var makeKeyframeBank = async ({
|
|
|
2780
2702
|
frameTimestamps.push(frame.timestamp);
|
|
2781
2703
|
allocationSize += getAllocationSize(frame);
|
|
2782
2704
|
lastUsed = Date.now();
|
|
2783
|
-
|
|
2705
|
+
Internals10.Log.trace({ logLevel, tag: "@remotion/media" }, `Added frame at ${frame.timestamp}sec to bank`);
|
|
2784
2706
|
};
|
|
2785
2707
|
const ensureEnoughFramesForTimestamp = async (timestampInSeconds, logLevel, fps) => {
|
|
2786
2708
|
while (!hasDecodedEnoughForTimestamp(timestampInSeconds)) {
|
|
@@ -2835,7 +2757,7 @@ var makeKeyframeBank = async ({
|
|
|
2835
2757
|
throw new Error("No first frame found");
|
|
2836
2758
|
}
|
|
2837
2759
|
const startTimestampInSeconds = firstFrame.value.timestamp;
|
|
2838
|
-
|
|
2760
|
+
Internals10.Log.verbose({ logLevel: parentLogLevel, tag: "@remotion/media" }, `Creating keyframe bank from ${startTimestampInSeconds}sec`);
|
|
2839
2761
|
addFrame(firstFrame.value, parentLogLevel);
|
|
2840
2762
|
const getRangeOfTimestamps = () => {
|
|
2841
2763
|
if (frameTimestamps.length === 0) {
|
|
@@ -2853,7 +2775,7 @@ var makeKeyframeBank = async ({
|
|
|
2853
2775
|
const prepareForDeletion = (logLevel, reason) => {
|
|
2854
2776
|
const range = getRangeOfTimestamps();
|
|
2855
2777
|
if (range) {
|
|
2856
|
-
|
|
2778
|
+
Internals10.Log.verbose({ logLevel, tag: "@remotion/media" }, `Preparing for deletion (${reason}) of keyframe bank from ${range?.firstTimestamp}sec to ${range?.lastTimestamp}sec`);
|
|
2857
2779
|
}
|
|
2858
2780
|
let framesDeleted = 0;
|
|
2859
2781
|
for (const frameTimestamp of frameTimestamps.slice()) {
|
|
@@ -2926,10 +2848,10 @@ var makeKeyframeManager = () => {
|
|
|
2926
2848
|
if (size === 0) {
|
|
2927
2849
|
continue;
|
|
2928
2850
|
}
|
|
2929
|
-
|
|
2851
|
+
Internals11.Log.verbose({ logLevel, tag: "@remotion/media" }, `Open frames for src ${src}: ${renderTimestampRange(timestamps)}`);
|
|
2930
2852
|
}
|
|
2931
2853
|
}
|
|
2932
|
-
|
|
2854
|
+
Internals11.Log.verbose({ logLevel, tag: "@remotion/media" }, `Video cache stats: ${count} open frames, ${totalSize} bytes`);
|
|
2933
2855
|
};
|
|
2934
2856
|
const getCacheStats = () => {
|
|
2935
2857
|
let count = 0;
|
|
@@ -2983,7 +2905,7 @@ var makeKeyframeManager = () => {
|
|
|
2983
2905
|
const { framesDeleted } = mostInThePastBank.prepareForDeletion(logLevel, "deleted oldest keyframe bank to stay under max cache size");
|
|
2984
2906
|
sources[mostInThePastSrc].splice(mostInThePastIndex, 1);
|
|
2985
2907
|
if (range) {
|
|
2986
|
-
|
|
2908
|
+
Internals11.Log.verbose({ logLevel, tag: "@remotion/media" }, `Deleted ${framesDeleted} frames for src ${mostInThePastSrc} from ${range?.firstTimestamp}sec to ${range?.lastTimestamp}sec to free up memory.`);
|
|
2987
2909
|
}
|
|
2988
2910
|
}
|
|
2989
2911
|
return { finish: false };
|
|
@@ -2997,12 +2919,12 @@ var makeKeyframeManager = () => {
|
|
|
2997
2919
|
if (finish) {
|
|
2998
2920
|
break;
|
|
2999
2921
|
}
|
|
3000
|
-
|
|
2922
|
+
Internals11.Log.verbose({ logLevel, tag: "@remotion/media" }, "Deleted oldest keyframe bank to stay under max cache size", (cacheStats.totalSize / 1024 / 1024).toFixed(1), "out of", (maxCacheSize / 1024 / 1024).toFixed(1));
|
|
3001
2923
|
cacheStats = getTotalCacheStats();
|
|
3002
2924
|
attempts++;
|
|
3003
2925
|
}
|
|
3004
2926
|
if (cacheStats.totalSize > maxCacheSize && attempts >= maxAttempts) {
|
|
3005
|
-
|
|
2927
|
+
Internals11.Log.warn({ logLevel, tag: "@remotion/media" }, `Exceeded max cache size after ${maxAttempts} attempts. Remaining cache size: ${(cacheStats.totalSize / 1024 / 1024).toFixed(1)} MB, target was ${(maxCacheSize / 1024 / 1024).toFixed(1)} MB.`);
|
|
3006
2928
|
}
|
|
3007
2929
|
};
|
|
3008
2930
|
const clearKeyframeBanksBeforeTime = ({
|
|
@@ -3023,7 +2945,7 @@ var makeKeyframeManager = () => {
|
|
|
3023
2945
|
}
|
|
3024
2946
|
if (range.lastTimestamp < threshold) {
|
|
3025
2947
|
bank.prepareForDeletion(logLevel, "cleared before threshold " + threshold);
|
|
3026
|
-
|
|
2948
|
+
Internals11.Log.verbose({ logLevel, tag: "@remotion/media" }, `[Video] Cleared frames for src ${src} from ${range.firstTimestamp}sec to ${range.lastTimestamp}sec`);
|
|
3027
2949
|
const bankIndex = banks.indexOf(bank);
|
|
3028
2950
|
delete sources[src][bankIndex];
|
|
3029
2951
|
} else {
|
|
@@ -3045,7 +2967,7 @@ var makeKeyframeManager = () => {
|
|
|
3045
2967
|
const existingBanks = sources[src] ?? [];
|
|
3046
2968
|
const existingBank = existingBanks?.find((bank) => bank.canSatisfyTimestamp(timestamp));
|
|
3047
2969
|
if (!existingBank) {
|
|
3048
|
-
|
|
2970
|
+
Internals11.Log.trace({ logLevel, tag: "@remotion/media" }, `Creating new keyframe bank for src ${src} at timestamp ${timestamp}`);
|
|
3049
2971
|
const newKeyframeBank = await makeKeyframeBank({
|
|
3050
2972
|
videoSampleSink,
|
|
3051
2973
|
logLevel,
|
|
@@ -3056,10 +2978,10 @@ var makeKeyframeManager = () => {
|
|
|
3056
2978
|
return newKeyframeBank;
|
|
3057
2979
|
}
|
|
3058
2980
|
if (existingBank.canSatisfyTimestamp(timestamp)) {
|
|
3059
|
-
|
|
2981
|
+
Internals11.Log.trace({ logLevel, tag: "@remotion/media" }, `Keyframe bank exists and satisfies timestamp ${timestamp}`);
|
|
3060
2982
|
return existingBank;
|
|
3061
2983
|
}
|
|
3062
|
-
|
|
2984
|
+
Internals11.Log.verbose({ logLevel, tag: "@remotion/media" }, `Keyframe bank exists but frame at time ${timestamp} does not exist anymore.`);
|
|
3063
2985
|
existingBank.prepareForDeletion(logLevel, "already existed but evicted");
|
|
3064
2986
|
sources[src] = sources[src].filter((bank) => bank !== existingBank);
|
|
3065
2987
|
const replacementKeybank = await makeKeyframeBank({
|
|
@@ -3150,20 +3072,20 @@ var getUncachedMaxCacheSize = (logLevel) => {
|
|
|
3150
3072
|
if (window.remotion_mediaCacheSizeInBytes > 20000 * 1024 * 1024) {
|
|
3151
3073
|
cancelRender(new Error(`The maximum value for the "mediaCacheSizeInBytes" prop is 20GB (${20000 * 1024 * 1024}), got: ${window.remotion_mediaCacheSizeInBytes}`));
|
|
3152
3074
|
}
|
|
3153
|
-
|
|
3075
|
+
Internals12.Log.verbose({ logLevel, tag: "@remotion/media" }, `Using cache size set using "mediaCacheSizeInBytes": ${(window.remotion_mediaCacheSizeInBytes / 1024 / 1024).toFixed(1)} MB`);
|
|
3154
3076
|
return window.remotion_mediaCacheSizeInBytes;
|
|
3155
3077
|
}
|
|
3156
3078
|
if (typeof window !== "undefined" && window.remotion_initialMemoryAvailable !== undefined && window.remotion_initialMemoryAvailable !== null) {
|
|
3157
3079
|
const value = window.remotion_initialMemoryAvailable / 2;
|
|
3158
3080
|
if (value < 500 * 1024 * 1024) {
|
|
3159
|
-
|
|
3081
|
+
Internals12.Log.verbose({ logLevel, tag: "@remotion/media" }, `Using cache size set based on minimum value of 500MB (which is more than half of the available system memory!)`);
|
|
3160
3082
|
return 500 * 1024 * 1024;
|
|
3161
3083
|
}
|
|
3162
3084
|
if (value > 20000 * 1024 * 1024) {
|
|
3163
|
-
|
|
3085
|
+
Internals12.Log.verbose({ logLevel, tag: "@remotion/media" }, `Using cache size set based on maximum value of 20GB (which is less than half of the available system memory)`);
|
|
3164
3086
|
return 20000 * 1024 * 1024;
|
|
3165
3087
|
}
|
|
3166
|
-
|
|
3088
|
+
Internals12.Log.verbose({ logLevel, tag: "@remotion/media" }, `Using cache size set based on available memory (50% of available memory): ${(value / 1024 / 1024).toFixed(1)} MB`);
|
|
3167
3089
|
return value;
|
|
3168
3090
|
}
|
|
3169
3091
|
return 1000 * 1000 * 1000;
|
|
@@ -3177,7 +3099,7 @@ var getMaxVideoCacheSize = (logLevel) => {
|
|
|
3177
3099
|
return cachedMaxCacheSize;
|
|
3178
3100
|
};
|
|
3179
3101
|
var useMaxMediaCacheSize = (logLevel) => {
|
|
3180
|
-
const context = React2.useContext(
|
|
3102
|
+
const context = React2.useContext(Internals12.MaxMediaCacheSizeContext);
|
|
3181
3103
|
if (context === null) {
|
|
3182
3104
|
return getMaxVideoCacheSize(logLevel);
|
|
3183
3105
|
}
|
|
@@ -3431,7 +3353,7 @@ var combineAudioDataAndClosePrevious = (audioDataArray) => {
|
|
|
3431
3353
|
};
|
|
3432
3354
|
|
|
3433
3355
|
// src/get-sink.ts
|
|
3434
|
-
import { Internals as
|
|
3356
|
+
import { Internals as Internals13 } from "remotion";
|
|
3435
3357
|
|
|
3436
3358
|
// src/video-extraction/get-frames-since-keyframe.ts
|
|
3437
3359
|
import {
|
|
@@ -3555,8 +3477,15 @@ var getSinks = async (src, credentials) => {
|
|
|
3555
3477
|
if (format === "network-error") {
|
|
3556
3478
|
return "network-error";
|
|
3557
3479
|
}
|
|
3558
|
-
const videoTrack = await
|
|
3559
|
-
|
|
3480
|
+
const [videoTrack, audioTracks] = await Promise.all([
|
|
3481
|
+
input.getPrimaryVideoTrack(),
|
|
3482
|
+
input.getAudioTracks()
|
|
3483
|
+
]);
|
|
3484
|
+
const audioTrack = await resolveAudioTrack({
|
|
3485
|
+
videoTrack,
|
|
3486
|
+
audioTracks,
|
|
3487
|
+
audioStreamIndex: index
|
|
3488
|
+
});
|
|
3560
3489
|
if (!audioTrack) {
|
|
3561
3490
|
return "no-audio-track";
|
|
3562
3491
|
}
|
|
@@ -3593,7 +3522,7 @@ var getSink = (src, logLevel, credentials) => {
|
|
|
3593
3522
|
const cacheKey = credentials ? `${src}::${credentials}` : src;
|
|
3594
3523
|
let promise = sinkPromises[cacheKey];
|
|
3595
3524
|
if (!promise) {
|
|
3596
|
-
|
|
3525
|
+
Internals13.Log.verbose({
|
|
3597
3526
|
logLevel,
|
|
3598
3527
|
tag: "@remotion/media"
|
|
3599
3528
|
}, `Sink for ${src} was not found, creating new sink`);
|
|
@@ -3734,7 +3663,7 @@ var extractAudio = (params) => {
|
|
|
3734
3663
|
};
|
|
3735
3664
|
|
|
3736
3665
|
// src/video-extraction/extract-frame.ts
|
|
3737
|
-
import { Internals as
|
|
3666
|
+
import { Internals as Internals14 } from "remotion";
|
|
3738
3667
|
var extractFrameInternal = async ({
|
|
3739
3668
|
src,
|
|
3740
3669
|
timeInSeconds: unloopedTimeInSeconds,
|
|
@@ -3816,7 +3745,7 @@ var extractFrameInternal = async ({
|
|
|
3816
3745
|
durationInSeconds: await sink.getDuration()
|
|
3817
3746
|
};
|
|
3818
3747
|
} catch (err) {
|
|
3819
|
-
|
|
3748
|
+
Internals14.Log.info({ logLevel, tag: "@remotion/media" }, `Error decoding ${src} at time ${timeInSeconds}: ${err}`, err);
|
|
3820
3749
|
return { type: "cannot-decode", durationInSeconds: mediaDurationInSeconds };
|
|
3821
3750
|
}
|
|
3822
3751
|
};
|
|
@@ -4220,13 +4149,13 @@ var AudioForRendering = ({
|
|
|
4220
4149
|
onError,
|
|
4221
4150
|
credentials
|
|
4222
4151
|
}) => {
|
|
4223
|
-
const defaultLogLevel =
|
|
4152
|
+
const defaultLogLevel = Internals15.useLogLevel();
|
|
4224
4153
|
const logLevel = overriddenLogLevel ?? defaultLogLevel;
|
|
4225
4154
|
const frame = useCurrentFrame2();
|
|
4226
|
-
const absoluteFrame =
|
|
4227
|
-
const videoConfig =
|
|
4228
|
-
const { registerRenderAsset, unregisterRenderAsset } =
|
|
4229
|
-
const startsAt =
|
|
4155
|
+
const absoluteFrame = Internals15.useTimelinePosition();
|
|
4156
|
+
const videoConfig = Internals15.useUnsafeVideoConfig();
|
|
4157
|
+
const { registerRenderAsset, unregisterRenderAsset } = useContext3(Internals15.RenderAssetManager);
|
|
4158
|
+
const startsAt = Internals15.useMediaStartsAt();
|
|
4230
4159
|
const environment = useRemotionEnvironment();
|
|
4231
4160
|
if (!videoConfig) {
|
|
4232
4161
|
throw new Error("No video config found");
|
|
@@ -4236,16 +4165,16 @@ var AudioForRendering = ({
|
|
|
4236
4165
|
}
|
|
4237
4166
|
const { fps } = videoConfig;
|
|
4238
4167
|
const { delayRender, continueRender } = useDelayRender();
|
|
4239
|
-
const [replaceWithHtml5Audio, setReplaceWithHtml5Audio] =
|
|
4240
|
-
const sequenceContext =
|
|
4241
|
-
const id =
|
|
4168
|
+
const [replaceWithHtml5Audio, setReplaceWithHtml5Audio] = useState2(false);
|
|
4169
|
+
const sequenceContext = useContext3(Internals15.SequenceContext);
|
|
4170
|
+
const id = useMemo2(() => `media-audio-${random(src)}-${sequenceContext?.cumulatedFrom}-${sequenceContext?.relativeFrom}-${sequenceContext?.durationInFrames}`, [
|
|
4242
4171
|
src,
|
|
4243
4172
|
sequenceContext?.cumulatedFrom,
|
|
4244
4173
|
sequenceContext?.relativeFrom,
|
|
4245
4174
|
sequenceContext?.durationInFrames
|
|
4246
4175
|
]);
|
|
4247
4176
|
const maxCacheSize = useMaxMediaCacheSize(logLevel);
|
|
4248
|
-
const audioEnabled =
|
|
4177
|
+
const audioEnabled = Internals15.useAudioEnabled();
|
|
4249
4178
|
useLayoutEffect2(() => {
|
|
4250
4179
|
const timestamp = frame / fps;
|
|
4251
4180
|
const durationInSeconds = 1 / fps;
|
|
@@ -4296,7 +4225,7 @@ var AudioForRendering = ({
|
|
|
4296
4225
|
if (action === "fail") {
|
|
4297
4226
|
cancelRender2(errorToUse);
|
|
4298
4227
|
}
|
|
4299
|
-
|
|
4228
|
+
Internals15.Log.warn({ logLevel, tag: "@remotion/media" }, fallbackMessage);
|
|
4300
4229
|
setReplaceWithHtml5Audio(true);
|
|
4301
4230
|
};
|
|
4302
4231
|
if (result.type === "unknown-container-format") {
|
|
@@ -4323,12 +4252,12 @@ var AudioForRendering = ({
|
|
|
4323
4252
|
frame,
|
|
4324
4253
|
startsAt
|
|
4325
4254
|
});
|
|
4326
|
-
const volume =
|
|
4255
|
+
const volume = Internals15.evaluateVolume({
|
|
4327
4256
|
volume: volumeProp,
|
|
4328
4257
|
frame: volumePropsFrame,
|
|
4329
4258
|
mediaVolume: 1
|
|
4330
4259
|
});
|
|
4331
|
-
|
|
4260
|
+
Internals15.warnAboutTooHighVolume(volume);
|
|
4332
4261
|
if (audio && volume > 0) {
|
|
4333
4262
|
applyVolume(audio.data, volume);
|
|
4334
4263
|
registerRenderAsset({
|
|
@@ -4405,7 +4334,7 @@ var AudioForRendering = ({
|
|
|
4405
4334
|
|
|
4406
4335
|
// src/audio/audio.tsx
|
|
4407
4336
|
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
4408
|
-
var { validateMediaProps } =
|
|
4337
|
+
var { validateMediaProps } = Internals16;
|
|
4409
4338
|
var audioSchema = {
|
|
4410
4339
|
volume: {
|
|
4411
4340
|
type: "number",
|
|
@@ -4429,41 +4358,92 @@ var AudioInner = (props) => {
|
|
|
4429
4358
|
name,
|
|
4430
4359
|
stack,
|
|
4431
4360
|
showInTimeline,
|
|
4432
|
-
controls,
|
|
4361
|
+
_experimentalControls: controls,
|
|
4433
4362
|
from,
|
|
4434
4363
|
durationInFrames,
|
|
4435
4364
|
...otherProps
|
|
4436
4365
|
} = props;
|
|
4437
4366
|
const environment = useRemotionEnvironment2();
|
|
4367
|
+
const [mediaVolume] = Internals16.useMediaVolumeState();
|
|
4368
|
+
const mediaStartsAt = Internals16.useMediaStartsAt();
|
|
4369
|
+
const videoConfig = useVideoConfig2();
|
|
4370
|
+
const sequenceDurationInFrames = Math.min(durationInFrames ?? Infinity, Math.max(0, videoConfig.durationInFrames - (from ?? 0)));
|
|
4371
|
+
const basicInfo = Internals16.useBasicMediaInTimeline({
|
|
4372
|
+
src: props.src,
|
|
4373
|
+
volume: props.volume,
|
|
4374
|
+
playbackRate: props.playbackRate ?? 1,
|
|
4375
|
+
trimBefore: props.trimBefore,
|
|
4376
|
+
trimAfter: props.trimAfter,
|
|
4377
|
+
sequenceDurationInFrames,
|
|
4378
|
+
mediaType: "audio",
|
|
4379
|
+
displayName: name ?? "<Audio>",
|
|
4380
|
+
mediaVolume,
|
|
4381
|
+
mediaStartsAt,
|
|
4382
|
+
loop: props.loop ?? false
|
|
4383
|
+
});
|
|
4384
|
+
const [mediaDurationInSeconds, setMediaDurationInSeconds] = useState3(null);
|
|
4385
|
+
const loopDisplay = useMemo3(() => getLoopDisplay({
|
|
4386
|
+
loop: props.loop ?? false,
|
|
4387
|
+
mediaDurationInSeconds,
|
|
4388
|
+
playbackRate: props.playbackRate ?? 1,
|
|
4389
|
+
trimAfter: props.trimAfter,
|
|
4390
|
+
trimBefore: props.trimBefore,
|
|
4391
|
+
sequenceDurationInFrames,
|
|
4392
|
+
compFps: videoConfig.fps
|
|
4393
|
+
}), [
|
|
4394
|
+
props.loop,
|
|
4395
|
+
mediaDurationInSeconds,
|
|
4396
|
+
props.playbackRate,
|
|
4397
|
+
props.trimAfter,
|
|
4398
|
+
props.trimBefore,
|
|
4399
|
+
sequenceDurationInFrames,
|
|
4400
|
+
videoConfig.fps
|
|
4401
|
+
]);
|
|
4402
|
+
const isMedia = useMemo3(() => ({
|
|
4403
|
+
type: "audio",
|
|
4404
|
+
data: basicInfo
|
|
4405
|
+
}), [basicInfo]);
|
|
4438
4406
|
if (typeof props.src !== "string") {
|
|
4439
4407
|
throw new TypeError(`The \`<Audio>\` tag requires a string for \`src\`, but got ${JSON.stringify(props.src)} instead.`);
|
|
4440
4408
|
}
|
|
4441
4409
|
validateMediaProps({ playbackRate: props.playbackRate, volume: props.volume }, "Audio");
|
|
4410
|
+
if (sequenceDurationInFrames === 0) {
|
|
4411
|
+
return null;
|
|
4412
|
+
}
|
|
4442
4413
|
return /* @__PURE__ */ jsx3(Sequence, {
|
|
4443
4414
|
layout: "none",
|
|
4444
4415
|
from: from ?? 0,
|
|
4445
|
-
durationInFrames:
|
|
4446
|
-
|
|
4416
|
+
durationInFrames: basicInfo.duration,
|
|
4417
|
+
_remotionInternalStack: stack,
|
|
4418
|
+
_remotionInternalIsMedia: isMedia,
|
|
4419
|
+
name: name ?? "<Audio>",
|
|
4420
|
+
_experimentalControls: controls,
|
|
4421
|
+
_remotionInternalLoopDisplay: loopDisplay,
|
|
4422
|
+
showInTimeline: showInTimeline ?? true,
|
|
4447
4423
|
children: environment.isRendering ? /* @__PURE__ */ jsx3(AudioForRendering, {
|
|
4448
4424
|
...otherProps
|
|
4449
4425
|
}) : /* @__PURE__ */ jsx3(AudioForPreview, {
|
|
4450
4426
|
name,
|
|
4451
4427
|
...otherProps,
|
|
4452
4428
|
stack: stack ?? null,
|
|
4453
|
-
|
|
4429
|
+
setMediaDurationInSeconds
|
|
4454
4430
|
})
|
|
4455
4431
|
});
|
|
4456
4432
|
};
|
|
4457
|
-
var Audio =
|
|
4458
|
-
|
|
4433
|
+
var Audio = Internals16.wrapInSchema(AudioInner, audioSchema);
|
|
4434
|
+
Internals16.addSequenceStackTraces(Audio);
|
|
4459
4435
|
|
|
4460
4436
|
// src/video/video.tsx
|
|
4461
|
-
import {
|
|
4437
|
+
import { useMemo as useMemo6, useState as useState6 } from "react";
|
|
4438
|
+
import {
|
|
4439
|
+
useVideoConfig as useVideoConfig5
|
|
4440
|
+
} from "remotion";
|
|
4441
|
+
import { Internals as Internals20, Sequence as Sequence2, useRemotionEnvironment as useRemotionEnvironment4 } from "remotion";
|
|
4462
4442
|
|
|
4463
4443
|
// src/video/video-for-preview.tsx
|
|
4464
4444
|
import {
|
|
4465
|
-
useContext as
|
|
4466
|
-
useEffect as
|
|
4445
|
+
useContext as useContext4,
|
|
4446
|
+
useEffect as useEffect2,
|
|
4467
4447
|
useLayoutEffect as useLayoutEffect3,
|
|
4468
4448
|
useMemo as useMemo4,
|
|
4469
4449
|
useRef as useRef2,
|
|
@@ -4471,7 +4451,7 @@ import {
|
|
|
4471
4451
|
} from "react";
|
|
4472
4452
|
import {
|
|
4473
4453
|
Html5Video,
|
|
4474
|
-
Internals as
|
|
4454
|
+
Internals as Internals18,
|
|
4475
4455
|
useBufferState as useBufferState2,
|
|
4476
4456
|
useCurrentFrame as useCurrentFrame3,
|
|
4477
4457
|
useVideoConfig as useVideoConfig3
|
|
@@ -4501,7 +4481,7 @@ var getCachedVideoFrame = (src) => {
|
|
|
4501
4481
|
};
|
|
4502
4482
|
|
|
4503
4483
|
// src/video/warn-object-fit-css.ts
|
|
4504
|
-
import { Internals as
|
|
4484
|
+
import { Internals as Internals17 } from "remotion";
|
|
4505
4485
|
var OBJECT_FIT_CLASS_PATTERN = /\bobject-(contain|cover|fill|none|scale-down)\b/;
|
|
4506
4486
|
var warnedStyle = false;
|
|
4507
4487
|
var warnedClassName = false;
|
|
@@ -4512,11 +4492,11 @@ var warnAboutObjectFitInStyleOrClassName = ({
|
|
|
4512
4492
|
}) => {
|
|
4513
4493
|
if (!warnedStyle && style?.objectFit) {
|
|
4514
4494
|
warnedStyle = true;
|
|
4515
|
-
|
|
4495
|
+
Internals17.Log.warn({ logLevel, tag: "@remotion/media" }, "Use the `objectFit` prop instead of the `style` prop.");
|
|
4516
4496
|
}
|
|
4517
4497
|
if (!warnedClassName && className && OBJECT_FIT_CLASS_PATTERN.test(className)) {
|
|
4518
4498
|
warnedClassName = true;
|
|
4519
|
-
|
|
4499
|
+
Internals17.Log.warn({ logLevel, tag: "@remotion/media" }, "Use the `objectFit` prop instead of `object-*` CSS class names.");
|
|
4520
4500
|
}
|
|
4521
4501
|
};
|
|
4522
4502
|
|
|
@@ -4533,8 +4513,8 @@ var {
|
|
|
4533
4513
|
warnAboutTooHighVolume: warnAboutTooHighVolume2,
|
|
4534
4514
|
usePreload: usePreload2,
|
|
4535
4515
|
SequenceContext: SequenceContext2,
|
|
4536
|
-
|
|
4537
|
-
} =
|
|
4516
|
+
useEffectChainState
|
|
4517
|
+
} = Internals18;
|
|
4538
4518
|
var VideoForPreviewAssertedShowing = ({
|
|
4539
4519
|
src: unpreloadedSrc,
|
|
4540
4520
|
style,
|
|
@@ -4547,7 +4527,6 @@ var VideoForPreviewAssertedShowing = ({
|
|
|
4547
4527
|
onVideoFrame,
|
|
4548
4528
|
showInTimeline,
|
|
4549
4529
|
loop,
|
|
4550
|
-
name,
|
|
4551
4530
|
trimAfter,
|
|
4552
4531
|
trimBefore,
|
|
4553
4532
|
stack,
|
|
@@ -4558,9 +4537,10 @@ var VideoForPreviewAssertedShowing = ({
|
|
|
4558
4537
|
headless,
|
|
4559
4538
|
onError,
|
|
4560
4539
|
credentials,
|
|
4561
|
-
controls,
|
|
4562
4540
|
objectFit: objectFitProp,
|
|
4563
|
-
_experimentalInitiallyDrawCachedFrame
|
|
4541
|
+
_experimentalInitiallyDrawCachedFrame,
|
|
4542
|
+
_experimentalEffects,
|
|
4543
|
+
setMediaDurationInSeconds
|
|
4564
4544
|
}) => {
|
|
4565
4545
|
const src = usePreload2(unpreloadedSrc);
|
|
4566
4546
|
const canvasRef = useRef2(null);
|
|
@@ -4573,14 +4553,12 @@ var VideoForPreviewAssertedShowing = ({
|
|
|
4573
4553
|
const [mediaPlayerReady, setMediaPlayerReady] = useState4(false);
|
|
4574
4554
|
const [shouldFallbackToNativeVideo, setShouldFallbackToNativeVideo] = useState4(false);
|
|
4575
4555
|
const [playing] = Timeline2.usePlayingState();
|
|
4576
|
-
const timelineContext =
|
|
4556
|
+
const timelineContext = Internals18.useTimelineContext();
|
|
4577
4557
|
const globalPlaybackRate = timelineContext.playbackRate;
|
|
4578
|
-
const sharedAudioContext =
|
|
4558
|
+
const sharedAudioContext = useContext4(SharedAudioContext2);
|
|
4579
4559
|
const buffer = useBufferState2();
|
|
4580
4560
|
const [mediaMuted] = useMediaMutedState2();
|
|
4581
4561
|
const [mediaVolume] = useMediaVolumeState2();
|
|
4582
|
-
const [mediaDurationInSeconds, setMediaDurationInSeconds] = useState4(null);
|
|
4583
|
-
const { hidden } = useContext5(SequenceVisibilityToggleContext);
|
|
4584
4562
|
const volumePropFrame = useFrameForVolumeProp2(loopVolumeCurveBehavior);
|
|
4585
4563
|
const userPreferredVolume = evaluateVolume2({
|
|
4586
4564
|
frame: volumePropFrame,
|
|
@@ -4591,44 +4569,27 @@ var VideoForPreviewAssertedShowing = ({
|
|
|
4591
4569
|
throw new Error("No video config found");
|
|
4592
4570
|
}
|
|
4593
4571
|
warnAboutTooHighVolume2(userPreferredVolume);
|
|
4594
|
-
const
|
|
4572
|
+
const effectChainState = useEffectChainState();
|
|
4573
|
+
const experimentalEffectsRef = useRef2(_experimentalEffects);
|
|
4574
|
+
experimentalEffectsRef.current = _experimentalEffects;
|
|
4575
|
+
const effectChainStateRef = useRef2(effectChainState);
|
|
4576
|
+
effectChainStateRef.current = effectChainState;
|
|
4577
|
+
const frameRef = useRef2(frame);
|
|
4578
|
+
frameRef.current = frame;
|
|
4579
|
+
const parentSequence = useContext4(SequenceContext2);
|
|
4595
4580
|
const isPremounting = Boolean(parentSequence?.premounting);
|
|
4596
4581
|
const isPostmounting = Boolean(parentSequence?.postmounting);
|
|
4597
4582
|
const sequenceOffset = ((parentSequence?.cumulatedFrom ?? 0) + (parentSequence?.relativeFrom ?? 0)) / videoConfig.fps;
|
|
4598
|
-
const loopDisplay = useLoopDisplay({
|
|
4599
|
-
loop,
|
|
4600
|
-
mediaDurationInSeconds,
|
|
4601
|
-
playbackRate,
|
|
4602
|
-
trimAfter,
|
|
4603
|
-
trimBefore
|
|
4604
|
-
});
|
|
4605
|
-
const { id: timelineId } = useMediaInTimeline({
|
|
4606
|
-
volume,
|
|
4607
|
-
mediaType: "video",
|
|
4608
|
-
src,
|
|
4609
|
-
playbackRate,
|
|
4610
|
-
displayName: name ?? null,
|
|
4611
|
-
stack,
|
|
4612
|
-
showInTimeline,
|
|
4613
|
-
premountDisplay: parentSequence?.premountDisplay ?? null,
|
|
4614
|
-
postmountDisplay: parentSequence?.postmountDisplay ?? null,
|
|
4615
|
-
loopDisplay,
|
|
4616
|
-
mediaVolume,
|
|
4617
|
-
trimAfter,
|
|
4618
|
-
trimBefore,
|
|
4619
|
-
controls
|
|
4620
|
-
});
|
|
4621
|
-
const isSequenceHidden = hidden[timelineId] ?? false;
|
|
4622
4583
|
const currentTime = frame / videoConfig.fps;
|
|
4623
4584
|
const currentTimeRef = useRef2(currentTime);
|
|
4624
4585
|
currentTimeRef.current = currentTime;
|
|
4625
4586
|
const preloadedSrc = usePreload2(src);
|
|
4626
|
-
const buffering =
|
|
4587
|
+
const buffering = useContext4(Internals18.BufferingContextReact);
|
|
4627
4588
|
if (!buffering) {
|
|
4628
4589
|
throw new Error("useMediaPlayback must be used inside a <BufferingContext>");
|
|
4629
4590
|
}
|
|
4630
|
-
const effectiveMuted =
|
|
4631
|
-
const isPlayerBuffering =
|
|
4591
|
+
const effectiveMuted = muted || mediaMuted || userPreferredVolume <= 0;
|
|
4592
|
+
const isPlayerBuffering = Internals18.useIsPlayerBuffering(buffering);
|
|
4632
4593
|
const initialPlaying = useRef2(playing && !isPlayerBuffering);
|
|
4633
4594
|
const initialIsPremounting = useRef2(isPremounting);
|
|
4634
4595
|
const initialIsPostmounting = useRef2(isPostmounting);
|
|
@@ -4675,7 +4636,7 @@ var VideoForPreviewAssertedShowing = ({
|
|
|
4675
4636
|
cacheVideoFrame(src, canvas);
|
|
4676
4637
|
};
|
|
4677
4638
|
}, [_experimentalInitiallyDrawCachedFrame, src]);
|
|
4678
|
-
|
|
4639
|
+
useEffect2(() => {
|
|
4679
4640
|
if (!sharedAudioContext)
|
|
4680
4641
|
return;
|
|
4681
4642
|
if (!sharedAudioContext.audioContext)
|
|
@@ -4718,7 +4679,10 @@ var VideoForPreviewAssertedShowing = ({
|
|
|
4718
4679
|
playing: initialPlaying.current,
|
|
4719
4680
|
sequenceOffset: initialSequenceOffset.current,
|
|
4720
4681
|
credentials,
|
|
4721
|
-
tagType: "video"
|
|
4682
|
+
tagType: "video",
|
|
4683
|
+
getEffects: () => experimentalEffectsRef.current,
|
|
4684
|
+
getEffectChainState: (width, height) => effectChainStateRef.current?.get(width, height),
|
|
4685
|
+
getCurrentFrame: () => frameRef.current
|
|
4722
4686
|
});
|
|
4723
4687
|
mediaPlayerRef.current = player;
|
|
4724
4688
|
player.initialize(currentTimeRef.current, initialMuted.current).then((result) => {
|
|
@@ -4736,7 +4700,7 @@ var VideoForPreviewAssertedShowing = ({
|
|
|
4736
4700
|
if (action === "fail") {
|
|
4737
4701
|
throw errorToUse;
|
|
4738
4702
|
}
|
|
4739
|
-
|
|
4703
|
+
Internals18.Log.warn({ logLevel, tag: "@remotion/media" }, fallbackMessage);
|
|
4740
4704
|
setShouldFallbackToNativeVideo(true);
|
|
4741
4705
|
};
|
|
4742
4706
|
if (result.type === "unknown-container-format") {
|
|
@@ -4771,7 +4735,7 @@ var VideoForPreviewAssertedShowing = ({
|
|
|
4771
4735
|
if (action === "fail") {
|
|
4772
4736
|
throw errorToUse;
|
|
4773
4737
|
}
|
|
4774
|
-
|
|
4738
|
+
Internals18.Log.error({ logLevel, tag: "@remotion/media" }, "[VideoForPreview] Failed to initialize MediaPlayer", errorToUse);
|
|
4775
4739
|
setShouldFallbackToNativeVideo(true);
|
|
4776
4740
|
});
|
|
4777
4741
|
} catch (error) {
|
|
@@ -4785,12 +4749,12 @@ var VideoForPreviewAssertedShowing = ({
|
|
|
4785
4749
|
if (action === "fail") {
|
|
4786
4750
|
throw errorToUse;
|
|
4787
4751
|
}
|
|
4788
|
-
|
|
4752
|
+
Internals18.Log.error({ logLevel, tag: "@remotion/media" }, "[VideoForPreview] MediaPlayer initialization failed", errorToUse);
|
|
4789
4753
|
setShouldFallbackToNativeVideo(true);
|
|
4790
4754
|
}
|
|
4791
4755
|
return () => {
|
|
4792
4756
|
if (mediaPlayerRef.current) {
|
|
4793
|
-
|
|
4757
|
+
Internals18.Log.trace({ logLevel, tag: "@remotion/media" }, `[VideoForPreview] Disposing MediaPlayer`);
|
|
4794
4758
|
mediaPlayerRef.current.dispose();
|
|
4795
4759
|
mediaPlayerRef.current = null;
|
|
4796
4760
|
}
|
|
@@ -4809,11 +4773,12 @@ var VideoForPreviewAssertedShowing = ({
|
|
|
4809
4773
|
sharedAudioContext,
|
|
4810
4774
|
videoConfig.fps,
|
|
4811
4775
|
onError,
|
|
4812
|
-
credentials
|
|
4776
|
+
credentials,
|
|
4777
|
+
setMediaDurationInSeconds
|
|
4813
4778
|
]);
|
|
4814
4779
|
warnAboutObjectFitInStyleOrClassName({ style, className, logLevel });
|
|
4815
4780
|
const classNameValue = useMemo4(() => {
|
|
4816
|
-
return [
|
|
4781
|
+
return [Internals18.OBJECTFIT_CONTAIN_CLASS_NAME, className].filter(Internals18.truthy).join(" ");
|
|
4817
4782
|
}, [className]);
|
|
4818
4783
|
useCommonEffects({
|
|
4819
4784
|
mediaPlayerRef,
|
|
@@ -4855,10 +4820,9 @@ var VideoForPreviewAssertedShowing = ({
|
|
|
4855
4820
|
const actualStyle = useMemo4(() => {
|
|
4856
4821
|
return {
|
|
4857
4822
|
...style,
|
|
4858
|
-
opacity: isSequenceHidden ? 0 : style?.opacity ?? 1,
|
|
4859
4823
|
objectFit: objectFitProp
|
|
4860
4824
|
};
|
|
4861
|
-
}, [
|
|
4825
|
+
}, [objectFitProp, style]);
|
|
4862
4826
|
if (shouldFallbackToNativeVideo && !disallowFallbackToOffthreadVideo) {
|
|
4863
4827
|
return /* @__PURE__ */ jsx4(Html5Video, {
|
|
4864
4828
|
src,
|
|
@@ -4870,7 +4834,7 @@ var VideoForPreviewAssertedShowing = ({
|
|
|
4870
4834
|
trimBefore,
|
|
4871
4835
|
playbackRate,
|
|
4872
4836
|
loopVolumeCurveBehavior,
|
|
4873
|
-
name,
|
|
4837
|
+
name: "<Html5Video> (fallback)",
|
|
4874
4838
|
loop,
|
|
4875
4839
|
showInTimeline,
|
|
4876
4840
|
stack: stack ?? undefined,
|
|
@@ -4915,21 +4879,20 @@ var VideoForPreview = (props) => {
|
|
|
4915
4879
|
return null;
|
|
4916
4880
|
}
|
|
4917
4881
|
return /* @__PURE__ */ jsx4(VideoForPreviewAssertedShowing, {
|
|
4918
|
-
...props
|
|
4919
|
-
controls: props.controls
|
|
4882
|
+
...props
|
|
4920
4883
|
});
|
|
4921
4884
|
};
|
|
4922
4885
|
|
|
4923
4886
|
// src/video/video-for-rendering.tsx
|
|
4924
4887
|
import {
|
|
4925
|
-
useContext as
|
|
4888
|
+
useContext as useContext5,
|
|
4926
4889
|
useLayoutEffect as useLayoutEffect4,
|
|
4927
4890
|
useMemo as useMemo5,
|
|
4928
4891
|
useRef as useRef3,
|
|
4929
4892
|
useState as useState5
|
|
4930
4893
|
} from "react";
|
|
4931
4894
|
import {
|
|
4932
|
-
Internals as
|
|
4895
|
+
Internals as Internals19,
|
|
4933
4896
|
Loop,
|
|
4934
4897
|
random as random2,
|
|
4935
4898
|
useCurrentFrame as useCurrentFrame4,
|
|
@@ -4953,7 +4916,6 @@ var VideoForRendering = ({
|
|
|
4953
4916
|
className,
|
|
4954
4917
|
fallbackOffthreadVideoProps,
|
|
4955
4918
|
audioStreamIndex,
|
|
4956
|
-
name,
|
|
4957
4919
|
disallowFallbackToOffthreadVideo,
|
|
4958
4920
|
stack,
|
|
4959
4921
|
toneFrequency,
|
|
@@ -4968,11 +4930,11 @@ var VideoForRendering = ({
|
|
|
4968
4930
|
throw new TypeError("No `src` was passed to <Video>.");
|
|
4969
4931
|
}
|
|
4970
4932
|
const frame = useCurrentFrame4();
|
|
4971
|
-
const absoluteFrame =
|
|
4933
|
+
const absoluteFrame = Internals19.useTimelinePosition();
|
|
4972
4934
|
const { fps } = useVideoConfig4();
|
|
4973
|
-
const { registerRenderAsset, unregisterRenderAsset } =
|
|
4974
|
-
const startsAt =
|
|
4975
|
-
const sequenceContext =
|
|
4935
|
+
const { registerRenderAsset, unregisterRenderAsset } = useContext5(Internals19.RenderAssetManager);
|
|
4936
|
+
const startsAt = Internals19.useMediaStartsAt();
|
|
4937
|
+
const sequenceContext = useContext5(Internals19.SequenceContext);
|
|
4976
4938
|
const id = useMemo5(() => `media-video-${random2(src)}-${sequenceContext?.cumulatedFrom}-${sequenceContext?.relativeFrom}-${sequenceContext?.durationInFrames}`, [
|
|
4977
4939
|
src,
|
|
4978
4940
|
sequenceContext?.cumulatedFrom,
|
|
@@ -4983,8 +4945,8 @@ var VideoForRendering = ({
|
|
|
4983
4945
|
const { delayRender, continueRender, cancelRender: cancelRender3 } = useDelayRender2();
|
|
4984
4946
|
const canvasRef = useRef3(null);
|
|
4985
4947
|
const [replaceWithOffthreadVideo, setReplaceWithOffthreadVideo] = useState5(false);
|
|
4986
|
-
const audioEnabled =
|
|
4987
|
-
const videoEnabled =
|
|
4948
|
+
const audioEnabled = Internals19.useAudioEnabled();
|
|
4949
|
+
const videoEnabled = Internals19.useVideoEnabled();
|
|
4988
4950
|
const maxCacheSize = useMaxMediaCacheSize(logLevel);
|
|
4989
4951
|
const [error, setError] = useState5(null);
|
|
4990
4952
|
if (error) {
|
|
@@ -5049,7 +5011,7 @@ var VideoForRendering = ({
|
|
|
5049
5011
|
return;
|
|
5050
5012
|
}
|
|
5051
5013
|
if (window.remotion_isMainTab) {
|
|
5052
|
-
|
|
5014
|
+
Internals19.Log.warn({ logLevel, tag: "@remotion/media" }, fallbackMessage);
|
|
5053
5015
|
}
|
|
5054
5016
|
setReplaceWithOffthreadVideo({
|
|
5055
5017
|
durationInSeconds: mediaDurationInSeconds
|
|
@@ -5104,12 +5066,12 @@ var VideoForRendering = ({
|
|
|
5104
5066
|
frame,
|
|
5105
5067
|
startsAt
|
|
5106
5068
|
});
|
|
5107
|
-
const volume =
|
|
5069
|
+
const volume = Internals19.evaluateVolume({
|
|
5108
5070
|
volume: volumeProp,
|
|
5109
5071
|
frame: volumePropsFrame,
|
|
5110
5072
|
mediaVolume: 1
|
|
5111
5073
|
});
|
|
5112
|
-
|
|
5074
|
+
Internals19.warnAboutTooHighVolume(volume);
|
|
5113
5075
|
if (audio && volume > 0) {
|
|
5114
5076
|
applyVolume(audio.data, volume);
|
|
5115
5077
|
registerRenderAsset({
|
|
@@ -5167,7 +5129,7 @@ var VideoForRendering = ({
|
|
|
5167
5129
|
]);
|
|
5168
5130
|
warnAboutObjectFitInStyleOrClassName({ style, className, logLevel });
|
|
5169
5131
|
const classNameValue = useMemo5(() => {
|
|
5170
|
-
return [
|
|
5132
|
+
return [Internals19.OBJECTFIT_CONTAIN_CLASS_NAME, className].filter(Internals19.truthy).join(" ");
|
|
5171
5133
|
}, [className]);
|
|
5172
5134
|
const styleWithObjectFit = useMemo5(() => {
|
|
5173
5135
|
return {
|
|
@@ -5176,7 +5138,7 @@ var VideoForRendering = ({
|
|
|
5176
5138
|
};
|
|
5177
5139
|
}, [objectFitProp, style]);
|
|
5178
5140
|
if (replaceWithOffthreadVideo) {
|
|
5179
|
-
const fallback = /* @__PURE__ */ jsx5(
|
|
5141
|
+
const fallback = /* @__PURE__ */ jsx5(Internals19.InnerOffthreadVideo, {
|
|
5180
5142
|
src,
|
|
5181
5143
|
playbackRate: playbackRate ?? 1,
|
|
5182
5144
|
muted: muted ?? false,
|
|
@@ -5184,12 +5146,12 @@ var VideoForRendering = ({
|
|
|
5184
5146
|
loopVolumeCurveBehavior: loopVolumeCurveBehavior ?? "repeat",
|
|
5185
5147
|
delayRenderRetries: delayRenderRetries ?? undefined,
|
|
5186
5148
|
delayRenderTimeoutInMilliseconds: delayRenderTimeoutInMilliseconds ?? undefined,
|
|
5149
|
+
name: "Fallback to <OffthreadVideo>",
|
|
5187
5150
|
style: styleWithObjectFit,
|
|
5188
5151
|
allowAmplificationDuringRender: true,
|
|
5189
5152
|
transparent: fallbackOffthreadVideoProps?.transparent ?? true,
|
|
5190
5153
|
toneMapped: fallbackOffthreadVideoProps?.toneMapped ?? true,
|
|
5191
5154
|
audioStreamIndex: audioStreamIndex ?? 0,
|
|
5192
|
-
name,
|
|
5193
5155
|
className,
|
|
5194
5156
|
onVideoFrame,
|
|
5195
5157
|
volume: volumeProp,
|
|
@@ -5216,7 +5178,7 @@ var VideoForRendering = ({
|
|
|
5216
5178
|
}
|
|
5217
5179
|
return /* @__PURE__ */ jsx5(Loop, {
|
|
5218
5180
|
layout: "none",
|
|
5219
|
-
durationInFrames:
|
|
5181
|
+
durationInFrames: Internals19.calculateMediaDuration({
|
|
5220
5182
|
trimAfter: trimAfterValue,
|
|
5221
5183
|
mediaDurationInFrames: replaceWithOffthreadVideo.durationInSeconds * fps,
|
|
5222
5184
|
playbackRate,
|
|
@@ -5239,7 +5201,7 @@ var VideoForRendering = ({
|
|
|
5239
5201
|
|
|
5240
5202
|
// src/video/video.tsx
|
|
5241
5203
|
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
5242
|
-
var { validateMediaTrimProps, resolveTrimProps, validateMediaProps: validateMediaProps2 } =
|
|
5204
|
+
var { validateMediaTrimProps, resolveTrimProps, validateMediaProps: validateMediaProps2 } = Internals20;
|
|
5243
5205
|
var videoSchema = {
|
|
5244
5206
|
volume: {
|
|
5245
5207
|
type: "number",
|
|
@@ -5298,7 +5260,6 @@ var InnerVideo = ({
|
|
|
5298
5260
|
loop,
|
|
5299
5261
|
loopVolumeCurveBehavior,
|
|
5300
5262
|
muted,
|
|
5301
|
-
name,
|
|
5302
5263
|
onVideoFrame,
|
|
5303
5264
|
playbackRate,
|
|
5304
5265
|
style,
|
|
@@ -5312,9 +5273,11 @@ var InnerVideo = ({
|
|
|
5312
5273
|
headless,
|
|
5313
5274
|
onError,
|
|
5314
5275
|
credentials,
|
|
5315
|
-
controls,
|
|
5276
|
+
_experimentalControls: controls,
|
|
5316
5277
|
objectFit,
|
|
5317
|
-
_experimentalInitiallyDrawCachedFrame
|
|
5278
|
+
_experimentalInitiallyDrawCachedFrame,
|
|
5279
|
+
_experimentalEffects,
|
|
5280
|
+
setMediaDurationInSeconds
|
|
5318
5281
|
}) => {
|
|
5319
5282
|
const environment = useRemotionEnvironment4();
|
|
5320
5283
|
if (typeof src !== "string") {
|
|
@@ -5340,7 +5303,6 @@ var InnerVideo = ({
|
|
|
5340
5303
|
delayRenderRetries: delayRenderRetries ?? null,
|
|
5341
5304
|
delayRenderTimeoutInMilliseconds: delayRenderTimeoutInMilliseconds ?? null,
|
|
5342
5305
|
disallowFallbackToOffthreadVideo: disallowFallbackToOffthreadVideo ?? false,
|
|
5343
|
-
name,
|
|
5344
5306
|
fallbackOffthreadVideoProps,
|
|
5345
5307
|
logLevel,
|
|
5346
5308
|
loop,
|
|
@@ -5362,9 +5324,9 @@ var InnerVideo = ({
|
|
|
5362
5324
|
});
|
|
5363
5325
|
}
|
|
5364
5326
|
return /* @__PURE__ */ jsx6(VideoForPreview, {
|
|
5327
|
+
setMediaDurationInSeconds,
|
|
5365
5328
|
audioStreamIndex: audioStreamIndex ?? 0,
|
|
5366
5329
|
className,
|
|
5367
|
-
name,
|
|
5368
5330
|
logLevel,
|
|
5369
5331
|
loop,
|
|
5370
5332
|
loopVolumeCurveBehavior,
|
|
@@ -5386,6 +5348,7 @@ var InnerVideo = ({
|
|
|
5386
5348
|
credentials,
|
|
5387
5349
|
controls,
|
|
5388
5350
|
objectFit,
|
|
5351
|
+
_experimentalEffects,
|
|
5389
5352
|
_experimentalInitiallyDrawCachedFrame
|
|
5390
5353
|
});
|
|
5391
5354
|
};
|
|
@@ -5415,18 +5378,66 @@ var VideoInner = ({
|
|
|
5415
5378
|
headless,
|
|
5416
5379
|
onError,
|
|
5417
5380
|
credentials,
|
|
5418
|
-
controls,
|
|
5381
|
+
_experimentalControls: controls,
|
|
5419
5382
|
objectFit,
|
|
5420
5383
|
_experimentalInitiallyDrawCachedFrame,
|
|
5421
|
-
|
|
5422
|
-
durationInFrames
|
|
5384
|
+
_experimentalEffects,
|
|
5385
|
+
durationInFrames,
|
|
5386
|
+
from
|
|
5423
5387
|
}) => {
|
|
5424
|
-
const fallbackLogLevel =
|
|
5388
|
+
const fallbackLogLevel = Internals20.useLogLevel();
|
|
5389
|
+
const [mediaVolume] = Internals20.useMediaVolumeState();
|
|
5390
|
+
const mediaStartsAt = Internals20.useMediaStartsAt();
|
|
5391
|
+
const videoConfig = useVideoConfig5();
|
|
5392
|
+
const sequenceDurationInFrames = Math.min(durationInFrames ?? Infinity, Math.max(0, videoConfig.durationInFrames - (from ?? 0)));
|
|
5393
|
+
const basicInfo = Internals20.useBasicMediaInTimeline({
|
|
5394
|
+
src,
|
|
5395
|
+
volume,
|
|
5396
|
+
playbackRate: playbackRate ?? 1,
|
|
5397
|
+
trimBefore,
|
|
5398
|
+
trimAfter,
|
|
5399
|
+
sequenceDurationInFrames,
|
|
5400
|
+
mediaType: "video",
|
|
5401
|
+
displayName: name ?? "<Video>",
|
|
5402
|
+
mediaVolume,
|
|
5403
|
+
mediaStartsAt,
|
|
5404
|
+
loop: loop ?? false
|
|
5405
|
+
});
|
|
5406
|
+
const [mediaDurationInSeconds, setMediaDurationInSeconds] = useState6(null);
|
|
5407
|
+
const loopDisplay = useMemo6(() => getLoopDisplay({
|
|
5408
|
+
loop: loop ?? false,
|
|
5409
|
+
mediaDurationInSeconds,
|
|
5410
|
+
playbackRate: playbackRate ?? 1,
|
|
5411
|
+
trimAfter,
|
|
5412
|
+
trimBefore,
|
|
5413
|
+
sequenceDurationInFrames,
|
|
5414
|
+
compFps: videoConfig.fps
|
|
5415
|
+
}), [
|
|
5416
|
+
loop,
|
|
5417
|
+
mediaDurationInSeconds,
|
|
5418
|
+
playbackRate,
|
|
5419
|
+
trimAfter,
|
|
5420
|
+
trimBefore,
|
|
5421
|
+
sequenceDurationInFrames,
|
|
5422
|
+
videoConfig.fps
|
|
5423
|
+
]);
|
|
5424
|
+
const isMedia = useMemo6(() => ({
|
|
5425
|
+
type: "video",
|
|
5426
|
+
data: basicInfo
|
|
5427
|
+
}), [basicInfo]);
|
|
5428
|
+
if (sequenceDurationInFrames === 0) {
|
|
5429
|
+
return null;
|
|
5430
|
+
}
|
|
5425
5431
|
return /* @__PURE__ */ jsx6(Sequence2, {
|
|
5426
5432
|
layout: "none",
|
|
5427
5433
|
from: from ?? 0,
|
|
5428
|
-
durationInFrames:
|
|
5429
|
-
|
|
5434
|
+
durationInFrames: basicInfo.duration,
|
|
5435
|
+
_remotionInternalStack: stack,
|
|
5436
|
+
_remotionInternalIsMedia: isMedia,
|
|
5437
|
+
name: name ?? "<Video>",
|
|
5438
|
+
_experimentalControls: controls,
|
|
5439
|
+
_remotionInternalLoopDisplay: loopDisplay,
|
|
5440
|
+
showInTimeline: showInTimeline ?? true,
|
|
5430
5441
|
children: /* @__PURE__ */ jsx6(InnerVideo, {
|
|
5431
5442
|
audioStreamIndex: audioStreamIndex ?? 0,
|
|
5432
5443
|
className,
|
|
@@ -5438,7 +5449,6 @@ var VideoInner = ({
|
|
|
5438
5449
|
loop: loop ?? false,
|
|
5439
5450
|
loopVolumeCurveBehavior: loopVolumeCurveBehavior ?? "repeat",
|
|
5440
5451
|
muted: muted ?? false,
|
|
5441
|
-
name,
|
|
5442
5452
|
onVideoFrame,
|
|
5443
5453
|
playbackRate: playbackRate ?? 1,
|
|
5444
5454
|
showInTimeline: showInTimeline ?? true,
|
|
@@ -5453,14 +5463,16 @@ var VideoInner = ({
|
|
|
5453
5463
|
headless: headless ?? false,
|
|
5454
5464
|
onError,
|
|
5455
5465
|
credentials,
|
|
5456
|
-
controls,
|
|
5466
|
+
_experimentalControls: controls,
|
|
5457
5467
|
objectFit: objectFit ?? "contain",
|
|
5458
|
-
_experimentalInitiallyDrawCachedFrame: _experimentalInitiallyDrawCachedFrame ?? false
|
|
5468
|
+
_experimentalInitiallyDrawCachedFrame: _experimentalInitiallyDrawCachedFrame ?? false,
|
|
5469
|
+
_experimentalEffects: _experimentalEffects ?? [],
|
|
5470
|
+
setMediaDurationInSeconds
|
|
5459
5471
|
})
|
|
5460
5472
|
});
|
|
5461
5473
|
};
|
|
5462
|
-
var Video =
|
|
5463
|
-
|
|
5474
|
+
var Video = Internals20.wrapInSchema(VideoInner, videoSchema);
|
|
5475
|
+
Internals20.addSequenceStackTraces(Video);
|
|
5464
5476
|
|
|
5465
5477
|
// src/index.ts
|
|
5466
5478
|
var experimental_Audio = Audio;
|