remotion 3.3.97 → 3.3.99
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/internals.d.ts +0 -1
- package/dist/cjs/internals.js +0 -1
- package/dist/cjs/nonce.js +6 -0
- package/dist/cjs/setup-env-variables.d.ts +0 -1
- package/dist/cjs/setup-env-variables.js +4 -6
- 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 +52 -46
- 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/internals.d.ts
CHANGED
|
@@ -41,7 +41,6 @@ export declare const Internals: {
|
|
|
41
41
|
RemotionContextProvider: (props: import("./wrap-remotion-context.js").RemotionContextProviderProps) => JSX.Element;
|
|
42
42
|
CSSUtils: typeof CSSUtils;
|
|
43
43
|
setupEnvVariables: () => void;
|
|
44
|
-
ENV_VARIABLES_ENV_NAME: "ENV_VARIABLES";
|
|
45
44
|
MediaVolumeContext: import("react").Context<MediaVolumeContextValue>;
|
|
46
45
|
SetMediaVolumeContext: import("react").Context<SetMediaVolumeContextValue>;
|
|
47
46
|
validateDurationInFrames: ({ allowFloats, component, durationInFrames, }: {
|
package/dist/cjs/internals.js
CHANGED
|
@@ -73,7 +73,6 @@ exports.Internals = {
|
|
|
73
73
|
RemotionContextProvider: wrap_remotion_context_js_1.RemotionContextProvider,
|
|
74
74
|
CSSUtils,
|
|
75
75
|
setupEnvVariables: setup_env_variables_js_1.setupEnvVariables,
|
|
76
|
-
ENV_VARIABLES_ENV_NAME: setup_env_variables_js_1.ENV_VARIABLES_ENV_NAME,
|
|
77
76
|
MediaVolumeContext: volume_position_state_js_1.MediaVolumeContext,
|
|
78
77
|
SetMediaVolumeContext: volume_position_state_js_1.SetMediaVolumeContext,
|
|
79
78
|
validateDurationInFrames: validate_duration_in_frames_js_1.validateDurationInFrames,
|
package/dist/cjs/nonce.js
CHANGED
|
@@ -9,7 +9,13 @@ exports.NonceContext = (0, react_1.createContext)({
|
|
|
9
9
|
const useNonce = () => {
|
|
10
10
|
const context = (0, react_1.useContext)(exports.NonceContext);
|
|
11
11
|
const [nonce, setNonce] = (0, react_1.useState)(() => context.getNonce());
|
|
12
|
+
const lastContext = (0, react_1.useRef)(context);
|
|
13
|
+
// Only if context changes, but not initially
|
|
12
14
|
(0, react_1.useEffect)(() => {
|
|
15
|
+
if (lastContext.current === context) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
lastContext.current = context;
|
|
13
19
|
setNonce(context.getNonce);
|
|
14
20
|
}, [context]);
|
|
15
21
|
return nonce;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.setupEnvVariables =
|
|
3
|
+
exports.setupEnvVariables = void 0;
|
|
4
4
|
const get_environment_js_1 = require("./get-environment.js");
|
|
5
|
-
exports.ENV_VARIABLES_ENV_NAME = 'ENV_VARIABLES';
|
|
6
5
|
const getEnvVariables = () => {
|
|
7
6
|
if ((0, get_environment_js_1.getRemotionEnvironment)() === 'rendering') {
|
|
8
7
|
const param = window.remotion_envVariables;
|
|
@@ -12,11 +11,10 @@ const getEnvVariables = () => {
|
|
|
12
11
|
return { ...JSON.parse(param), NODE_ENV: process.env.NODE_ENV };
|
|
13
12
|
}
|
|
14
13
|
if ((0, get_environment_js_1.getRemotionEnvironment)() === 'preview') {
|
|
15
|
-
//
|
|
16
|
-
//
|
|
14
|
+
// For the Preview, we already set the environment variables in index-html.ts.
|
|
15
|
+
// We just add NODE_ENV here.
|
|
17
16
|
return {
|
|
18
|
-
|
|
19
|
-
NODE_ENV: process.env.NODE_ENV,
|
|
17
|
+
NODE_ENV: 'development',
|
|
20
18
|
};
|
|
21
19
|
}
|
|
22
20
|
throw new Error('Can only call getEnvVariables() if environment is `rendering` or `preview`');
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "3.3.
|
|
1
|
+
export declare const VERSION = "3.3.99";
|
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.99';
|
|
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) {
|
|
@@ -538,7 +542,13 @@ const NonceContext = createContext({
|
|
|
538
542
|
const useNonce = () => {
|
|
539
543
|
const context = useContext(NonceContext);
|
|
540
544
|
const [nonce, setNonce] = useState(() => context.getNonce());
|
|
545
|
+
const lastContext = useRef(context);
|
|
546
|
+
// Only if context changes, but not initially
|
|
541
547
|
useEffect(() => {
|
|
548
|
+
if (lastContext.current === context) {
|
|
549
|
+
return;
|
|
550
|
+
}
|
|
551
|
+
lastContext.current = context;
|
|
542
552
|
setNonce(context.getNonce);
|
|
543
553
|
}, [context]);
|
|
544
554
|
return nonce;
|
|
@@ -907,7 +917,7 @@ const durationReducer = (state, action) => {
|
|
|
907
917
|
case 'got-duration':
|
|
908
918
|
return {
|
|
909
919
|
...state,
|
|
910
|
-
[action.src]: action.durationInSeconds,
|
|
920
|
+
[getAbsoluteSrc(action.src)]: action.durationInSeconds,
|
|
911
921
|
};
|
|
912
922
|
default:
|
|
913
923
|
return state;
|
|
@@ -1706,10 +1716,6 @@ const AudioForDevelopmentForwardRefFunction = (props, ref) => {
|
|
|
1706
1716
|
};
|
|
1707
1717
|
const AudioForDevelopment = forwardRef(AudioForDevelopmentForwardRefFunction);
|
|
1708
1718
|
|
|
1709
|
-
const getAbsoluteSrc = (relativeSrc) => {
|
|
1710
|
-
return new URL(relativeSrc, window.location.origin).href;
|
|
1711
|
-
};
|
|
1712
|
-
|
|
1713
1719
|
if (typeof window !== 'undefined') {
|
|
1714
1720
|
window.ready = false;
|
|
1715
1721
|
}
|
|
@@ -1856,12 +1862,12 @@ const AudioForRenderingRefForwardingFunction = (props, ref) => {
|
|
|
1856
1862
|
const { current } = audioRef;
|
|
1857
1863
|
const didLoad = () => {
|
|
1858
1864
|
if (current === null || current === void 0 ? void 0 : current.duration) {
|
|
1859
|
-
onDuration(src, current.duration);
|
|
1865
|
+
onDuration(current.src, current.duration);
|
|
1860
1866
|
}
|
|
1861
1867
|
continueRender(newHandle);
|
|
1862
1868
|
};
|
|
1863
1869
|
if (current === null || current === void 0 ? void 0 : current.duration) {
|
|
1864
|
-
onDuration(src, current.duration);
|
|
1870
|
+
onDuration(current.src, current.duration);
|
|
1865
1871
|
continueRender(newHandle);
|
|
1866
1872
|
}
|
|
1867
1873
|
else {
|
|
@@ -1896,8 +1902,8 @@ const AudioRefForwardingFunction = (props, ref) => {
|
|
|
1896
1902
|
const onDuration = useCallback((src, durationInSeconds) => {
|
|
1897
1903
|
setDurations({ type: 'got-duration', durationInSeconds, src });
|
|
1898
1904
|
}, [setDurations]);
|
|
1899
|
-
if (loop && props.src && durations[props.src] !== undefined) {
|
|
1900
|
-
const duration = Math.floor(durations[props.src] * fps);
|
|
1905
|
+
if (loop && props.src && durations[getAbsoluteSrc(props.src)] !== undefined) {
|
|
1906
|
+
const duration = Math.floor(durations[getAbsoluteSrc(props.src)] * fps);
|
|
1901
1907
|
const playbackRate = (_a = props.playbackRate) !== null && _a !== void 0 ? _a : 1;
|
|
1902
1908
|
const actualDuration = duration / playbackRate;
|
|
1903
1909
|
return (jsx(Loop, { layout: "none", durationInFrames: Math.floor(actualDuration), children: jsx(Audio, { ...propsOtherThanLoop, ref: ref }) }));
|
|
@@ -2218,7 +2224,6 @@ const RemotionRoot = ({ children, numberOfAudioTags }) => {
|
|
|
2218
2224
|
return (jsx(NonceContext.Provider, { value: nonceContext, children: jsx(TimelineContext.Provider, { value: timelineContextValue, children: jsx(SetTimelineContext.Provider, { value: setTimelineContextValue, children: jsx(PrefetchProvider, { children: jsx(NativeLayersProvider, { children: jsx(CompositionManagerProvider, { numberOfAudioTags: numberOfAudioTags, children: jsx(DurationsContextProvider, { children: children }) }) }) }) }) }) }));
|
|
2219
2225
|
};
|
|
2220
2226
|
|
|
2221
|
-
const ENV_VARIABLES_ENV_NAME = 'ENV_VARIABLES';
|
|
2222
2227
|
const getEnvVariables = () => {
|
|
2223
2228
|
if (getRemotionEnvironment() === 'rendering') {
|
|
2224
2229
|
const param = window.remotion_envVariables;
|
|
@@ -2228,11 +2233,10 @@ const getEnvVariables = () => {
|
|
|
2228
2233
|
return { ...JSON.parse(param), NODE_ENV: process.env.NODE_ENV };
|
|
2229
2234
|
}
|
|
2230
2235
|
if (getRemotionEnvironment() === 'preview') {
|
|
2231
|
-
//
|
|
2232
|
-
//
|
|
2236
|
+
// For the Preview, we already set the environment variables in index-html.ts.
|
|
2237
|
+
// We just add NODE_ENV here.
|
|
2233
2238
|
return {
|
|
2234
|
-
|
|
2235
|
-
NODE_ENV: process.env.NODE_ENV,
|
|
2239
|
+
NODE_ENV: 'development',
|
|
2236
2240
|
};
|
|
2237
2241
|
}
|
|
2238
2242
|
throw new Error('Can only call getEnvVariables() if environment is `rendering` or `preview`');
|
|
@@ -2403,7 +2407,6 @@ const Internals = {
|
|
|
2403
2407
|
RemotionContextProvider,
|
|
2404
2408
|
CSSUtils,
|
|
2405
2409
|
setupEnvVariables,
|
|
2406
|
-
ENV_VARIABLES_ENV_NAME,
|
|
2407
2410
|
MediaVolumeContext,
|
|
2408
2411
|
SetMediaVolumeContext,
|
|
2409
2412
|
validateDurationInFrames,
|
|
@@ -2882,35 +2885,38 @@ const ImgRefForwarding = ({ onError, maxRetries = 2, src, ...props }, ref) => {
|
|
|
2882
2885
|
}
|
|
2883
2886
|
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
2887
|
}, [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`);
|
|
2888
|
+
if (typeof window !== 'undefined') {
|
|
2889
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
2890
|
+
useLayoutEffect(() => {
|
|
2891
|
+
if (process.env.NODE_ENV === 'test') {
|
|
2892
|
+
return;
|
|
2896
2893
|
}
|
|
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
|
-
|
|
2894
|
+
const newHandle = delayRender('Loading <Img> with src=' + src);
|
|
2895
|
+
const { current } = imageRef;
|
|
2896
|
+
const onComplete = () => {
|
|
2897
|
+
var _a, _b, _c, _d;
|
|
2898
|
+
if (((_b = errors.current[(_a = imageRef.current) === null || _a === void 0 ? void 0 : _a.src]) !== null && _b !== void 0 ? _b : 0) > 0) {
|
|
2899
|
+
delete errors.current[(_c = imageRef.current) === null || _c === void 0 ? void 0 : _c.src];
|
|
2900
|
+
console.info(`Retry successful - ${(_d = imageRef.current) === null || _d === void 0 ? void 0 : _d.src} is now loaded`);
|
|
2901
|
+
}
|
|
2902
|
+
continueRender(newHandle);
|
|
2903
|
+
};
|
|
2904
|
+
const didLoad = () => {
|
|
2905
|
+
onComplete();
|
|
2906
|
+
};
|
|
2907
|
+
if (current === null || current === void 0 ? void 0 : current.complete) {
|
|
2908
|
+
onComplete();
|
|
2909
|
+
}
|
|
2910
|
+
else {
|
|
2911
|
+
current === null || current === void 0 ? void 0 : current.addEventListener('load', didLoad, { once: true });
|
|
2912
|
+
}
|
|
2913
|
+
// If tag gets unmounted, clear pending handles because image is not going to load
|
|
2914
|
+
return () => {
|
|
2915
|
+
current === null || current === void 0 ? void 0 : current.removeEventListener('load', didLoad);
|
|
2916
|
+
continueRender(newHandle);
|
|
2917
|
+
};
|
|
2918
|
+
}, [src]);
|
|
2919
|
+
}
|
|
2914
2920
|
return (jsx("img", { ...props, ref: imageRef, src: actualSrc, onError: didGetError }));
|
|
2915
2921
|
};
|
|
2916
2922
|
/**
|
|
@@ -4165,8 +4171,8 @@ const VideoForwardingFunction = (props, ref) => {
|
|
|
4165
4171
|
const onDuration = useCallback((src, durationInSeconds) => {
|
|
4166
4172
|
setDurations({ type: 'got-duration', durationInSeconds, src });
|
|
4167
4173
|
}, [setDurations]);
|
|
4168
|
-
if (loop && props.src && durations[props.src] !== undefined) {
|
|
4169
|
-
const naturalDuration = durations[props.src] * fps;
|
|
4174
|
+
if (loop && props.src && durations[getAbsoluteSrc(props.src)] !== undefined) {
|
|
4175
|
+
const naturalDuration = durations[getAbsoluteSrc(props.src)] * fps;
|
|
4170
4176
|
const playbackRate = (_a = props.playbackRate) !== null && _a !== void 0 ? _a : 1;
|
|
4171
4177
|
const durationInFrames = Math.floor(naturalDuration / playbackRate);
|
|
4172
4178
|
return (jsx(Loop, { durationInFrames: durationInFrames, children: jsx(Video, { ...propsOtherThanLoop, ref: ref }) }));
|
package/dist/esm/version.mjs
CHANGED