remotion 4.0.65 → 4.0.67
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/cjs/absolute-src.js +3 -0
- package/dist/cjs/audio/Audio.js +6 -4
- package/dist/cjs/spring/index.js +1 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/video/Video.js +4 -2
- package/dist/esm/index.mjs +90 -85
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
package/dist/cjs/absolute-src.js
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getAbsoluteSrc = void 0;
|
|
4
4
|
const getAbsoluteSrc = (relativeSrc) => {
|
|
5
|
+
if (typeof window === 'undefined') {
|
|
6
|
+
return relativeSrc;
|
|
7
|
+
}
|
|
5
8
|
return new URL(relativeSrc, window.location.origin).href;
|
|
6
9
|
};
|
|
7
10
|
exports.getAbsoluteSrc = getAbsoluteSrc;
|
package/dist/cjs/audio/Audio.js
CHANGED
|
@@ -9,6 +9,7 @@ const calculate_loop_js_1 = require("../calculate-loop.js");
|
|
|
9
9
|
const cancel_render_js_1 = require("../cancel-render.js");
|
|
10
10
|
const get_remotion_environment_js_1 = require("../get-remotion-environment.js");
|
|
11
11
|
const index_js_1 = require("../loop/index.js");
|
|
12
|
+
const prefetch_js_1 = require("../prefetch.js");
|
|
12
13
|
const Sequence_js_1 = require("../Sequence.js");
|
|
13
14
|
const use_video_config_js_1 = require("../use-video-config.js");
|
|
14
15
|
const validate_media_props_js_1 = require("../validate-media-props.js");
|
|
@@ -28,23 +29,24 @@ const AudioRefForwardingFunction = (props, ref) => {
|
|
|
28
29
|
if (typeof props.src !== 'string') {
|
|
29
30
|
throw new TypeError(`The \`<Audio>\` tag requires a string for \`src\`, but got ${JSON.stringify(props.src)} instead.`);
|
|
30
31
|
}
|
|
32
|
+
const preloadedSrc = (0, prefetch_js_1.usePreload)(props.src);
|
|
31
33
|
const onError = (0, react_1.useCallback)((e) => {
|
|
32
34
|
console.log(e.currentTarget.error);
|
|
33
35
|
// If there is no `loop` property, we don't need to get the duration
|
|
34
36
|
// and this does not need to be a fatal error
|
|
35
|
-
const errMessage = `Could not play audio with src ${
|
|
37
|
+
const errMessage = `Could not play audio with src ${preloadedSrc}: ${e.currentTarget.error}. See https://remotion.dev/docs/media-playback-error for help.`;
|
|
36
38
|
if (loop) {
|
|
37
39
|
(0, cancel_render_js_1.cancelRender)(new Error(errMessage));
|
|
38
40
|
}
|
|
39
41
|
else {
|
|
40
42
|
console.warn(errMessage);
|
|
41
43
|
}
|
|
42
|
-
}, [loop,
|
|
44
|
+
}, [loop, preloadedSrc]);
|
|
43
45
|
const onDuration = (0, react_1.useCallback)((src, durationInSeconds) => {
|
|
44
46
|
setDurations({ type: 'got-duration', durationInSeconds, src });
|
|
45
47
|
}, [setDurations]);
|
|
46
|
-
if (loop &&
|
|
47
|
-
const duration = Math.floor(durations[(0, absolute_src_js_1.getAbsoluteSrc)(
|
|
48
|
+
if (loop && durations[(0, absolute_src_js_1.getAbsoluteSrc)(preloadedSrc)] !== undefined) {
|
|
49
|
+
const duration = Math.floor(durations[(0, absolute_src_js_1.getAbsoluteSrc)(preloadedSrc)] * fps);
|
|
48
50
|
return ((0, jsx_runtime_1.jsx)(index_js_1.Loop, { layout: "none", durationInFrames: (0, calculate_loop_js_1.calculateLoopDuration)({
|
|
49
51
|
endAt,
|
|
50
52
|
mediaDuration: duration,
|
package/dist/cjs/spring/index.js
CHANGED
|
@@ -57,7 +57,7 @@ function spring({ frame: passedFrame, fps, config = {}, from = 0, to = 1, durati
|
|
|
57
57
|
const durationProcessed = passedDurationInFrames === undefined
|
|
58
58
|
? delayProcessed
|
|
59
59
|
: delayProcessed / (passedDurationInFrames / naturalDurationGetter.get());
|
|
60
|
-
if (passedDurationInFrames &&
|
|
60
|
+
if (passedDurationInFrames && delayProcessed > passedDurationInFrames) {
|
|
61
61
|
return to;
|
|
62
62
|
}
|
|
63
63
|
const spr = (0, spring_utils_js_1.springCalculation)({
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "4.0.
|
|
1
|
+
export declare const VERSION = "4.0.67";
|
package/dist/cjs/version.js
CHANGED
package/dist/cjs/video/Video.js
CHANGED
|
@@ -8,6 +8,7 @@ const absolute_src_js_1 = require("../absolute-src.js");
|
|
|
8
8
|
const calculate_loop_js_1 = require("../calculate-loop.js");
|
|
9
9
|
const get_remotion_environment_js_1 = require("../get-remotion-environment.js");
|
|
10
10
|
const index_js_1 = require("../loop/index.js");
|
|
11
|
+
const prefetch_js_1 = require("../prefetch.js");
|
|
11
12
|
const Sequence_js_1 = require("../Sequence.js");
|
|
12
13
|
const use_video_config_js_1 = require("../use-video-config.js");
|
|
13
14
|
const validate_media_props_js_1 = require("../validate-media-props.js");
|
|
@@ -28,11 +29,12 @@ const VideoForwardingFunction = (props, ref) => {
|
|
|
28
29
|
if (typeof props.src !== 'string') {
|
|
29
30
|
throw new TypeError(`The \`<Video>\` tag requires a string for \`src\`, but got ${JSON.stringify(props.src)} instead.`);
|
|
30
31
|
}
|
|
32
|
+
const preloadedSrc = (0, prefetch_js_1.usePreload)(props.src);
|
|
31
33
|
const onDuration = (0, react_1.useCallback)((src, durationInSeconds) => {
|
|
32
34
|
setDurations({ type: 'got-duration', durationInSeconds, src });
|
|
33
35
|
}, [setDurations]);
|
|
34
|
-
if (loop &&
|
|
35
|
-
const mediaDuration = durations[(0, absolute_src_js_1.getAbsoluteSrc)(
|
|
36
|
+
if (loop && durations[(0, absolute_src_js_1.getAbsoluteSrc)(preloadedSrc)] !== undefined) {
|
|
37
|
+
const mediaDuration = durations[(0, absolute_src_js_1.getAbsoluteSrc)(preloadedSrc)] * fps;
|
|
36
38
|
return ((0, jsx_runtime_1.jsx)(index_js_1.Loop, { durationInFrames: (0, calculate_loop_js_1.calculateLoopDuration)({
|
|
37
39
|
endAt,
|
|
38
40
|
mediaDuration,
|
package/dist/esm/index.mjs
CHANGED
|
@@ -59,7 +59,7 @@ function truthy(value) {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
// Automatically generated on publish
|
|
62
|
-
const VERSION = '4.0.
|
|
62
|
+
const VERSION = '4.0.67';
|
|
63
63
|
|
|
64
64
|
const checkMultipleRemotionVersions = () => {
|
|
65
65
|
if (typeof globalThis === 'undefined') {
|
|
@@ -133,6 +133,9 @@ const AbsoluteFillRefForwarding = (props, ref) => {
|
|
|
133
133
|
const AbsoluteFill = forwardRef(AbsoluteFillRefForwarding);
|
|
134
134
|
|
|
135
135
|
const getAbsoluteSrc = (relativeSrc) => {
|
|
136
|
+
if (typeof window === 'undefined') {
|
|
137
|
+
return relativeSrc;
|
|
138
|
+
}
|
|
136
139
|
return new URL(relativeSrc, window.location.origin).href;
|
|
137
140
|
};
|
|
138
141
|
|
|
@@ -1203,83 +1206,6 @@ const Loop = ({ durationInFrames, times = Infinity, children, name, ...props })
|
|
|
1203
1206
|
return (jsx(Sequence, { durationInFrames: durationInFrames, from: from, name: name, loopDisplay: loopDisplay, layout: props.layout, style: style, children: children }));
|
|
1204
1207
|
};
|
|
1205
1208
|
|
|
1206
|
-
const validateMediaProps = (props, component) => {
|
|
1207
|
-
if (typeof props.volume !== 'number' &&
|
|
1208
|
-
typeof props.volume !== 'function' &&
|
|
1209
|
-
typeof props.volume !== 'undefined') {
|
|
1210
|
-
throw new TypeError(`You have passed a volume of type ${typeof props.volume} to your <${component} /> component. Volume must be a number or a function with the signature '(frame: number) => number' undefined.`);
|
|
1211
|
-
}
|
|
1212
|
-
if (typeof props.volume === 'number' && props.volume < 0) {
|
|
1213
|
-
throw new TypeError(`You have passed a volume below 0 to your <${component} /> component. Volume must be between 0 and 1`);
|
|
1214
|
-
}
|
|
1215
|
-
if (typeof props.playbackRate !== 'number' &&
|
|
1216
|
-
typeof props.playbackRate !== 'undefined') {
|
|
1217
|
-
throw new TypeError(`You have passed a playbackRate of type ${typeof props.playbackRate} to your <${component} /> component. Playback rate must a real number or undefined.`);
|
|
1218
|
-
}
|
|
1219
|
-
if (typeof props.playbackRate === 'number' &&
|
|
1220
|
-
(isNaN(props.playbackRate) ||
|
|
1221
|
-
!Number.isFinite(props.playbackRate) ||
|
|
1222
|
-
props.playbackRate <= 0)) {
|
|
1223
|
-
throw new TypeError(`You have passed a playbackRate of ${props.playbackRate} to your <${component} /> component. Playback rate must be a real number above 0.`);
|
|
1224
|
-
}
|
|
1225
|
-
};
|
|
1226
|
-
|
|
1227
|
-
const validateStartFromProps = (startFrom, endAt) => {
|
|
1228
|
-
if (typeof startFrom !== 'undefined') {
|
|
1229
|
-
if (typeof startFrom !== 'number') {
|
|
1230
|
-
throw new TypeError(`type of startFrom prop must be a number, instead got type ${typeof startFrom}.`);
|
|
1231
|
-
}
|
|
1232
|
-
if (isNaN(startFrom) || startFrom === Infinity) {
|
|
1233
|
-
throw new TypeError('startFrom prop can not be NaN or Infinity.');
|
|
1234
|
-
}
|
|
1235
|
-
if (startFrom < 0) {
|
|
1236
|
-
throw new TypeError(`startFrom must be greater than equal to 0 instead got ${startFrom}.`);
|
|
1237
|
-
}
|
|
1238
|
-
}
|
|
1239
|
-
if (typeof endAt !== 'undefined') {
|
|
1240
|
-
if (typeof endAt !== 'number') {
|
|
1241
|
-
throw new TypeError(`type of endAt prop must be a number, instead got type ${typeof endAt}.`);
|
|
1242
|
-
}
|
|
1243
|
-
if (isNaN(endAt)) {
|
|
1244
|
-
throw new TypeError('endAt prop can not be NaN.');
|
|
1245
|
-
}
|
|
1246
|
-
if (endAt <= 0) {
|
|
1247
|
-
throw new TypeError(`endAt must be a positive number, instead got ${endAt}.`);
|
|
1248
|
-
}
|
|
1249
|
-
}
|
|
1250
|
-
if (endAt < startFrom) {
|
|
1251
|
-
throw new TypeError('endAt prop must be greater than startFrom prop.');
|
|
1252
|
-
}
|
|
1253
|
-
};
|
|
1254
|
-
|
|
1255
|
-
const durationReducer = (state, action) => {
|
|
1256
|
-
switch (action.type) {
|
|
1257
|
-
case 'got-duration':
|
|
1258
|
-
return {
|
|
1259
|
-
...state,
|
|
1260
|
-
[getAbsoluteSrc(action.src)]: action.durationInSeconds,
|
|
1261
|
-
};
|
|
1262
|
-
default:
|
|
1263
|
-
return state;
|
|
1264
|
-
}
|
|
1265
|
-
};
|
|
1266
|
-
const DurationsContext = createContext({
|
|
1267
|
-
durations: {},
|
|
1268
|
-
setDurations: () => {
|
|
1269
|
-
throw new Error('context missing');
|
|
1270
|
-
},
|
|
1271
|
-
});
|
|
1272
|
-
const DurationsContextProvider = ({ children }) => {
|
|
1273
|
-
const [durations, setDurations] = useReducer(durationReducer, {});
|
|
1274
|
-
const value = useMemo(() => {
|
|
1275
|
-
return {
|
|
1276
|
-
durations,
|
|
1277
|
-
setDurations,
|
|
1278
|
-
};
|
|
1279
|
-
}, [durations]);
|
|
1280
|
-
return (jsx(DurationsContext.Provider, { value: value, children: children }));
|
|
1281
|
-
};
|
|
1282
|
-
|
|
1283
1209
|
const PreloadContext = createContext({});
|
|
1284
1210
|
let preloads = {};
|
|
1285
1211
|
let updaters = [];
|
|
@@ -1414,6 +1340,83 @@ const prefetch = (src, options) => {
|
|
|
1414
1340
|
};
|
|
1415
1341
|
};
|
|
1416
1342
|
|
|
1343
|
+
const validateMediaProps = (props, component) => {
|
|
1344
|
+
if (typeof props.volume !== 'number' &&
|
|
1345
|
+
typeof props.volume !== 'function' &&
|
|
1346
|
+
typeof props.volume !== 'undefined') {
|
|
1347
|
+
throw new TypeError(`You have passed a volume of type ${typeof props.volume} to your <${component} /> component. Volume must be a number or a function with the signature '(frame: number) => number' undefined.`);
|
|
1348
|
+
}
|
|
1349
|
+
if (typeof props.volume === 'number' && props.volume < 0) {
|
|
1350
|
+
throw new TypeError(`You have passed a volume below 0 to your <${component} /> component. Volume must be between 0 and 1`);
|
|
1351
|
+
}
|
|
1352
|
+
if (typeof props.playbackRate !== 'number' &&
|
|
1353
|
+
typeof props.playbackRate !== 'undefined') {
|
|
1354
|
+
throw new TypeError(`You have passed a playbackRate of type ${typeof props.playbackRate} to your <${component} /> component. Playback rate must a real number or undefined.`);
|
|
1355
|
+
}
|
|
1356
|
+
if (typeof props.playbackRate === 'number' &&
|
|
1357
|
+
(isNaN(props.playbackRate) ||
|
|
1358
|
+
!Number.isFinite(props.playbackRate) ||
|
|
1359
|
+
props.playbackRate <= 0)) {
|
|
1360
|
+
throw new TypeError(`You have passed a playbackRate of ${props.playbackRate} to your <${component} /> component. Playback rate must be a real number above 0.`);
|
|
1361
|
+
}
|
|
1362
|
+
};
|
|
1363
|
+
|
|
1364
|
+
const validateStartFromProps = (startFrom, endAt) => {
|
|
1365
|
+
if (typeof startFrom !== 'undefined') {
|
|
1366
|
+
if (typeof startFrom !== 'number') {
|
|
1367
|
+
throw new TypeError(`type of startFrom prop must be a number, instead got type ${typeof startFrom}.`);
|
|
1368
|
+
}
|
|
1369
|
+
if (isNaN(startFrom) || startFrom === Infinity) {
|
|
1370
|
+
throw new TypeError('startFrom prop can not be NaN or Infinity.');
|
|
1371
|
+
}
|
|
1372
|
+
if (startFrom < 0) {
|
|
1373
|
+
throw new TypeError(`startFrom must be greater than equal to 0 instead got ${startFrom}.`);
|
|
1374
|
+
}
|
|
1375
|
+
}
|
|
1376
|
+
if (typeof endAt !== 'undefined') {
|
|
1377
|
+
if (typeof endAt !== 'number') {
|
|
1378
|
+
throw new TypeError(`type of endAt prop must be a number, instead got type ${typeof endAt}.`);
|
|
1379
|
+
}
|
|
1380
|
+
if (isNaN(endAt)) {
|
|
1381
|
+
throw new TypeError('endAt prop can not be NaN.');
|
|
1382
|
+
}
|
|
1383
|
+
if (endAt <= 0) {
|
|
1384
|
+
throw new TypeError(`endAt must be a positive number, instead got ${endAt}.`);
|
|
1385
|
+
}
|
|
1386
|
+
}
|
|
1387
|
+
if (endAt < startFrom) {
|
|
1388
|
+
throw new TypeError('endAt prop must be greater than startFrom prop.');
|
|
1389
|
+
}
|
|
1390
|
+
};
|
|
1391
|
+
|
|
1392
|
+
const durationReducer = (state, action) => {
|
|
1393
|
+
switch (action.type) {
|
|
1394
|
+
case 'got-duration':
|
|
1395
|
+
return {
|
|
1396
|
+
...state,
|
|
1397
|
+
[getAbsoluteSrc(action.src)]: action.durationInSeconds,
|
|
1398
|
+
};
|
|
1399
|
+
default:
|
|
1400
|
+
return state;
|
|
1401
|
+
}
|
|
1402
|
+
};
|
|
1403
|
+
const DurationsContext = createContext({
|
|
1404
|
+
durations: {},
|
|
1405
|
+
setDurations: () => {
|
|
1406
|
+
throw new Error('context missing');
|
|
1407
|
+
},
|
|
1408
|
+
});
|
|
1409
|
+
const DurationsContextProvider = ({ children }) => {
|
|
1410
|
+
const [durations, setDurations] = useReducer(durationReducer, {});
|
|
1411
|
+
const value = useMemo(() => {
|
|
1412
|
+
return {
|
|
1413
|
+
durations,
|
|
1414
|
+
setDurations,
|
|
1415
|
+
};
|
|
1416
|
+
}, [durations]);
|
|
1417
|
+
return (jsx(DurationsContext.Provider, { value: value, children: children }));
|
|
1418
|
+
};
|
|
1419
|
+
|
|
1417
1420
|
/* eslint-disable no-bitwise */
|
|
1418
1421
|
function mulberry32(a) {
|
|
1419
1422
|
let t = a + 0x6d2b79f5;
|
|
@@ -2593,23 +2596,24 @@ const AudioRefForwardingFunction = (props, ref) => {
|
|
|
2593
2596
|
if (typeof props.src !== 'string') {
|
|
2594
2597
|
throw new TypeError(`The \`<Audio>\` tag requires a string for \`src\`, but got ${JSON.stringify(props.src)} instead.`);
|
|
2595
2598
|
}
|
|
2599
|
+
const preloadedSrc = usePreload(props.src);
|
|
2596
2600
|
const onError = useCallback((e) => {
|
|
2597
2601
|
console.log(e.currentTarget.error);
|
|
2598
2602
|
// If there is no `loop` property, we don't need to get the duration
|
|
2599
2603
|
// and this does not need to be a fatal error
|
|
2600
|
-
const errMessage = `Could not play audio with src ${
|
|
2604
|
+
const errMessage = `Could not play audio with src ${preloadedSrc}: ${e.currentTarget.error}. See https://remotion.dev/docs/media-playback-error for help.`;
|
|
2601
2605
|
if (loop) {
|
|
2602
2606
|
cancelRender(new Error(errMessage));
|
|
2603
2607
|
}
|
|
2604
2608
|
else {
|
|
2605
2609
|
console.warn(errMessage);
|
|
2606
2610
|
}
|
|
2607
|
-
}, [loop,
|
|
2611
|
+
}, [loop, preloadedSrc]);
|
|
2608
2612
|
const onDuration = useCallback((src, durationInSeconds) => {
|
|
2609
2613
|
setDurations({ type: 'got-duration', durationInSeconds, src });
|
|
2610
2614
|
}, [setDurations]);
|
|
2611
|
-
if (loop &&
|
|
2612
|
-
const duration = Math.floor(durations[getAbsoluteSrc(
|
|
2615
|
+
if (loop && durations[getAbsoluteSrc(preloadedSrc)] !== undefined) {
|
|
2616
|
+
const duration = Math.floor(durations[getAbsoluteSrc(preloadedSrc)] * fps);
|
|
2613
2617
|
return (jsx(Loop, { layout: "none", durationInFrames: calculateLoopDuration({
|
|
2614
2618
|
endAt,
|
|
2615
2619
|
mediaDuration: duration,
|
|
@@ -4391,7 +4395,7 @@ function spring({ frame: passedFrame, fps, config = {}, from = 0, to = 1, durati
|
|
|
4391
4395
|
const durationProcessed = passedDurationInFrames === undefined
|
|
4392
4396
|
? delayProcessed
|
|
4393
4397
|
: delayProcessed / (passedDurationInFrames / naturalDurationGetter.get());
|
|
4394
|
-
if (passedDurationInFrames &&
|
|
4398
|
+
if (passedDurationInFrames && delayProcessed > passedDurationInFrames) {
|
|
4395
4399
|
return to;
|
|
4396
4400
|
}
|
|
4397
4401
|
const spr = springCalculation({
|
|
@@ -4858,11 +4862,12 @@ const VideoForwardingFunction = (props, ref) => {
|
|
|
4858
4862
|
if (typeof props.src !== 'string') {
|
|
4859
4863
|
throw new TypeError(`The \`<Video>\` tag requires a string for \`src\`, but got ${JSON.stringify(props.src)} instead.`);
|
|
4860
4864
|
}
|
|
4865
|
+
const preloadedSrc = usePreload(props.src);
|
|
4861
4866
|
const onDuration = useCallback((src, durationInSeconds) => {
|
|
4862
4867
|
setDurations({ type: 'got-duration', durationInSeconds, src });
|
|
4863
4868
|
}, [setDurations]);
|
|
4864
|
-
if (loop &&
|
|
4865
|
-
const mediaDuration = durations[getAbsoluteSrc(
|
|
4869
|
+
if (loop && durations[getAbsoluteSrc(preloadedSrc)] !== undefined) {
|
|
4870
|
+
const mediaDuration = durations[getAbsoluteSrc(preloadedSrc)] * fps;
|
|
4866
4871
|
return (jsx(Loop, { durationInFrames: calculateLoopDuration({
|
|
4867
4872
|
endAt,
|
|
4868
4873
|
mediaDuration,
|
package/dist/esm/version.mjs
CHANGED