remotion 3.2.21 → 3.2.23
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/.turbo/turbo-build.log +5 -5
- package/dist/Img.js +30 -24
- package/dist/RemotionRoot.js +5 -4
- package/dist/audio/AudioForDevelopment.js +12 -9
- package/dist/audio/AudioForRendering.js +1 -1
- package/dist/config.d.ts +8 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -1
- package/dist/internals.d.ts +3 -0
- package/dist/internals.js +2 -0
- package/dist/prefetch-state.d.ts +13 -0
- package/dist/prefetch-state.js +26 -0
- package/dist/prefetch.d.ts +7 -0
- package/dist/prefetch.js +86 -0
- package/dist/preload-state.d.ts +13 -0
- package/dist/preload-state.js +26 -0
- package/dist/preload.d.ts +7 -0
- package/dist/preload.js +86 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/video/VideoForDevelopment.js +9 -7
- package/dist/video/VideoForRendering.js +1 -1
- package/ensure-correct-version.js +1 -1
- package/package.json +2 -2
- package/.turbo/turbo-lint.log +0 -11
- package/.turbo/turbo-test.log +0 -405
- package/dist/compress-assets.d.ts +0 -7
- package/dist/compress-assets.js +0 -25
- package/dist/config/browser-executable.d.ts +0 -3
- package/dist/config/browser-executable.js +0 -12
- package/dist/config/browser.d.ts +0 -4
- package/dist/config/browser.js +0 -19
- package/dist/config/chromium-flags.d.ts +0 -10
- package/dist/config/chromium-flags.js +0 -34
- package/dist/config/codec.d.ts +0 -16
- package/dist/config/codec.js +0 -109
- package/dist/config/concurrency.d.ts +0 -3
- package/dist/config/concurrency.js +0 -12
- package/dist/config/crf.d.ts +0 -9
- package/dist/config/crf.js +0 -83
- package/dist/config/env-file.d.ts +0 -2
- package/dist/config/env-file.js +0 -10
- package/dist/config/every-nth-frame.d.ts +0 -3
- package/dist/config/every-nth-frame.js +0 -20
- package/dist/config/ffmpeg-executable.d.ts +0 -5
- package/dist/config/ffmpeg-executable.js +0 -21
- package/dist/config/frame-range.d.ts +0 -5
- package/dist/config/frame-range.js +0 -80
- package/dist/config/image-format.d.ts +0 -8
- package/dist/config/image-format.js +0 -37
- package/dist/config/image-sequence.d.ts +0 -3
- package/dist/config/image-sequence.js +0 -15
- package/dist/config/index.d.ts +0 -178
- package/dist/config/index.js +0 -193
- package/dist/config/log.d.ts +0 -7
- package/dist/config/log.js +0 -25
- package/dist/config/max-timeline-tracks.d.ts +0 -2
- package/dist/config/max-timeline-tracks.js +0 -24
- package/dist/config/number-of-gif-loops.d.ts +0 -4
- package/dist/config/number-of-gif-loops.js +0 -21
- package/dist/config/override-webpack.d.ts +0 -6
- package/dist/config/override-webpack.js +0 -14
- package/dist/config/overwrite.d.ts +0 -3
- package/dist/config/overwrite.js +0 -14
- package/dist/config/pixel-format.d.ts +0 -8
- package/dist/config/pixel-format.js +0 -38
- package/dist/config/preview-server.d.ts +0 -2
- package/dist/config/preview-server.js +0 -20
- package/dist/config/prores-profile.d.ts +0 -7
- package/dist/config/prores-profile.js +0 -32
- package/dist/config/quality.d.ts +0 -2
- package/dist/config/quality.js +0 -17
- package/dist/config/scale.d.ts +0 -3
- package/dist/config/scale.js +0 -15
- package/dist/config/still-frame.d.ts +0 -2
- package/dist/config/still-frame.js +0 -12
- package/dist/config/timeout.d.ts +0 -2
- package/dist/config/timeout.js +0 -17
- package/dist/config/webpack-caching.d.ts +0 -3
- package/dist/config/webpack-caching.js +0 -16
- package/dist/feature-flags.d.ts +0 -1
- package/dist/feature-flags.js +0 -7
- package/dist/is-audio-codec.d.ts +0 -2
- package/dist/is-audio-codec.js +0 -7
- package/dist/perf/index.d.ts +0 -5
- package/dist/perf/index.js +0 -35
- package/dist/timeline-inout-position-state.d.ts +0 -12
- package/dist/timeline-inout-position-state.js +0 -23
- package/dist/timeout.d.ts +0 -2
- package/dist/timeout.js +0 -12
- package/dist/validation/validate-every-nth-frame.d.ts +0 -1
- package/dist/validation/validate-every-nth-frame.js +0 -21
- package/dist/validation/validate-frame.d.ts +0 -1
- package/dist/validation/validate-frame.js +0 -24
- package/dist/validation/validate-image-format.d.ts +0 -2
- package/dist/validation/validate-image-format.js +0 -9
- package/dist/validation/validate-opengl-renderer.d.ts +0 -4
- package/dist/validation/validate-opengl-renderer.js +0 -14
- package/dist/validation/validate-quality.d.ts +0 -1
- package/dist/validation/validate-quality.js +0 -21
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
[
|
|
2
|
-
[
|
|
3
|
-
[
|
|
4
|
-
[
|
|
5
|
-
[
|
|
1
|
+
[32mremotion:build: [0mcache hit, replaying output [2m5f33f3b98314bbe2[0m
|
|
2
|
+
[32mremotion:build: [0m
|
|
3
|
+
[32mremotion:build: [0m> remotion@3.2.22 build /Users/jonathanburger/remotion/packages/core
|
|
4
|
+
[32mremotion:build: [0m> tsc -d
|
|
5
|
+
[32mremotion:build: [0m
|
package/dist/Img.js
CHANGED
|
@@ -4,11 +4,14 @@ exports.Img = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const delay_render_1 = require("./delay-render");
|
|
7
|
-
const
|
|
7
|
+
const get_environment_1 = require("./get-environment");
|
|
8
|
+
const prefetch_1 = require("./prefetch");
|
|
9
|
+
const ImgRefForwarding = ({ onError, src, ...props }, ref) => {
|
|
8
10
|
const imageRef = (0, react_1.useRef)(null);
|
|
9
11
|
(0, react_1.useImperativeHandle)(ref, () => {
|
|
10
12
|
return imageRef.current;
|
|
11
|
-
});
|
|
13
|
+
}, []);
|
|
14
|
+
const actualSrc = (0, prefetch_1.usePreload)(src);
|
|
12
15
|
const didGetError = (0, react_1.useCallback)((e) => {
|
|
13
16
|
var _a;
|
|
14
17
|
if (onError) {
|
|
@@ -19,27 +22,30 @@ const ImgRefForwarding = ({ onError, ...props }, ref) => {
|
|
|
19
22
|
}
|
|
20
23
|
}, [onError]);
|
|
21
24
|
// If image source switches, make new handle
|
|
22
|
-
(0,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
25
|
+
if ((0, get_environment_1.getRemotionEnvironment)() === 'rendering') {
|
|
26
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
27
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
28
|
+
if (process.env.NODE_ENV === 'test') {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const newHandle = (0, delay_render_1.delayRender)('Loading <Img> with src=' + src);
|
|
32
|
+
const { current } = imageRef;
|
|
33
|
+
const didLoad = () => {
|
|
34
|
+
(0, delay_render_1.continueRender)(newHandle);
|
|
35
|
+
};
|
|
36
|
+
if (current === null || current === void 0 ? void 0 : current.complete) {
|
|
37
|
+
(0, delay_render_1.continueRender)(newHandle);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
current === null || current === void 0 ? void 0 : current.addEventListener('load', didLoad, { once: true });
|
|
41
|
+
}
|
|
42
|
+
// If tag gets unmounted, clear pending handles because image is not going to load
|
|
43
|
+
return () => {
|
|
44
|
+
current === null || current === void 0 ? void 0 : current.removeEventListener('load', didLoad);
|
|
45
|
+
(0, delay_render_1.continueRender)(newHandle);
|
|
46
|
+
};
|
|
47
|
+
}, [src]);
|
|
48
|
+
}
|
|
49
|
+
return ((0, jsx_runtime_1.jsx)("img", { ...props, ref: imageRef, src: actualSrc, onError: didGetError }));
|
|
44
50
|
};
|
|
45
51
|
exports.Img = (0, react_1.forwardRef)(ImgRefForwarding);
|
package/dist/RemotionRoot.js
CHANGED
|
@@ -7,6 +7,7 @@ const shared_audio_tags_1 = require("./audio/shared-audio-tags");
|
|
|
7
7
|
const CompositionManager_1 = require("./CompositionManager");
|
|
8
8
|
const delay_render_1 = require("./delay-render");
|
|
9
9
|
const nonce_1 = require("./nonce");
|
|
10
|
+
const prefetch_state_1 = require("./prefetch-state");
|
|
10
11
|
const random_1 = require("./random");
|
|
11
12
|
const timeline_position_state_1 = require("./timeline-position-state");
|
|
12
13
|
const RemotionRoot = ({ children }) => {
|
|
@@ -61,10 +62,10 @@ const RemotionRoot = ({ children }) => {
|
|
|
61
62
|
});
|
|
62
63
|
}
|
|
63
64
|
}, []);
|
|
64
|
-
return ((0, jsx_runtime_1.jsx)(nonce_1.NonceContext.Provider, { value: nonceContext, children: (0, jsx_runtime_1.jsx)(timeline_position_state_1.TimelineContext.Provider, { value: timelineContextValue, children: (0, jsx_runtime_1.jsx)(timeline_position_state_1.SetTimelineContext.Provider, { value: setTimelineContextValue, children: (0, jsx_runtime_1.jsx)(CompositionManager_1.CompositionManagerProvider, { children: (0, jsx_runtime_1.jsx)(shared_audio_tags_1.SharedAudioContextProvider
|
|
65
|
-
// In the preview, which is mostly played on Desktop, we opt out of the autoplay policy fix as described in https://github.com/remotion-dev/remotion/pull/554, as it mostly applies to mobile.
|
|
66
|
-
, {
|
|
65
|
+
return ((0, jsx_runtime_1.jsx)(nonce_1.NonceContext.Provider, { value: nonceContext, children: (0, jsx_runtime_1.jsx)(timeline_position_state_1.TimelineContext.Provider, { value: timelineContextValue, children: (0, jsx_runtime_1.jsx)(timeline_position_state_1.SetTimelineContext.Provider, { value: setTimelineContextValue, children: (0, jsx_runtime_1.jsx)(prefetch_state_1.PrefetchProvider, { children: (0, jsx_runtime_1.jsx)(CompositionManager_1.CompositionManagerProvider, { children: (0, jsx_runtime_1.jsx)(shared_audio_tags_1.SharedAudioContextProvider
|
|
67
66
|
// In the preview, which is mostly played on Desktop, we opt out of the autoplay policy fix as described in https://github.com/remotion-dev/remotion/pull/554, as it mostly applies to mobile.
|
|
68
|
-
|
|
67
|
+
, {
|
|
68
|
+
// In the preview, which is mostly played on Desktop, we opt out of the autoplay policy fix as described in https://github.com/remotion-dev/remotion/pull/554, as it mostly applies to mobile.
|
|
69
|
+
numberOfAudioTags: 0, children: children }) }) }) }) }) }));
|
|
69
70
|
};
|
|
70
71
|
exports.RemotionRoot = RemotionRoot;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.AudioForDevelopment = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
+
const prefetch_1 = require("../prefetch");
|
|
6
7
|
const random_1 = require("../random");
|
|
7
8
|
const Sequence_1 = require("../Sequence");
|
|
8
9
|
const use_media_in_timeline_1 = require("../use-media-in-timeline");
|
|
@@ -20,20 +21,22 @@ const AudioForDevelopmentForwardRefFunction = (props, ref) => {
|
|
|
20
21
|
const [mediaVolume] = (0, volume_position_state_1.useMediaVolumeState)();
|
|
21
22
|
const [mediaMuted] = (0, volume_position_state_1.useMediaMutedState)();
|
|
22
23
|
const volumePropFrame = (0, use_audio_frame_1.useFrameForVolumeProp)();
|
|
23
|
-
const { volume, muted, playbackRate, shouldPreMountAudioTags, ...nativeProps } = props;
|
|
24
|
+
const { volume, muted, playbackRate, shouldPreMountAudioTags, src, ...nativeProps } = props;
|
|
25
|
+
if (!src) {
|
|
26
|
+
throw new TypeError("No 'src' was passed to <Audio>.");
|
|
27
|
+
}
|
|
28
|
+
const preloadedSrc = (0, prefetch_1.usePreload)(src);
|
|
24
29
|
const propsToPass = (0, react_1.useMemo)(() => {
|
|
25
30
|
return {
|
|
26
31
|
muted: muted || mediaMuted,
|
|
32
|
+
src: preloadedSrc,
|
|
27
33
|
...nativeProps,
|
|
28
34
|
};
|
|
29
|
-
}, [mediaMuted, muted, nativeProps]);
|
|
35
|
+
}, [mediaMuted, muted, nativeProps, preloadedSrc]);
|
|
30
36
|
const sequenceContext = (0, react_1.useContext)(Sequence_1.SequenceContext);
|
|
31
37
|
// Generate a string that's as unique as possible for this asset
|
|
32
38
|
// but at the same time deterministic. We use it to combat strict mode issues.
|
|
33
|
-
const id = (0, react_1.useMemo)(() => {
|
|
34
|
-
var _a;
|
|
35
|
-
return `audio-${(0, random_1.random)((_a = props.src) !== null && _a !== void 0 ? _a : '')}-${sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.relativeFrom}-${sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.cumulatedFrom}-${sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.durationInFrames}-muted:${props.muted}`;
|
|
36
|
-
}, [props.muted, props.src, sequenceContext]);
|
|
39
|
+
const id = (0, react_1.useMemo)(() => `audio-${(0, random_1.random)(src !== null && src !== void 0 ? src : '')}-${sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.relativeFrom}-${sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.cumulatedFrom}-${sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.durationInFrames}-muted:${props.muted}`, [props.muted, src, sequenceContext]);
|
|
37
40
|
const audioRef = (0, shared_audio_tags_1.useSharedAudio)(propsToPass, id).el;
|
|
38
41
|
const actualVolume = (0, use_media_tag_volume_1.useMediaTagVolume)(audioRef);
|
|
39
42
|
(0, use_sync_volume_with_media_tag_1.useSyncVolumeWithMediaTag)({
|
|
@@ -47,19 +50,19 @@ const AudioForDevelopmentForwardRefFunction = (props, ref) => {
|
|
|
47
50
|
volume,
|
|
48
51
|
mediaVolume,
|
|
49
52
|
mediaRef: audioRef,
|
|
50
|
-
src
|
|
53
|
+
src,
|
|
51
54
|
mediaType: 'audio',
|
|
52
55
|
});
|
|
53
56
|
(0, use_media_playback_1.useMediaPlayback)({
|
|
54
57
|
mediaRef: audioRef,
|
|
55
|
-
src
|
|
58
|
+
src,
|
|
56
59
|
mediaType: 'audio',
|
|
57
60
|
playbackRate: playbackRate !== null && playbackRate !== void 0 ? playbackRate : 1,
|
|
58
61
|
onlyWarnForMediaSeekingError: false,
|
|
59
62
|
});
|
|
60
63
|
(0, react_1.useImperativeHandle)(ref, () => {
|
|
61
64
|
return audioRef.current;
|
|
62
|
-
});
|
|
65
|
+
}, [audioRef]);
|
|
63
66
|
if (initialShouldPreMountAudioElements) {
|
|
64
67
|
return null;
|
|
65
68
|
}
|
package/dist/config.d.ts
CHANGED
|
@@ -203,6 +203,14 @@ export declare type ConfigType = {
|
|
|
203
203
|
* See https://avpres.net/FFmpeg/im_ProRes.html for meaning of possible values.
|
|
204
204
|
*/
|
|
205
205
|
readonly setProResProfile: (profile: '4444-xq' | '4444' | 'hq' | 'standard' | 'light' | 'proxy' | undefined) => void;
|
|
206
|
+
/**
|
|
207
|
+
* Override the arguments that Remotion passes to FFMPEG.
|
|
208
|
+
* Consult https://remotion.dev/docs/renderer/render-media#ffmpegoverride before using this feature.
|
|
209
|
+
*/
|
|
210
|
+
readonly overrideFfmpegCommand: (command: (info: {
|
|
211
|
+
type: 'pre-stitcher' | 'stitcher';
|
|
212
|
+
args: string[];
|
|
213
|
+
}) => string[]) => void;
|
|
206
214
|
};
|
|
207
215
|
};
|
|
208
216
|
export type { Concurrency, WebpackConfiguration, WebpackOverrideFn };
|
package/dist/index.d.ts
CHANGED
|
@@ -56,6 +56,7 @@ export * from './internals';
|
|
|
56
56
|
export * from './interpolate';
|
|
57
57
|
export { interpolateColors } from './interpolate-colors';
|
|
58
58
|
export { Loop } from './loop';
|
|
59
|
+
export { prefetch } from './prefetch';
|
|
59
60
|
export * from './random';
|
|
60
61
|
export { registerRoot } from './register-root';
|
|
61
62
|
export { Sequence } from './Sequence';
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.useCurrentFrame = exports.staticFile = exports.Series = exports.Sequence = exports.registerRoot = exports.Loop = exports.interpolateColors = exports.getInputProps = exports.Config = void 0;
|
|
17
|
+
exports.useCurrentFrame = exports.staticFile = exports.Series = exports.Sequence = exports.registerRoot = exports.prefetch = exports.Loop = exports.interpolateColors = exports.getInputProps = exports.Config = void 0;
|
|
18
18
|
require("./asset-types");
|
|
19
19
|
const multiple_versions_warning_1 = require("./multiple-versions-warning");
|
|
20
20
|
(0, multiple_versions_warning_1.checkMultipleRemotionVersions)();
|
|
@@ -37,6 +37,8 @@ var interpolate_colors_1 = require("./interpolate-colors");
|
|
|
37
37
|
Object.defineProperty(exports, "interpolateColors", { enumerable: true, get: function () { return interpolate_colors_1.interpolateColors; } });
|
|
38
38
|
var loop_1 = require("./loop");
|
|
39
39
|
Object.defineProperty(exports, "Loop", { enumerable: true, get: function () { return loop_1.Loop; } });
|
|
40
|
+
var prefetch_1 = require("./prefetch");
|
|
41
|
+
Object.defineProperty(exports, "prefetch", { enumerable: true, get: function () { return prefetch_1.prefetch; } });
|
|
40
42
|
__exportStar(require("./random"), exports);
|
|
41
43
|
var register_root_1 = require("./register-root");
|
|
42
44
|
Object.defineProperty(exports, "registerRoot", { enumerable: true, get: function () { return register_root_1.registerRoot; } });
|
package/dist/internals.d.ts
CHANGED
|
@@ -79,6 +79,9 @@ export declare const Internals: {
|
|
|
79
79
|
}>;
|
|
80
80
|
CanUseRemotionHooks: import("react").Context<boolean>;
|
|
81
81
|
enableLegacyRemotionConfig: () => void;
|
|
82
|
+
PrefetchProvider: import("react").FC<{
|
|
83
|
+
children: import("react").ReactNode;
|
|
84
|
+
}>;
|
|
82
85
|
};
|
|
83
86
|
declare type WebpackConfiguration = Configuration;
|
|
84
87
|
declare type WebpackOverrideFn = (currentConfiguration: WebpackConfiguration) => WebpackConfiguration;
|
package/dist/internals.js
CHANGED
|
@@ -33,6 +33,7 @@ const delay_render_1 = require("./delay-render");
|
|
|
33
33
|
const get_environment_1 = require("./get-environment");
|
|
34
34
|
const get_preview_dom_element_1 = require("./get-preview-dom-element");
|
|
35
35
|
const portal_node_1 = require("./portal-node");
|
|
36
|
+
const prefetch_state_1 = require("./prefetch-state");
|
|
36
37
|
const register_root_1 = require("./register-root");
|
|
37
38
|
const RemotionRoot_1 = require("./RemotionRoot");
|
|
38
39
|
const Sequence_1 = require("./Sequence");
|
|
@@ -88,4 +89,5 @@ exports.Internals = {
|
|
|
88
89
|
CanUseRemotionHooksProvider: CanUseRemotionHooks_1.CanUseRemotionHooksProvider,
|
|
89
90
|
CanUseRemotionHooks: CanUseRemotionHooks_1.CanUseRemotionHooks,
|
|
90
91
|
enableLegacyRemotionConfig: config_1.enableLegacyRemotionConfig,
|
|
92
|
+
PrefetchProvider: prefetch_state_1.PrefetchProvider,
|
|
91
93
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare type Value = {
|
|
3
|
+
preloads: Record<string, string>;
|
|
4
|
+
setPreloads: React.Dispatch<React.SetStateAction<Record<string, string>>>;
|
|
5
|
+
};
|
|
6
|
+
export declare const preloadRef: React.RefObject<{
|
|
7
|
+
setPreloads: React.Dispatch<React.SetStateAction<Record<string, string>>>;
|
|
8
|
+
}>;
|
|
9
|
+
export declare const PreloadContext: React.Context<Value>;
|
|
10
|
+
export declare const PrefetchProvider: React.FC<{
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
}>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PrefetchProvider = exports.PreloadContext = exports.preloadRef = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
exports.preloadRef = (0, react_1.createRef)();
|
|
7
|
+
exports.PreloadContext = (0, react_1.createContext)({
|
|
8
|
+
preloads: {},
|
|
9
|
+
setPreloads: () => undefined,
|
|
10
|
+
});
|
|
11
|
+
const PrefetchProvider = ({ children }) => {
|
|
12
|
+
const [preloads, setPreloads] = (0, react_1.useState)({});
|
|
13
|
+
const value = (0, react_1.useMemo)(() => {
|
|
14
|
+
return {
|
|
15
|
+
preloads,
|
|
16
|
+
setPreloads,
|
|
17
|
+
};
|
|
18
|
+
}, [preloads]);
|
|
19
|
+
(0, react_1.useImperativeHandle)(exports.preloadRef, () => {
|
|
20
|
+
return {
|
|
21
|
+
setPreloads,
|
|
22
|
+
};
|
|
23
|
+
}, []);
|
|
24
|
+
return ((0, jsx_runtime_1.jsx)(exports.PreloadContext.Provider, { value: value, children: children }));
|
|
25
|
+
};
|
|
26
|
+
exports.PrefetchProvider = PrefetchProvider;
|
package/dist/prefetch.js
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.prefetch = exports.usePreload = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const get_environment_1 = require("./get-environment");
|
|
6
|
+
const prefetch_state_1 = require("./prefetch-state");
|
|
7
|
+
const usePreload = (src) => {
|
|
8
|
+
var _a;
|
|
9
|
+
const { preloads } = (0, react_1.useContext)(prefetch_state_1.PreloadContext);
|
|
10
|
+
return (_a = preloads[src]) !== null && _a !== void 0 ? _a : src;
|
|
11
|
+
};
|
|
12
|
+
exports.usePreload = usePreload;
|
|
13
|
+
const prefetch = (src) => {
|
|
14
|
+
if ((0, get_environment_1.getRemotionEnvironment)() === 'rendering') {
|
|
15
|
+
return {
|
|
16
|
+
free: () => undefined,
|
|
17
|
+
waitUntilDone: () => Promise.resolve(src),
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
let canceled = false;
|
|
21
|
+
let objectUrl = null;
|
|
22
|
+
let resolve = () => undefined;
|
|
23
|
+
let reject = () => undefined;
|
|
24
|
+
const waitUntilDone = new Promise((res, rej) => {
|
|
25
|
+
resolve = res;
|
|
26
|
+
reject = rej;
|
|
27
|
+
});
|
|
28
|
+
const controller = new AbortController();
|
|
29
|
+
let canBeAborted = true;
|
|
30
|
+
fetch(src, {
|
|
31
|
+
signal: controller.signal,
|
|
32
|
+
})
|
|
33
|
+
.then((res) => {
|
|
34
|
+
canBeAborted = false;
|
|
35
|
+
if (canceled) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
if (!res.ok) {
|
|
39
|
+
throw new Error(`HTTP error, status = ${res.status}`);
|
|
40
|
+
}
|
|
41
|
+
return res.blob();
|
|
42
|
+
})
|
|
43
|
+
.then((buf) => {
|
|
44
|
+
var _a;
|
|
45
|
+
if (canceled) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (buf) {
|
|
49
|
+
objectUrl = URL.createObjectURL(buf);
|
|
50
|
+
(_a = prefetch_state_1.preloadRef.current) === null || _a === void 0 ? void 0 : _a.setPreloads((p) => ({
|
|
51
|
+
...p,
|
|
52
|
+
[src]: objectUrl,
|
|
53
|
+
}));
|
|
54
|
+
resolve(objectUrl);
|
|
55
|
+
}
|
|
56
|
+
})
|
|
57
|
+
.catch((err) => {
|
|
58
|
+
reject(err);
|
|
59
|
+
});
|
|
60
|
+
return {
|
|
61
|
+
free: () => {
|
|
62
|
+
var _a;
|
|
63
|
+
if (objectUrl) {
|
|
64
|
+
URL.revokeObjectURL(objectUrl);
|
|
65
|
+
(_a = prefetch_state_1.preloadRef.current) === null || _a === void 0 ? void 0 : _a.setPreloads((p) => {
|
|
66
|
+
const copy = { ...p };
|
|
67
|
+
delete copy[src];
|
|
68
|
+
return copy;
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
canceled = true;
|
|
73
|
+
if (canBeAborted) {
|
|
74
|
+
try {
|
|
75
|
+
controller.abort();
|
|
76
|
+
}
|
|
77
|
+
catch (e) { }
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
waitUntilDone: () => {
|
|
82
|
+
return waitUntilDone;
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
exports.prefetch = prefetch;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare type Value = {
|
|
3
|
+
preloads: Record<string, string>;
|
|
4
|
+
setPreloads: React.Dispatch<React.SetStateAction<Record<string, string>>>;
|
|
5
|
+
};
|
|
6
|
+
export declare const preloadRef: React.RefObject<{
|
|
7
|
+
setPreloads: React.Dispatch<React.SetStateAction<Record<string, string>>>;
|
|
8
|
+
}>;
|
|
9
|
+
export declare const PreloadContext: React.Context<Value>;
|
|
10
|
+
export declare const PreloadProvider: React.FC<{
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
}>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PreloadProvider = exports.PreloadContext = exports.preloadRef = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
exports.preloadRef = (0, react_1.createRef)();
|
|
7
|
+
exports.PreloadContext = (0, react_1.createContext)({
|
|
8
|
+
preloads: {},
|
|
9
|
+
setPreloads: () => undefined,
|
|
10
|
+
});
|
|
11
|
+
const PreloadProvider = ({ children }) => {
|
|
12
|
+
const [preloads, setPreloads] = (0, react_1.useState)({});
|
|
13
|
+
const value = (0, react_1.useMemo)(() => {
|
|
14
|
+
return {
|
|
15
|
+
preloads,
|
|
16
|
+
setPreloads,
|
|
17
|
+
};
|
|
18
|
+
}, [preloads]);
|
|
19
|
+
(0, react_1.useImperativeHandle)(exports.preloadRef, () => {
|
|
20
|
+
return {
|
|
21
|
+
setPreloads,
|
|
22
|
+
};
|
|
23
|
+
});
|
|
24
|
+
return ((0, jsx_runtime_1.jsx)(exports.PreloadContext.Provider, { value: value, children: children }));
|
|
25
|
+
};
|
|
26
|
+
exports.PreloadProvider = PreloadProvider;
|
package/dist/preload.js
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchAndPreload = exports.usePreload = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const get_environment_1 = require("./get-environment");
|
|
6
|
+
const preload_state_1 = require("./preload-state");
|
|
7
|
+
const usePreload = (src) => {
|
|
8
|
+
var _a;
|
|
9
|
+
const { preloads } = (0, react_1.useContext)(preload_state_1.PreloadContext);
|
|
10
|
+
return (_a = preloads[src]) !== null && _a !== void 0 ? _a : src;
|
|
11
|
+
};
|
|
12
|
+
exports.usePreload = usePreload;
|
|
13
|
+
const fetchAndPreload = (src) => {
|
|
14
|
+
if ((0, get_environment_1.getRemotionEnvironment)() === 'rendering') {
|
|
15
|
+
return {
|
|
16
|
+
unpreload: () => undefined,
|
|
17
|
+
waitForDone: () => Promise.resolve(src),
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
let canceled = false;
|
|
21
|
+
let objectUrl = null;
|
|
22
|
+
let resolve = () => undefined;
|
|
23
|
+
let reject = () => undefined;
|
|
24
|
+
const waitUntilDone = new Promise((res, rej) => {
|
|
25
|
+
resolve = res;
|
|
26
|
+
reject = rej;
|
|
27
|
+
});
|
|
28
|
+
const controller = new AbortController();
|
|
29
|
+
let canBeAborted = true;
|
|
30
|
+
fetch(src, {
|
|
31
|
+
signal: controller.signal,
|
|
32
|
+
})
|
|
33
|
+
.then((res) => {
|
|
34
|
+
canBeAborted = false;
|
|
35
|
+
if (canceled) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
if (!res.ok) {
|
|
39
|
+
throw new Error(`HTTP error, status = ${res.status}`);
|
|
40
|
+
}
|
|
41
|
+
return res.blob();
|
|
42
|
+
})
|
|
43
|
+
.then((buf) => {
|
|
44
|
+
var _a;
|
|
45
|
+
if (canceled) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (buf) {
|
|
49
|
+
objectUrl = URL.createObjectURL(buf);
|
|
50
|
+
(_a = preload_state_1.preloadRef.current) === null || _a === void 0 ? void 0 : _a.setPreloads((p) => ({
|
|
51
|
+
...p,
|
|
52
|
+
[src]: objectUrl,
|
|
53
|
+
}));
|
|
54
|
+
resolve(objectUrl);
|
|
55
|
+
}
|
|
56
|
+
})
|
|
57
|
+
.catch((err) => {
|
|
58
|
+
reject(err);
|
|
59
|
+
});
|
|
60
|
+
return {
|
|
61
|
+
unpreload: () => {
|
|
62
|
+
var _a;
|
|
63
|
+
if (objectUrl) {
|
|
64
|
+
URL.revokeObjectURL(objectUrl);
|
|
65
|
+
(_a = preload_state_1.preloadRef.current) === null || _a === void 0 ? void 0 : _a.setPreloads((p) => {
|
|
66
|
+
const copy = { ...p };
|
|
67
|
+
delete copy[src];
|
|
68
|
+
return copy;
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
canceled = true;
|
|
73
|
+
if (canBeAborted) {
|
|
74
|
+
try {
|
|
75
|
+
controller.abort();
|
|
76
|
+
}
|
|
77
|
+
catch (e) { }
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
waitForDone: () => {
|
|
82
|
+
return waitUntilDone;
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
exports.fetchAndPreload = fetchAndPreload;
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "3.2.
|
|
1
|
+
export declare const VERSION = "3.2.23";
|
package/dist/version.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.VideoForDevelopment = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const use_audio_frame_1 = require("../audio/use-audio-frame");
|
|
7
|
+
const prefetch_1 = require("../prefetch");
|
|
7
8
|
const use_media_in_timeline_1 = require("../use-media-in-timeline");
|
|
8
9
|
const use_media_playback_1 = require("../use-media-playback");
|
|
9
10
|
const use_media_tag_volume_1 = require("../use-media-tag-volume");
|
|
@@ -13,7 +14,7 @@ const VideoForDevelopmentRefForwardingFunction = (props, ref) => {
|
|
|
13
14
|
var _a;
|
|
14
15
|
const videoRef = (0, react_1.useRef)(null);
|
|
15
16
|
const volumePropFrame = (0, use_audio_frame_1.useFrameForVolumeProp)();
|
|
16
|
-
const { volume, muted, playbackRate, onlyWarnForMediaSeekingError, ...nativeProps } = props;
|
|
17
|
+
const { volume, muted, playbackRate, onlyWarnForMediaSeekingError, src, ...nativeProps } = props;
|
|
17
18
|
const actualVolume = (0, use_media_tag_volume_1.useMediaTagVolume)(videoRef);
|
|
18
19
|
const [mediaVolume] = (0, volume_position_state_1.useMediaVolumeState)();
|
|
19
20
|
const [mediaMuted] = (0, volume_position_state_1.useMediaMutedState)();
|
|
@@ -22,7 +23,7 @@ const VideoForDevelopmentRefForwardingFunction = (props, ref) => {
|
|
|
22
23
|
volume,
|
|
23
24
|
mediaVolume,
|
|
24
25
|
mediaType: 'video',
|
|
25
|
-
src
|
|
26
|
+
src,
|
|
26
27
|
});
|
|
27
28
|
(0, use_sync_volume_with_media_tag_1.useSyncVolumeWithMediaTag)({
|
|
28
29
|
volumePropFrame,
|
|
@@ -33,14 +34,15 @@ const VideoForDevelopmentRefForwardingFunction = (props, ref) => {
|
|
|
33
34
|
});
|
|
34
35
|
(0, use_media_playback_1.useMediaPlayback)({
|
|
35
36
|
mediaRef: videoRef,
|
|
36
|
-
src
|
|
37
|
+
src,
|
|
37
38
|
mediaType: 'video',
|
|
38
39
|
playbackRate: (_a = props.playbackRate) !== null && _a !== void 0 ? _a : 1,
|
|
39
40
|
onlyWarnForMediaSeekingError,
|
|
40
41
|
});
|
|
42
|
+
const actualSrc = (0, prefetch_1.usePreload)(src);
|
|
41
43
|
(0, react_1.useImperativeHandle)(ref, () => {
|
|
42
44
|
return videoRef.current;
|
|
43
|
-
});
|
|
45
|
+
}, []);
|
|
44
46
|
(0, react_1.useEffect)(() => {
|
|
45
47
|
const { current } = videoRef;
|
|
46
48
|
if (!current) {
|
|
@@ -50,7 +52,7 @@ const VideoForDevelopmentRefForwardingFunction = (props, ref) => {
|
|
|
50
52
|
var _a;
|
|
51
53
|
if (current === null || current === void 0 ? void 0 : current.error) {
|
|
52
54
|
console.error('Error occurred in video', current === null || current === void 0 ? void 0 : current.error);
|
|
53
|
-
throw new Error(`The browser threw an error while playing the video ${
|
|
55
|
+
throw new Error(`The browser threw an error while playing the video ${src}: Code ${current.error.code} - ${(_a = current === null || current === void 0 ? void 0 : current.error) === null || _a === void 0 ? void 0 : _a.message}. See https://remotion.dev/docs/media-playback-error for help`);
|
|
54
56
|
}
|
|
55
57
|
else {
|
|
56
58
|
throw new Error('The browser threw an error');
|
|
@@ -60,8 +62,8 @@ const VideoForDevelopmentRefForwardingFunction = (props, ref) => {
|
|
|
60
62
|
return () => {
|
|
61
63
|
current.removeEventListener('error', errorHandler);
|
|
62
64
|
};
|
|
63
|
-
}, [
|
|
64
|
-
return ((0, jsx_runtime_1.jsx)("video", { ref: videoRef, muted: muted || mediaMuted, playsInline: true, ...nativeProps }));
|
|
65
|
+
}, [src]);
|
|
66
|
+
return ((0, jsx_runtime_1.jsx)("video", { ref: videoRef, muted: muted || mediaMuted, playsInline: true, src: actualSrc, ...nativeProps }));
|
|
65
67
|
};
|
|
66
68
|
// Copy types from forwardRef but not necessary to remove ref
|
|
67
69
|
exports.VideoForDevelopment = (0, react_1.forwardRef)(VideoForDevelopmentRefForwardingFunction);
|
|
@@ -80,7 +80,7 @@ const VideoForRenderingForwardFunction = ({ onError, volume: volumeProp, playbac
|
|
|
80
80
|
]);
|
|
81
81
|
(0, react_1.useImperativeHandle)(ref, () => {
|
|
82
82
|
return videoRef.current;
|
|
83
|
-
});
|
|
83
|
+
}, []);
|
|
84
84
|
(0, react_1.useEffect)(() => {
|
|
85
85
|
if (!window.remotion_videoEnabled) {
|
|
86
86
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "remotion",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.23",
|
|
4
4
|
"description": "Render videos in React",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"publishConfig": {
|
|
55
55
|
"access": "public"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "34a407a825ded88c9058bcf0e9ec4fe04024b7ce"
|
|
58
58
|
}
|
package/.turbo/turbo-lint.log
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
[34mremotion:lint: [0mcache hit, replaying output [2ma84ebb2d28d1ea54[0m
|
|
2
|
-
[34mremotion:lint: [0m
|
|
3
|
-
[34mremotion:lint: [0m> remotion@3.2.12 lint /Users/jonathanburger/remotion/packages/core
|
|
4
|
-
[34mremotion:lint: [0m> eslint src --ext ts,tsx
|
|
5
|
-
[34mremotion:lint: [0m
|
|
6
|
-
[34mremotion:lint: [0m
|
|
7
|
-
[34mremotion:lint: [0m/Users/jonathanburger/remotion/packages/core/src/use-lazy-component.ts
|
|
8
|
-
[34mremotion:lint: [0m 10:50 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
9
|
-
[34mremotion:lint: [0m
|
|
10
|
-
[34mremotion:lint: [0m✖ 1 problem (0 errors, 1 warning)
|
|
11
|
-
[34mremotion:lint: [0m
|