remotion 4.0.0-fastlambda.8 → 4.0.0-lambda.3
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 +2 -2
- package/dist/AbsoluteFill.js +1 -1
- package/dist/Composition.d.ts +1 -1
- package/dist/Composition.js +30 -1
- package/dist/CompositionManager.d.ts +1 -1
- package/dist/CompositionManager.js +6 -2
- package/dist/IFrame.js +1 -1
- package/dist/Img.js +26 -21
- package/dist/RemotionRoot.js +1 -1
- package/dist/Still.js +1 -1
- package/dist/audio/Audio.js +3 -3
- package/dist/audio/AudioForDevelopment.js +1 -1
- package/dist/audio/AudioForRendering.js +1 -1
- package/dist/audio/index.js +5 -1
- package/dist/audio/shared-audio-tags.js +6 -2
- package/dist/config/bundle-out-dir.d.ts +2 -0
- package/dist/config/bundle-out-dir.js +12 -0
- package/dist/config/chromium-flags.d.ts +1 -1
- package/dist/config/every-nth-file.d.ts +2 -0
- package/dist/config/every-nth-file.js +12 -0
- package/dist/config/ffmpeg-executable.d.ts +2 -0
- package/dist/config/ffmpeg-executable.js +10 -1
- package/dist/config/index.d.ts +8 -3
- package/dist/config/index.js +7 -2
- package/dist/config/loop.d.ts +3 -0
- package/dist/config/loop.js +15 -0
- package/dist/config/override-webpack.d.ts +1 -7
- package/dist/config/public-path.d.ts +2 -0
- package/dist/config/public-path.js +12 -0
- package/dist/delay-render.d.ts +1 -1
- package/dist/freeze.js +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.js +8 -3
- package/dist/internals.d.ts +7 -5
- package/dist/internals.js +11 -4
- package/dist/loading-indicator.d.ts +2 -0
- package/dist/loading-indicator.js +35 -0
- package/dist/loop/index.js +1 -1
- package/dist/perf/index.d.ts +1 -1
- package/dist/perf/index.js +2 -0
- package/dist/portal-node.d.ts +1 -0
- package/dist/portal-node.js +23 -0
- package/dist/register-root.d.ts +1 -0
- package/dist/register-root.js +20 -5
- package/dist/sequencing/index.js +1 -1
- package/dist/series/index.js +3 -3
- package/dist/use-lazy-component.js +5 -1
- package/dist/validate-media-props.d.ts +2 -1
- package/dist/validation/validate-every-nth-frame.d.ts +1 -0
- package/dist/validation/validate-every-nth-frame.js +21 -0
- package/dist/validation/validate-opengl-renderer.d.ts +1 -1
- package/dist/validation/validate-opengl-renderer.js +1 -1
- package/dist/video/OffthreadVideo.d.ts +3 -0
- package/dist/video/OffthreadVideo.js +25 -0
- package/dist/video/OffthreadVideoForRendering.d.ts +3 -0
- package/dist/video/OffthreadVideoForRendering.js +93 -0
- package/dist/video/Video.js +3 -3
- package/dist/video/VideoForDevelopment.js +1 -1
- package/dist/video/VideoForRendering.js +5 -1
- package/dist/video/get-current-time.d.ts +5 -0
- package/dist/video/get-current-time.js +10 -2
- package/dist/video/index.d.ts +3 -2
- package/dist/video/index.js +5 -12
- package/dist/video/props.d.ts +10 -1
- package/dist/wrap-remotion-context.js +6 -2
- package/package.json +3 -3
- package/.turbo/turbo-lint.log +0 -11
- package/.turbo/turbo-test.log +0 -78
package/dist/internals.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -51,9 +55,9 @@ const delay_render_1 = require("./delay-render");
|
|
|
51
55
|
const feature_flags_1 = require("./feature-flags");
|
|
52
56
|
const get_environment_1 = require("./get-environment");
|
|
53
57
|
const get_preview_dom_element_1 = require("./get-preview-dom-element");
|
|
54
|
-
const initial_frame_1 = require("./initial-frame");
|
|
55
58
|
const is_audio_codec_1 = require("./is-audio-codec");
|
|
56
59
|
const perf = __importStar(require("./perf"));
|
|
60
|
+
const portal_node_1 = require("./portal-node");
|
|
57
61
|
const register_root_1 = require("./register-root");
|
|
58
62
|
const RemotionRoot_1 = require("./RemotionRoot");
|
|
59
63
|
const sequencing_1 = require("./sequencing");
|
|
@@ -62,6 +66,7 @@ const TimelineInOutPosition = __importStar(require("./timeline-inout-position-st
|
|
|
62
66
|
const TimelinePosition = __importStar(require("./timeline-position-state"));
|
|
63
67
|
const timeout_2 = require("./timeout");
|
|
64
68
|
const truthy_1 = require("./truthy");
|
|
69
|
+
const use_frame_1 = require("./use-frame");
|
|
65
70
|
const use_lazy_component_1 = require("./use-lazy-component");
|
|
66
71
|
const use_unsafe_video_config_1 = require("./use-unsafe-video-config");
|
|
67
72
|
const use_video_1 = require("./use-video");
|
|
@@ -88,6 +93,7 @@ exports.Internals = {
|
|
|
88
93
|
getRoot: register_root_1.getRoot,
|
|
89
94
|
getBrowserExecutable: browser_executable_1.getBrowserExecutable,
|
|
90
95
|
getCustomFfmpegExecutable: ffmpeg_executable_1.getCustomFfmpegExecutable,
|
|
96
|
+
getCustomFfprobeExecutable: ffmpeg_executable_1.getCustomFfprobeExecutable,
|
|
91
97
|
getPixelFormat: pixel_format_1.getPixelFormat,
|
|
92
98
|
getConcurrency: concurrency_1.getConcurrency,
|
|
93
99
|
getRange: frame_range_1.getRange,
|
|
@@ -125,9 +131,7 @@ exports.Internals = {
|
|
|
125
131
|
RemotionContextProvider: wrap_remotion_context_1.RemotionContextProvider,
|
|
126
132
|
CSSUtils,
|
|
127
133
|
setupEnvVariables: setup_env_variables_1.setupEnvVariables,
|
|
128
|
-
setupInitialFrame: initial_frame_1.setupInitialFrame,
|
|
129
134
|
ENV_VARIABLES_ENV_NAME: setup_env_variables_1.ENV_VARIABLES_ENV_NAME,
|
|
130
|
-
INITIAL_FRAME_LOCAL_STORAGE_KEY: initial_frame_1.INITIAL_FRAME_LOCAL_STORAGE_KEY,
|
|
131
135
|
getDotEnvLocation: env_file_1.getDotEnvLocation,
|
|
132
136
|
getServerPort: preview_server_1.getServerPort,
|
|
133
137
|
MediaVolumeContext: volume_position_state_1.MediaVolumeContext,
|
|
@@ -164,4 +168,7 @@ exports.Internals = {
|
|
|
164
168
|
getPreviewDomElement: get_preview_dom_element_1.getPreviewDomElement,
|
|
165
169
|
compositionsRef: CompositionManager_1.compositionsRef,
|
|
166
170
|
DELAY_RENDER_CALLSTACK_TOKEN: delay_render_1.DELAY_RENDER_CALLSTACK_TOKEN,
|
|
171
|
+
useAbsoluteCurrentFrame: use_frame_1.useAbsoluteCurrentFrame,
|
|
172
|
+
portalNode: portal_node_1.portalNode,
|
|
173
|
+
waitForRoot: register_root_1.waitForRoot,
|
|
167
174
|
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Loading = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const AbsoluteFill_1 = require("./AbsoluteFill");
|
|
6
|
+
const rotate = {
|
|
7
|
+
transform: `rotate(90deg)`,
|
|
8
|
+
};
|
|
9
|
+
const ICON_SIZE = 40;
|
|
10
|
+
const label = {
|
|
11
|
+
color: '#555',
|
|
12
|
+
fontSize: 14,
|
|
13
|
+
fontFamily: 'sans-serif',
|
|
14
|
+
};
|
|
15
|
+
const container = {
|
|
16
|
+
justifyContent: 'center',
|
|
17
|
+
alignItems: 'center',
|
|
18
|
+
};
|
|
19
|
+
const Loading = () => {
|
|
20
|
+
return ((0, jsx_runtime_1.jsxs)(AbsoluteFill_1.AbsoluteFill, { style: container, id: "remotion-comp-loading", children: [(0, jsx_runtime_1.jsx)("style", { type: "text/css", children: `
|
|
21
|
+
@keyframes anim {
|
|
22
|
+
from {
|
|
23
|
+
opacity: 0
|
|
24
|
+
}
|
|
25
|
+
to {
|
|
26
|
+
opacity: 1
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
#remotion-comp-loading {
|
|
30
|
+
animation: anim 2s;
|
|
31
|
+
animation-fill-mode: forwards;
|
|
32
|
+
}
|
|
33
|
+
` }), (0, jsx_runtime_1.jsx)("svg", { width: ICON_SIZE, height: ICON_SIZE, viewBox: "-100 -100 400 400", style: rotate, children: (0, jsx_runtime_1.jsx)("path", { fill: "#555", stroke: "#555", strokeWidth: "100", strokeLinejoin: "round", d: "M 2 172 a 196 100 0 0 0 195 5 A 196 240 0 0 0 100 2.259 A 196 240 0 0 0 2 172 z" }) }), (0, jsx_runtime_1.jsx)("p", { style: label, children: "Loading..." })] }));
|
|
34
|
+
};
|
|
35
|
+
exports.Loading = Loading;
|
package/dist/loop/index.js
CHANGED
|
@@ -22,6 +22,6 @@ const Loop = ({ durationInFrames, times = Infinity, children, layout, name, }) =
|
|
|
22
22
|
return ((0, jsx_runtime_1.jsx)(__1.Sequence
|
|
23
23
|
// eslint-disable-next-line react/no-array-index-key
|
|
24
24
|
, { durationInFrames: durationInFrames, from: i * durationInFrames, layout: layout, name: name, showLoopTimesInTimeline: actualTimes, showInTimeline: i === 0, children: children }, `loop-${i}`));
|
|
25
|
-
}) }
|
|
25
|
+
}) }));
|
|
26
26
|
};
|
|
27
27
|
exports.Loop = Loop;
|
package/dist/perf/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare type PerfId = 'activate-target' | 'capture' | 'save';
|
|
1
|
+
declare type PerfId = 'activate-target' | 'capture' | 'save' | 'extract-frame' | 'piping';
|
|
2
2
|
export declare const startPerfMeasure: (marker: PerfId) => number;
|
|
3
3
|
export declare const stopPerfMeasure: (id: number) => void;
|
|
4
4
|
export declare const logPerf: () => void;
|
package/dist/perf/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const portalNode: () => HTMLElement;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.portalNode = void 0;
|
|
4
|
+
let _portalNode = null;
|
|
5
|
+
const portalNode = () => {
|
|
6
|
+
if (!_portalNode) {
|
|
7
|
+
if (typeof document === 'undefined') {
|
|
8
|
+
throw new Error('Tried to call an API that only works in the browser from outside the browser');
|
|
9
|
+
}
|
|
10
|
+
_portalNode = document.createElement('div');
|
|
11
|
+
_portalNode.style.position = 'absolute';
|
|
12
|
+
_portalNode.style.top = '0px';
|
|
13
|
+
_portalNode.style.left = '0px';
|
|
14
|
+
_portalNode.style.right = '0px';
|
|
15
|
+
_portalNode.style.bottom = '0px';
|
|
16
|
+
_portalNode.style.width = '100%';
|
|
17
|
+
_portalNode.style.height = '100%';
|
|
18
|
+
_portalNode.style.display = 'flex';
|
|
19
|
+
_portalNode.style.flexDirection = 'column';
|
|
20
|
+
}
|
|
21
|
+
return _portalNode;
|
|
22
|
+
};
|
|
23
|
+
exports.portalNode = portalNode;
|
package/dist/register-root.d.ts
CHANGED
package/dist/register-root.js
CHANGED
|
@@ -1,15 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getRoot = exports.registerRoot = void 0;
|
|
4
|
-
let
|
|
3
|
+
exports.waitForRoot = exports.getRoot = exports.registerRoot = void 0;
|
|
4
|
+
let Root = null;
|
|
5
|
+
let listeners = [];
|
|
5
6
|
const registerRoot = (comp) => {
|
|
6
|
-
if (
|
|
7
|
+
if (Root) {
|
|
7
8
|
throw new Error('registerRoot() was called more than once.');
|
|
8
9
|
}
|
|
9
|
-
|
|
10
|
+
Root = comp;
|
|
11
|
+
listeners.forEach((l) => {
|
|
12
|
+
l(comp);
|
|
13
|
+
});
|
|
10
14
|
};
|
|
11
15
|
exports.registerRoot = registerRoot;
|
|
12
16
|
const getRoot = () => {
|
|
13
|
-
return
|
|
17
|
+
return Root;
|
|
14
18
|
};
|
|
15
19
|
exports.getRoot = getRoot;
|
|
20
|
+
const waitForRoot = (fn) => {
|
|
21
|
+
if (Root) {
|
|
22
|
+
fn(Root);
|
|
23
|
+
return () => undefined;
|
|
24
|
+
}
|
|
25
|
+
listeners.push(fn);
|
|
26
|
+
return () => {
|
|
27
|
+
listeners = listeners.filter((l) => l !== fn);
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
exports.waitForRoot = waitForRoot;
|
package/dist/sequencing/index.js
CHANGED
|
@@ -118,6 +118,6 @@ const Sequence = ({ from, durationInFrames = Infinity, children, name, layout =
|
|
|
118
118
|
bottom: 0,
|
|
119
119
|
left: 0,
|
|
120
120
|
right: 0,
|
|
121
|
-
}, children: content }
|
|
121
|
+
}, children: content })) : (content) }));
|
|
122
122
|
};
|
|
123
123
|
exports.Sequence = Sequence;
|
package/dist/series/index.js
CHANGED
|
@@ -8,7 +8,7 @@ const validate_duration_in_frames_1 = require("../validation/validate-duration-i
|
|
|
8
8
|
const flatten_children_1 = require("./flatten-children");
|
|
9
9
|
const SeriesSequence = ({ children }) => {
|
|
10
10
|
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
11
|
-
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children }
|
|
11
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children });
|
|
12
12
|
};
|
|
13
13
|
const Series = ({ children }) => {
|
|
14
14
|
const childrenValue = (0, react_1.useMemo)(() => {
|
|
@@ -45,11 +45,11 @@ const Series = ({ children }) => {
|
|
|
45
45
|
}
|
|
46
46
|
const currentStartFrame = startFrame + offset;
|
|
47
47
|
startFrame += durationInFramesProp + offset;
|
|
48
|
-
return ((0, jsx_runtime_1.jsx)(sequencing_1.Sequence, { from: currentStartFrame, durationInFrames: durationInFramesProp, ...passedProps, children: child }
|
|
48
|
+
return ((0, jsx_runtime_1.jsx)(sequencing_1.Sequence, { from: currentStartFrame, durationInFrames: durationInFramesProp, ...passedProps, children: child }));
|
|
49
49
|
});
|
|
50
50
|
}, [children]);
|
|
51
51
|
/* eslint-disable react/jsx-no-useless-fragment */
|
|
52
|
-
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: childrenValue }
|
|
52
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: childrenValue });
|
|
53
53
|
};
|
|
54
54
|
exports.Series = Series;
|
|
55
55
|
Series.Sequence = SeriesSequence;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { RemotionAudioProps } from './audio';
|
|
2
2
|
import { RemotionVideoProps } from './video';
|
|
3
|
-
|
|
3
|
+
import { OffthreadVideoProps } from './video/props';
|
|
4
|
+
export declare const validateMediaProps: (props: RemotionVideoProps | RemotionAudioProps | OffthreadVideoProps, component: 'Video' | 'Audio') => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const validateEveryNthFrame: (everyNthFrame: unknown) => void;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateEveryNthFrame = void 0;
|
|
4
|
+
const validateEveryNthFrame = (everyNthFrame) => {
|
|
5
|
+
if (typeof everyNthFrame === 'undefined') {
|
|
6
|
+
throw new TypeError(`Argument missing for parameter "everyNthFrame"`);
|
|
7
|
+
}
|
|
8
|
+
if (typeof everyNthFrame !== 'number') {
|
|
9
|
+
throw new TypeError(`Argument passed to "everyNthFrame" is not a number: ${everyNthFrame}`);
|
|
10
|
+
}
|
|
11
|
+
if (everyNthFrame < 1) {
|
|
12
|
+
throw new RangeError(`The value for "everyNthFrame" cannot be below 1, but is ${everyNthFrame}`);
|
|
13
|
+
}
|
|
14
|
+
if (!Number.isFinite(everyNthFrame)) {
|
|
15
|
+
throw new RangeError(`"everyNthFrame" ${everyNthFrame} is not finite`);
|
|
16
|
+
}
|
|
17
|
+
if (everyNthFrame % 1 !== 0) {
|
|
18
|
+
throw new RangeError(`Argument for everyNthFrame must be an integer, but got ${everyNthFrame}`);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
exports.validateEveryNthFrame = validateEveryNthFrame;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const validRenderers: readonly ["angle", "egl", "swiftshader"];
|
|
1
|
+
declare const validRenderers: readonly ["swangle", "angle", "egl", "swiftshader"];
|
|
2
2
|
export declare type OpenGlRenderer = typeof validRenderers[number];
|
|
3
3
|
export declare const validateOpenGlRenderer: (option: OpenGlRenderer | null) => OpenGlRenderer | null;
|
|
4
4
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.validateOpenGlRenderer = void 0;
|
|
4
|
-
const validRenderers = ['angle', 'egl', 'swiftshader'];
|
|
4
|
+
const validRenderers = ['swangle', 'angle', 'egl', 'swiftshader'];
|
|
5
5
|
const validateOpenGlRenderer = (option) => {
|
|
6
6
|
if (option === null) {
|
|
7
7
|
return null;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OffthreadVideo = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const get_environment_1 = require("../get-environment");
|
|
6
|
+
const sequencing_1 = require("../sequencing");
|
|
7
|
+
const validate_media_props_1 = require("../validate-media-props");
|
|
8
|
+
const validate_start_from_props_1 = require("../validate-start-from-props");
|
|
9
|
+
const OffthreadVideoForRendering_1 = require("./OffthreadVideoForRendering");
|
|
10
|
+
const VideoForDevelopment_1 = require("./VideoForDevelopment");
|
|
11
|
+
const OffthreadVideo = (props) => {
|
|
12
|
+
const { startFrom, endAt, ...otherProps } = props;
|
|
13
|
+
if (typeof startFrom !== 'undefined' || typeof endAt !== 'undefined') {
|
|
14
|
+
(0, validate_start_from_props_1.validateStartFromProps)(startFrom, endAt);
|
|
15
|
+
const startFromFrameNo = startFrom !== null && startFrom !== void 0 ? startFrom : 0;
|
|
16
|
+
const endAtFrameNo = endAt !== null && endAt !== void 0 ? endAt : Infinity;
|
|
17
|
+
return ((0, jsx_runtime_1.jsx)(sequencing_1.Sequence, { layout: "none", from: 0 - startFromFrameNo, showInTimeline: false, durationInFrames: endAtFrameNo, children: (0, jsx_runtime_1.jsx)(exports.OffthreadVideo, { ...otherProps }) }));
|
|
18
|
+
}
|
|
19
|
+
(0, validate_media_props_1.validateMediaProps)(props, 'Video');
|
|
20
|
+
if ((0, get_environment_1.getRemotionEnvironment)() === 'rendering') {
|
|
21
|
+
return (0, jsx_runtime_1.jsx)(OffthreadVideoForRendering_1.OffthreadVideoForRendering, { ...otherProps });
|
|
22
|
+
}
|
|
23
|
+
return (0, jsx_runtime_1.jsx)(VideoForDevelopment_1.VideoForDevelopment, { ...otherProps });
|
|
24
|
+
};
|
|
25
|
+
exports.OffthreadVideo = OffthreadVideo;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OffthreadVideoForRendering = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const absolute_src_1 = require("../absolute-src");
|
|
7
|
+
const use_audio_frame_1 = require("../audio/use-audio-frame");
|
|
8
|
+
const CompositionManager_1 = require("../CompositionManager");
|
|
9
|
+
const Img_1 = require("../Img");
|
|
10
|
+
const random_1 = require("../random");
|
|
11
|
+
const sequencing_1 = require("../sequencing");
|
|
12
|
+
const use_frame_1 = require("../use-frame");
|
|
13
|
+
const use_unsafe_video_config_1 = require("../use-unsafe-video-config");
|
|
14
|
+
const volume_prop_1 = require("../volume-prop");
|
|
15
|
+
const get_current_time_1 = require("./get-current-time");
|
|
16
|
+
const OffthreadVideoForRendering = ({ onError, volume: volumeProp, playbackRate, src, muted, style, ...props }) => {
|
|
17
|
+
const absoluteFrame = (0, use_frame_1.useAbsoluteCurrentFrame)();
|
|
18
|
+
const frame = (0, use_frame_1.useCurrentFrame)();
|
|
19
|
+
const volumePropsFrame = (0, use_audio_frame_1.useFrameForVolumeProp)();
|
|
20
|
+
const videoConfig = (0, use_unsafe_video_config_1.useUnsafeVideoConfig)();
|
|
21
|
+
const sequenceContext = (0, react_1.useContext)(sequencing_1.SequenceContext);
|
|
22
|
+
const mediaStartsAt = (0, use_audio_frame_1.useMediaStartsAt)();
|
|
23
|
+
const { registerAsset, unregisterAsset } = (0, react_1.useContext)(CompositionManager_1.CompositionManager);
|
|
24
|
+
if (!src) {
|
|
25
|
+
throw new TypeError('No `src` was passed to <OffthreadVideo>.');
|
|
26
|
+
}
|
|
27
|
+
// Generate a string that's as unique as possible for this asset
|
|
28
|
+
// but at the same time the same on all threads
|
|
29
|
+
const id = (0, react_1.useMemo)(() => `video-${(0, random_1.random)(src !== null && src !== void 0 ? src : '')}-${sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.cumulatedFrom}-${sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.relativeFrom}-${sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.durationInFrames}-muted:${muted}`, [
|
|
30
|
+
src,
|
|
31
|
+
muted,
|
|
32
|
+
sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.cumulatedFrom,
|
|
33
|
+
sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.relativeFrom,
|
|
34
|
+
sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.durationInFrames,
|
|
35
|
+
]);
|
|
36
|
+
if (!videoConfig) {
|
|
37
|
+
throw new Error('No video config found');
|
|
38
|
+
}
|
|
39
|
+
const volume = (0, volume_prop_1.evaluateVolume)({
|
|
40
|
+
volume: volumeProp,
|
|
41
|
+
frame: volumePropsFrame,
|
|
42
|
+
mediaVolume: 1,
|
|
43
|
+
});
|
|
44
|
+
(0, react_1.useEffect)(() => {
|
|
45
|
+
if (!src) {
|
|
46
|
+
throw new Error('No src passed');
|
|
47
|
+
}
|
|
48
|
+
if (muted) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
registerAsset({
|
|
52
|
+
type: 'video',
|
|
53
|
+
src: (0, absolute_src_1.getAbsoluteSrc)(src),
|
|
54
|
+
id,
|
|
55
|
+
frame: absoluteFrame,
|
|
56
|
+
volume,
|
|
57
|
+
mediaFrame: frame,
|
|
58
|
+
playbackRate: playbackRate !== null && playbackRate !== void 0 ? playbackRate : 1,
|
|
59
|
+
});
|
|
60
|
+
return () => unregisterAsset(id);
|
|
61
|
+
}, [
|
|
62
|
+
muted,
|
|
63
|
+
src,
|
|
64
|
+
registerAsset,
|
|
65
|
+
id,
|
|
66
|
+
unregisterAsset,
|
|
67
|
+
volume,
|
|
68
|
+
frame,
|
|
69
|
+
absoluteFrame,
|
|
70
|
+
playbackRate,
|
|
71
|
+
]);
|
|
72
|
+
const currentTime = (0, react_1.useMemo)(() => {
|
|
73
|
+
return ((0, get_current_time_1.getExpectedMediaFrameUncorrected)({
|
|
74
|
+
frame,
|
|
75
|
+
playbackRate: playbackRate || 1,
|
|
76
|
+
startFrom: -mediaStartsAt,
|
|
77
|
+
}) / videoConfig.fps);
|
|
78
|
+
}, [frame, mediaStartsAt, playbackRate, videoConfig.fps]);
|
|
79
|
+
const actualSrc = (0, react_1.useMemo)(() => {
|
|
80
|
+
return `http://localhost:${window.remotion_proxyPort}/proxy?src=${encodeURIComponent((0, absolute_src_1.getAbsoluteSrc)(src))}&time=${encodeURIComponent(currentTime)}`;
|
|
81
|
+
}, [currentTime, src]);
|
|
82
|
+
const onErr = (0, react_1.useCallback)((e) => {
|
|
83
|
+
onError === null || onError === void 0 ? void 0 : onError(e);
|
|
84
|
+
}, [onError]);
|
|
85
|
+
const actualStyle = (0, react_1.useMemo)(() => {
|
|
86
|
+
return {
|
|
87
|
+
objectFit: 'contain',
|
|
88
|
+
...(style !== null && style !== void 0 ? style : {}),
|
|
89
|
+
};
|
|
90
|
+
}, [style]);
|
|
91
|
+
return (0, jsx_runtime_1.jsx)(Img_1.Img, { src: actualSrc, style: actualStyle, ...props, onError: onErr });
|
|
92
|
+
};
|
|
93
|
+
exports.OffthreadVideoForRendering = OffthreadVideoForRendering;
|
package/dist/video/Video.js
CHANGED
|
@@ -18,12 +18,12 @@ const VideoForwardingFunction = (props, ref) => {
|
|
|
18
18
|
(0, validate_start_from_props_1.validateStartFromProps)(startFrom, endAt);
|
|
19
19
|
const startFromFrameNo = startFrom !== null && startFrom !== void 0 ? startFrom : 0;
|
|
20
20
|
const endAtFrameNo = endAt !== null && endAt !== void 0 ? endAt : Infinity;
|
|
21
|
-
return ((0, jsx_runtime_1.jsx)(sequencing_1.Sequence, { layout: "none", from: 0 - startFromFrameNo, showInTimeline: false, durationInFrames: endAtFrameNo, children: (0, jsx_runtime_1.jsx)(exports.Video, { ...otherProps, ref: ref }
|
|
21
|
+
return ((0, jsx_runtime_1.jsx)(sequencing_1.Sequence, { layout: "none", from: 0 - startFromFrameNo, showInTimeline: false, durationInFrames: endAtFrameNo, children: (0, jsx_runtime_1.jsx)(exports.Video, { ...otherProps, ref: ref }) }));
|
|
22
22
|
}
|
|
23
23
|
(0, validate_media_props_1.validateMediaProps)(props, 'Video');
|
|
24
24
|
if ((0, get_environment_1.getRemotionEnvironment)() === 'rendering') {
|
|
25
|
-
return (0, jsx_runtime_1.jsx)(VideoForRendering_1.VideoForRendering, { ...otherProps, ref: ref }
|
|
25
|
+
return (0, jsx_runtime_1.jsx)(VideoForRendering_1.VideoForRendering, { ...otherProps, ref: ref });
|
|
26
26
|
}
|
|
27
|
-
return (0, jsx_runtime_1.jsx)(VideoForDevelopment_1.VideoForDevelopment, { ...otherProps, ref: ref }
|
|
27
|
+
return (0, jsx_runtime_1.jsx)(VideoForDevelopment_1.VideoForDevelopment, { ...otherProps, ref: ref });
|
|
28
28
|
};
|
|
29
29
|
exports.Video = (0, react_1.forwardRef)(VideoForwardingFunction);
|
|
@@ -40,6 +40,6 @@ const VideoForDevelopmentRefForwardingFunction = (props, ref) => {
|
|
|
40
40
|
(0, react_1.useImperativeHandle)(ref, () => {
|
|
41
41
|
return videoRef.current;
|
|
42
42
|
});
|
|
43
|
-
return ((0, jsx_runtime_1.jsx)("video", { ref: videoRef, muted: muted || mediaMuted, playsInline: true, ...nativeProps }
|
|
43
|
+
return ((0, jsx_runtime_1.jsx)("video", { ref: videoRef, muted: muted || mediaMuted, playsInline: true, ...nativeProps }));
|
|
44
44
|
};
|
|
45
45
|
exports.VideoForDevelopment = (0, react_1.forwardRef)(VideoForDevelopmentRefForwardingFunction);
|
|
@@ -129,6 +129,10 @@ const VideoForRenderingForwardFunction = ({ onError, volume: volumeProp, playbac
|
|
|
129
129
|
throw new Error('The browser threw an errir');
|
|
130
130
|
}
|
|
131
131
|
}, { once: true });
|
|
132
|
+
// If video skips to another frame or unmounts, we clear the created handle
|
|
133
|
+
return () => {
|
|
134
|
+
(0, delay_render_1.continueRender)(handle);
|
|
135
|
+
};
|
|
132
136
|
}, [
|
|
133
137
|
volumePropsFrame,
|
|
134
138
|
props.src,
|
|
@@ -137,6 +141,6 @@ const VideoForRenderingForwardFunction = ({ onError, volume: volumeProp, playbac
|
|
|
137
141
|
frame,
|
|
138
142
|
mediaStartsAt,
|
|
139
143
|
]);
|
|
140
|
-
return (0, jsx_runtime_1.jsx)("video", { ref: videoRef, ...props, onError: onError }
|
|
144
|
+
return (0, jsx_runtime_1.jsx)("video", { ref: videoRef, ...props, onError: onError });
|
|
141
145
|
};
|
|
142
146
|
exports.VideoForRendering = (0, react_1.forwardRef)(VideoForRenderingForwardFunction);
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
export declare const getExpectedMediaFrameUncorrected: ({ frame, playbackRate, startFrom, }: {
|
|
2
|
+
frame: number;
|
|
3
|
+
playbackRate: number;
|
|
4
|
+
startFrom: number;
|
|
5
|
+
}) => number;
|
|
1
6
|
export declare const getMediaTime: ({ fps, frame, src, playbackRate, startFrom, }: {
|
|
2
7
|
fps: number;
|
|
3
8
|
frame: number;
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Calculate the `.currentTime` of a video or audio element
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.getMediaTime = void 0;
|
|
4
|
+
exports.getMediaTime = exports.getExpectedMediaFrameUncorrected = void 0;
|
|
5
5
|
const interpolate_1 = require("../interpolate");
|
|
6
|
+
const getExpectedMediaFrameUncorrected = ({ frame, playbackRate, startFrom, }) => {
|
|
7
|
+
return (0, interpolate_1.interpolate)(frame, [-1, startFrom, startFrom + 1], [-1, startFrom, startFrom + playbackRate]);
|
|
8
|
+
};
|
|
9
|
+
exports.getExpectedMediaFrameUncorrected = getExpectedMediaFrameUncorrected;
|
|
6
10
|
const getMediaTime = ({ fps, frame, src, playbackRate, startFrom, }) => {
|
|
7
|
-
const expectedFrame = (0,
|
|
11
|
+
const expectedFrame = (0, exports.getExpectedMediaFrameUncorrected)({
|
|
12
|
+
frame,
|
|
13
|
+
playbackRate,
|
|
14
|
+
startFrom,
|
|
15
|
+
});
|
|
8
16
|
if (src.endsWith('mp4')) {
|
|
9
17
|
// In Chrome, for MP4s, if 30fps, the first frame is still displayed at 0.033333
|
|
10
18
|
// even though after that it increases by 0.033333333 each.
|
package/dist/video/index.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export { OffthreadVideo } from './OffthreadVideo';
|
|
2
|
+
export { OffthreadVideoProps as RemotionOffthreadVideoProps, RemotionMainVideoProps, RemotionVideoProps, } from './props';
|
|
3
|
+
export { Video } from './Video';
|
package/dist/video/index.js
CHANGED
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
-
};
|
|
12
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
|
|
14
|
-
|
|
3
|
+
exports.Video = exports.OffthreadVideo = void 0;
|
|
4
|
+
var OffthreadVideo_1 = require("./OffthreadVideo");
|
|
5
|
+
Object.defineProperty(exports, "OffthreadVideo", { enumerable: true, get: function () { return OffthreadVideo_1.OffthreadVideo; } });
|
|
6
|
+
var Video_1 = require("./Video");
|
|
7
|
+
Object.defineProperty(exports, "Video", { enumerable: true, get: function () { return Video_1.Video; } });
|
package/dist/video/props.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { VolumeProp } from '../volume-prop';
|
|
3
3
|
export declare type RemotionMainVideoProps = {
|
|
4
4
|
startFrom?: number;
|
|
@@ -8,3 +8,12 @@ export declare type RemotionVideoProps = Omit<React.DetailedHTMLProps<React.Vide
|
|
|
8
8
|
volume?: VolumeProp;
|
|
9
9
|
playbackRate?: number;
|
|
10
10
|
};
|
|
11
|
+
export declare type OffthreadVideoProps = {
|
|
12
|
+
src: string;
|
|
13
|
+
className?: string;
|
|
14
|
+
style?: React.CSSProperties;
|
|
15
|
+
volume?: VolumeProp;
|
|
16
|
+
playbackRate?: number;
|
|
17
|
+
muted?: boolean;
|
|
18
|
+
onError?: React.ReactEventHandler<HTMLVideoElement | HTMLImageElement>;
|
|
19
|
+
};
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -52,6 +56,6 @@ function useRemotionContexts() {
|
|
|
52
56
|
exports.useRemotionContexts = useRemotionContexts;
|
|
53
57
|
const RemotionContextProvider = (props) => {
|
|
54
58
|
const { children, contexts } = props;
|
|
55
|
-
return ((0, jsx_runtime_1.jsx)(nonce_1.NonceContext.Provider, { value: contexts.nonceContext, children: (0, jsx_runtime_1.jsx)(CompositionManager_1.CompositionManager.Provider, { value: contexts.compositionManagerCtx, children: (0, jsx_runtime_1.jsx)(timeline_position_state_1.TimelineContext.Provider, { value: contexts.timelineContext, children: (0, jsx_runtime_1.jsx)(timeline_position_state_1.SetTimelineContext.Provider, { value: contexts.setTimelineContext, children: (0, jsx_runtime_1.jsx)(sequencing_1.SequenceContext.Provider, { value: contexts.sequenceContext, children: children }
|
|
59
|
+
return ((0, jsx_runtime_1.jsx)(nonce_1.NonceContext.Provider, { value: contexts.nonceContext, children: (0, jsx_runtime_1.jsx)(CompositionManager_1.CompositionManager.Provider, { value: contexts.compositionManagerCtx, children: (0, jsx_runtime_1.jsx)(timeline_position_state_1.TimelineContext.Provider, { value: contexts.timelineContext, children: (0, jsx_runtime_1.jsx)(timeline_position_state_1.SetTimelineContext.Provider, { value: contexts.setTimelineContext, children: (0, jsx_runtime_1.jsx)(sequencing_1.SequenceContext.Provider, { value: contexts.sequenceContext, children: children }) }) }) }) }));
|
|
56
60
|
};
|
|
57
61
|
exports.RemotionContextProvider = RemotionContextProvider;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "remotion",
|
|
3
|
-
"version": "4.0.0-
|
|
3
|
+
"version": "4.0.0-lambda.3+32da0b782",
|
|
4
4
|
"description": "Render videos in React",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"react-test-renderer": "^18.0.0",
|
|
42
42
|
"rimraf": "^3.0.2",
|
|
43
43
|
"ts-jest": "^27.0.5",
|
|
44
|
-
"typescript": "^4.
|
|
44
|
+
"typescript": "^4.7.0",
|
|
45
45
|
"webpack": "5.72.0"
|
|
46
46
|
},
|
|
47
47
|
"keywords": [
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"publishConfig": {
|
|
56
56
|
"access": "public"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "32da0b782094e5eac82cdc1b1469a80bb763b392"
|
|
59
59
|
}
|
package/.turbo/turbo-lint.log
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
[33mremotion:lint: [0mcache hit, replaying output [2mcfd1b8e3d4bfaf71[0m
|
|
2
|
-
[33mremotion:lint: [0m
|
|
3
|
-
[33mremotion:lint: [0m> remotion@2.6.15 lint /Users/jonathanburger/remotion/packages/core
|
|
4
|
-
[33mremotion:lint: [0m> eslint src --ext ts,tsx
|
|
5
|
-
[33mremotion:lint: [0m
|
|
6
|
-
[33mremotion:lint: [0m
|
|
7
|
-
[33mremotion:lint: [0m/Users/jonathanburger/remotion/packages/core/src/use-lazy-component.ts
|
|
8
|
-
[33mremotion:lint: [0m 9:50 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
9
|
-
[33mremotion:lint: [0m
|
|
10
|
-
[33mremotion:lint: [0m✖ 1 problem (0 errors, 1 warning)
|
|
11
|
-
[33mremotion:lint: [0m
|