remotion 3.3.96 → 3.3.98
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/Img.js +31 -28
- package/dist/cjs/audio/Audio.js +3 -2
- package/dist/cjs/audio/AudioForRendering.js +2 -2
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/video/Video.js +3 -2
- package/dist/cjs/video/duration-state.js +2 -1
- package/dist/esm/index.mjs +43 -40
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
package/dist/cjs/Img.js
CHANGED
|
@@ -55,35 +55,38 @@ const ImgRefForwarding = ({ onError, maxRetries = 2, src, ...props }, ref) => {
|
|
|
55
55
|
}
|
|
56
56
|
console.error('Error loading image with src:', (_l = imageRef.current) === null || _l === void 0 ? void 0 : _l.src, e, 'Handle the event using the onError() prop to make this message disappear.');
|
|
57
57
|
}, [maxRetries, onError, retryIn]);
|
|
58
|
-
(
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const { current } = imageRef;
|
|
64
|
-
const onComplete = () => {
|
|
65
|
-
var _a, _b, _c, _d;
|
|
66
|
-
if (((_b = errors.current[(_a = imageRef.current) === null || _a === void 0 ? void 0 : _a.src]) !== null && _b !== void 0 ? _b : 0) > 0) {
|
|
67
|
-
delete errors.current[(_c = imageRef.current) === null || _c === void 0 ? void 0 : _c.src];
|
|
68
|
-
console.info(`Retry successful - ${(_d = imageRef.current) === null || _d === void 0 ? void 0 : _d.src} is now loaded`);
|
|
58
|
+
if (typeof window !== 'undefined') {
|
|
59
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
60
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
61
|
+
if (process.env.NODE_ENV === 'test') {
|
|
62
|
+
return;
|
|
69
63
|
}
|
|
70
|
-
(0, delay_render_js_1.
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
current === null || current === void 0 ? void 0 : current.
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
64
|
+
const newHandle = (0, delay_render_js_1.delayRender)('Loading <Img> with src=' + src);
|
|
65
|
+
const { current } = imageRef;
|
|
66
|
+
const onComplete = () => {
|
|
67
|
+
var _a, _b, _c, _d;
|
|
68
|
+
if (((_b = errors.current[(_a = imageRef.current) === null || _a === void 0 ? void 0 : _a.src]) !== null && _b !== void 0 ? _b : 0) > 0) {
|
|
69
|
+
delete errors.current[(_c = imageRef.current) === null || _c === void 0 ? void 0 : _c.src];
|
|
70
|
+
console.info(`Retry successful - ${(_d = imageRef.current) === null || _d === void 0 ? void 0 : _d.src} is now loaded`);
|
|
71
|
+
}
|
|
72
|
+
(0, delay_render_js_1.continueRender)(newHandle);
|
|
73
|
+
};
|
|
74
|
+
const didLoad = () => {
|
|
75
|
+
onComplete();
|
|
76
|
+
};
|
|
77
|
+
if (current === null || current === void 0 ? void 0 : current.complete) {
|
|
78
|
+
onComplete();
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
current === null || current === void 0 ? void 0 : current.addEventListener('load', didLoad, { once: true });
|
|
82
|
+
}
|
|
83
|
+
// If tag gets unmounted, clear pending handles because image is not going to load
|
|
84
|
+
return () => {
|
|
85
|
+
current === null || current === void 0 ? void 0 : current.removeEventListener('load', didLoad);
|
|
86
|
+
(0, delay_render_js_1.continueRender)(newHandle);
|
|
87
|
+
};
|
|
88
|
+
}, [src]);
|
|
89
|
+
}
|
|
87
90
|
return ((0, jsx_runtime_1.jsx)("img", { ...props, ref: imageRef, src: actualSrc, onError: didGetError }));
|
|
88
91
|
};
|
|
89
92
|
/**
|
package/dist/cjs/audio/Audio.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Audio = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
+
const absolute_src_js_1 = require("../absolute-src.js");
|
|
6
7
|
const get_environment_js_1 = require("../get-environment.js");
|
|
7
8
|
const index_js_1 = require("../loop/index.js");
|
|
8
9
|
const Sequence_js_1 = require("../Sequence.js");
|
|
@@ -31,8 +32,8 @@ const AudioRefForwardingFunction = (props, ref) => {
|
|
|
31
32
|
const onDuration = (0, react_1.useCallback)((src, durationInSeconds) => {
|
|
32
33
|
setDurations({ type: 'got-duration', durationInSeconds, src });
|
|
33
34
|
}, [setDurations]);
|
|
34
|
-
if (loop && props.src && durations[props.src] !== undefined) {
|
|
35
|
-
const duration = Math.floor(durations[props.src] * fps);
|
|
35
|
+
if (loop && props.src && durations[(0, absolute_src_js_1.getAbsoluteSrc)(props.src)] !== undefined) {
|
|
36
|
+
const duration = Math.floor(durations[(0, absolute_src_js_1.getAbsoluteSrc)(props.src)] * fps);
|
|
36
37
|
const playbackRate = (_a = props.playbackRate) !== null && _a !== void 0 ? _a : 1;
|
|
37
38
|
const actualDuration = duration / playbackRate;
|
|
38
39
|
return ((0, jsx_runtime_1.jsx)(index_js_1.Loop, { layout: "none", durationInFrames: Math.floor(actualDuration), children: (0, jsx_runtime_1.jsx)(exports.Audio, { ...propsOtherThanLoop, ref: ref }) }));
|
|
@@ -88,12 +88,12 @@ const AudioForRenderingRefForwardingFunction = (props, ref) => {
|
|
|
88
88
|
const { current } = audioRef;
|
|
89
89
|
const didLoad = () => {
|
|
90
90
|
if (current === null || current === void 0 ? void 0 : current.duration) {
|
|
91
|
-
onDuration(src, current.duration);
|
|
91
|
+
onDuration(current.src, current.duration);
|
|
92
92
|
}
|
|
93
93
|
(0, delay_render_js_1.continueRender)(newHandle);
|
|
94
94
|
};
|
|
95
95
|
if (current === null || current === void 0 ? void 0 : current.duration) {
|
|
96
|
-
onDuration(src, current.duration);
|
|
96
|
+
onDuration(current.src, current.duration);
|
|
97
97
|
(0, delay_render_js_1.continueRender)(newHandle);
|
|
98
98
|
}
|
|
99
99
|
else {
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "3.3.
|
|
1
|
+
export declare const VERSION = "3.3.98";
|
package/dist/cjs/version.js
CHANGED
package/dist/cjs/video/Video.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Video = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
+
const absolute_src_js_1 = require("../absolute-src.js");
|
|
6
7
|
const get_environment_js_1 = require("../get-environment.js");
|
|
7
8
|
const index_js_1 = require("../loop/index.js");
|
|
8
9
|
const Sequence_js_1 = require("../Sequence.js");
|
|
@@ -28,8 +29,8 @@ const VideoForwardingFunction = (props, ref) => {
|
|
|
28
29
|
const onDuration = (0, react_1.useCallback)((src, durationInSeconds) => {
|
|
29
30
|
setDurations({ type: 'got-duration', durationInSeconds, src });
|
|
30
31
|
}, [setDurations]);
|
|
31
|
-
if (loop && props.src && durations[props.src] !== undefined) {
|
|
32
|
-
const naturalDuration = durations[props.src] * fps;
|
|
32
|
+
if (loop && props.src && durations[(0, absolute_src_js_1.getAbsoluteSrc)(props.src)] !== undefined) {
|
|
33
|
+
const naturalDuration = durations[(0, absolute_src_js_1.getAbsoluteSrc)(props.src)] * fps;
|
|
33
34
|
const playbackRate = (_a = props.playbackRate) !== null && _a !== void 0 ? _a : 1;
|
|
34
35
|
const durationInFrames = Math.floor(naturalDuration / playbackRate);
|
|
35
36
|
return ((0, jsx_runtime_1.jsx)(index_js_1.Loop, { durationInFrames: durationInFrames, children: (0, jsx_runtime_1.jsx)(exports.Video, { ...propsOtherThanLoop, ref: ref }) }));
|
|
@@ -3,12 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.DurationsContextProvider = exports.DurationsContext = exports.durationReducer = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
+
const absolute_src_js_1 = require("../absolute-src.js");
|
|
6
7
|
const durationReducer = (state, action) => {
|
|
7
8
|
switch (action.type) {
|
|
8
9
|
case 'got-duration':
|
|
9
10
|
return {
|
|
10
11
|
...state,
|
|
11
|
-
[action.src]: action.durationInSeconds,
|
|
12
|
+
[(0, absolute_src_js_1.getAbsoluteSrc)(action.src)]: action.durationInSeconds,
|
|
12
13
|
};
|
|
13
14
|
default:
|
|
14
15
|
return state;
|
package/dist/esm/index.mjs
CHANGED
|
@@ -58,7 +58,7 @@ function truthy(value) {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
// Automatically generated on publish
|
|
61
|
-
const VERSION = '3.3.
|
|
61
|
+
const VERSION = '3.3.98';
|
|
62
62
|
|
|
63
63
|
const checkMultipleRemotionVersions = () => {
|
|
64
64
|
if (typeof globalThis === 'undefined') {
|
|
@@ -131,6 +131,10 @@ const AbsoluteFillRefForwarding = (props, ref) => {
|
|
|
131
131
|
*/
|
|
132
132
|
const AbsoluteFill = forwardRef(AbsoluteFillRefForwarding);
|
|
133
133
|
|
|
134
|
+
const getAbsoluteSrc = (relativeSrc) => {
|
|
135
|
+
return new URL(relativeSrc, window.location.origin).href;
|
|
136
|
+
};
|
|
137
|
+
|
|
134
138
|
const getRemotionEnvironment = () => {
|
|
135
139
|
if (process.env.NODE_ENV === 'production') {
|
|
136
140
|
if (typeof window !== 'undefined' && window.remotion_isPlayer) {
|
|
@@ -907,7 +911,7 @@ const durationReducer = (state, action) => {
|
|
|
907
911
|
case 'got-duration':
|
|
908
912
|
return {
|
|
909
913
|
...state,
|
|
910
|
-
[action.src]: action.durationInSeconds,
|
|
914
|
+
[getAbsoluteSrc(action.src)]: action.durationInSeconds,
|
|
911
915
|
};
|
|
912
916
|
default:
|
|
913
917
|
return state;
|
|
@@ -1706,10 +1710,6 @@ const AudioForDevelopmentForwardRefFunction = (props, ref) => {
|
|
|
1706
1710
|
};
|
|
1707
1711
|
const AudioForDevelopment = forwardRef(AudioForDevelopmentForwardRefFunction);
|
|
1708
1712
|
|
|
1709
|
-
const getAbsoluteSrc = (relativeSrc) => {
|
|
1710
|
-
return new URL(relativeSrc, window.location.origin).href;
|
|
1711
|
-
};
|
|
1712
|
-
|
|
1713
1713
|
if (typeof window !== 'undefined') {
|
|
1714
1714
|
window.ready = false;
|
|
1715
1715
|
}
|
|
@@ -1856,12 +1856,12 @@ const AudioForRenderingRefForwardingFunction = (props, ref) => {
|
|
|
1856
1856
|
const { current } = audioRef;
|
|
1857
1857
|
const didLoad = () => {
|
|
1858
1858
|
if (current === null || current === void 0 ? void 0 : current.duration) {
|
|
1859
|
-
onDuration(src, current.duration);
|
|
1859
|
+
onDuration(current.src, current.duration);
|
|
1860
1860
|
}
|
|
1861
1861
|
continueRender(newHandle);
|
|
1862
1862
|
};
|
|
1863
1863
|
if (current === null || current === void 0 ? void 0 : current.duration) {
|
|
1864
|
-
onDuration(src, current.duration);
|
|
1864
|
+
onDuration(current.src, current.duration);
|
|
1865
1865
|
continueRender(newHandle);
|
|
1866
1866
|
}
|
|
1867
1867
|
else {
|
|
@@ -1896,8 +1896,8 @@ const AudioRefForwardingFunction = (props, ref) => {
|
|
|
1896
1896
|
const onDuration = useCallback((src, durationInSeconds) => {
|
|
1897
1897
|
setDurations({ type: 'got-duration', durationInSeconds, src });
|
|
1898
1898
|
}, [setDurations]);
|
|
1899
|
-
if (loop && props.src && durations[props.src] !== undefined) {
|
|
1900
|
-
const duration = Math.floor(durations[props.src] * fps);
|
|
1899
|
+
if (loop && props.src && durations[getAbsoluteSrc(props.src)] !== undefined) {
|
|
1900
|
+
const duration = Math.floor(durations[getAbsoluteSrc(props.src)] * fps);
|
|
1901
1901
|
const playbackRate = (_a = props.playbackRate) !== null && _a !== void 0 ? _a : 1;
|
|
1902
1902
|
const actualDuration = duration / playbackRate;
|
|
1903
1903
|
return (jsx(Loop, { layout: "none", durationInFrames: Math.floor(actualDuration), children: jsx(Audio, { ...propsOtherThanLoop, ref: ref }) }));
|
|
@@ -2882,35 +2882,38 @@ const ImgRefForwarding = ({ onError, maxRetries = 2, src, ...props }, ref) => {
|
|
|
2882
2882
|
}
|
|
2883
2883
|
console.error('Error loading image with src:', (_l = imageRef.current) === null || _l === void 0 ? void 0 : _l.src, e, 'Handle the event using the onError() prop to make this message disappear.');
|
|
2884
2884
|
}, [maxRetries, onError, retryIn]);
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
const { current } = imageRef;
|
|
2891
|
-
const onComplete = () => {
|
|
2892
|
-
var _a, _b, _c, _d;
|
|
2893
|
-
if (((_b = errors.current[(_a = imageRef.current) === null || _a === void 0 ? void 0 : _a.src]) !== null && _b !== void 0 ? _b : 0) > 0) {
|
|
2894
|
-
delete errors.current[(_c = imageRef.current) === null || _c === void 0 ? void 0 : _c.src];
|
|
2895
|
-
console.info(`Retry successful - ${(_d = imageRef.current) === null || _d === void 0 ? void 0 : _d.src} is now loaded`);
|
|
2885
|
+
if (typeof window !== 'undefined') {
|
|
2886
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
2887
|
+
useLayoutEffect(() => {
|
|
2888
|
+
if (process.env.NODE_ENV === 'test') {
|
|
2889
|
+
return;
|
|
2896
2890
|
}
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
current === null || current === void 0 ? void 0 : current.
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2891
|
+
const newHandle = delayRender('Loading <Img> with src=' + src);
|
|
2892
|
+
const { current } = imageRef;
|
|
2893
|
+
const onComplete = () => {
|
|
2894
|
+
var _a, _b, _c, _d;
|
|
2895
|
+
if (((_b = errors.current[(_a = imageRef.current) === null || _a === void 0 ? void 0 : _a.src]) !== null && _b !== void 0 ? _b : 0) > 0) {
|
|
2896
|
+
delete errors.current[(_c = imageRef.current) === null || _c === void 0 ? void 0 : _c.src];
|
|
2897
|
+
console.info(`Retry successful - ${(_d = imageRef.current) === null || _d === void 0 ? void 0 : _d.src} is now loaded`);
|
|
2898
|
+
}
|
|
2899
|
+
continueRender(newHandle);
|
|
2900
|
+
};
|
|
2901
|
+
const didLoad = () => {
|
|
2902
|
+
onComplete();
|
|
2903
|
+
};
|
|
2904
|
+
if (current === null || current === void 0 ? void 0 : current.complete) {
|
|
2905
|
+
onComplete();
|
|
2906
|
+
}
|
|
2907
|
+
else {
|
|
2908
|
+
current === null || current === void 0 ? void 0 : current.addEventListener('load', didLoad, { once: true });
|
|
2909
|
+
}
|
|
2910
|
+
// If tag gets unmounted, clear pending handles because image is not going to load
|
|
2911
|
+
return () => {
|
|
2912
|
+
current === null || current === void 0 ? void 0 : current.removeEventListener('load', didLoad);
|
|
2913
|
+
continueRender(newHandle);
|
|
2914
|
+
};
|
|
2915
|
+
}, [src]);
|
|
2916
|
+
}
|
|
2914
2917
|
return (jsx("img", { ...props, ref: imageRef, src: actualSrc, onError: didGetError }));
|
|
2915
2918
|
};
|
|
2916
2919
|
/**
|
|
@@ -4165,8 +4168,8 @@ const VideoForwardingFunction = (props, ref) => {
|
|
|
4165
4168
|
const onDuration = useCallback((src, durationInSeconds) => {
|
|
4166
4169
|
setDurations({ type: 'got-duration', durationInSeconds, src });
|
|
4167
4170
|
}, [setDurations]);
|
|
4168
|
-
if (loop && props.src && durations[props.src] !== undefined) {
|
|
4169
|
-
const naturalDuration = durations[props.src] * fps;
|
|
4171
|
+
if (loop && props.src && durations[getAbsoluteSrc(props.src)] !== undefined) {
|
|
4172
|
+
const naturalDuration = durations[getAbsoluteSrc(props.src)] * fps;
|
|
4170
4173
|
const playbackRate = (_a = props.playbackRate) !== null && _a !== void 0 ? _a : 1;
|
|
4171
4174
|
const durationInFrames = Math.floor(naturalDuration / playbackRate);
|
|
4172
4175
|
return (jsx(Loop, { durationInFrames: durationInFrames, children: jsx(Video, { ...propsOtherThanLoop, ref: ref }) }));
|
package/dist/esm/version.mjs
CHANGED