remotion 4.0.442 → 4.0.444
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/Composition.js +15 -3
- package/dist/cjs/CompositionErrorBoundary.d.ts +17 -0
- package/dist/cjs/CompositionErrorBoundary.js +31 -0
- package/dist/cjs/CompositionManager.d.ts +1 -0
- package/dist/cjs/Img.d.ts +14 -1
- package/dist/cjs/Img.js +34 -2
- package/dist/cjs/composition-render-error-context.d.ts +5 -0
- package/dist/cjs/composition-render-error-context.js +8 -0
- package/dist/cjs/get-timeline-duration.d.ts +7 -0
- package/dist/cjs/get-timeline-duration.js +17 -0
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +7 -3
- package/dist/cjs/internals.d.ts +1 -0
- package/dist/cjs/internals.js +2 -0
- package/dist/cjs/series/index.d.ts +1 -6
- package/dist/cjs/series/index.js +2 -5
- package/dist/cjs/use-media-in-timeline.d.ts +3 -2
- package/dist/cjs/use-media-in-timeline.js +8 -8
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/video/MediaPlaybackError.d.ts +7 -0
- package/dist/cjs/video/MediaPlaybackError.js +11 -0
- package/dist/cjs/video/VideoForPreview.js +17 -4
- package/dist/cjs/video/VideoForRendering.js +9 -2
- package/dist/esm/index.mjs +1783 -1652
- package/dist/esm/version.mjs +1 -1
- package/package.json +2 -2
package/dist/cjs/Composition.js
CHANGED
|
@@ -5,6 +5,8 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const react_dom_1 = require("react-dom");
|
|
7
7
|
const CanUseRemotionHooks_js_1 = require("./CanUseRemotionHooks.js");
|
|
8
|
+
const composition_render_error_context_js_1 = require("./composition-render-error-context.js");
|
|
9
|
+
const CompositionErrorBoundary_js_1 = require("./CompositionErrorBoundary.js");
|
|
8
10
|
const CompositionManagerContext_js_1 = require("./CompositionManagerContext.js");
|
|
9
11
|
const Folder_js_1 = require("./Folder.js");
|
|
10
12
|
const input_props_serialization_js_1 = require("./input-props-serialization.js");
|
|
@@ -28,7 +30,7 @@ const Fallback = () => {
|
|
|
28
30
|
return null;
|
|
29
31
|
};
|
|
30
32
|
const InnerComposition = ({ width, height, fps, durationInFrames, id, defaultProps, schema, ...compProps }) => {
|
|
31
|
-
var _a, _b, _c;
|
|
33
|
+
var _a, _b, _c, _d;
|
|
32
34
|
const compManager = (0, react_1.useContext)(CompositionManagerContext_js_1.CompositionSetters);
|
|
33
35
|
const { registerComposition, unregisterComposition } = compManager;
|
|
34
36
|
const video = (0, use_video_js_1.useVideo)();
|
|
@@ -52,6 +54,7 @@ const InnerComposition = ({ width, height, fps, durationInFrames, id, defaultPro
|
|
|
52
54
|
throw new Error('<Composition> mounted inside another composition. See https://remotion.dev/docs/wrong-composition-mount for help.');
|
|
53
55
|
}
|
|
54
56
|
const { folderName, parentName } = (0, react_1.useContext)(Folder_js_1.FolderContext);
|
|
57
|
+
const stack = (_b = compProps.stack) !== null && _b !== void 0 ? _b : null;
|
|
55
58
|
(0, react_1.useEffect)(() => {
|
|
56
59
|
var _a;
|
|
57
60
|
// Ensure it's a URL safe id
|
|
@@ -73,6 +76,7 @@ const InnerComposition = ({ width, height, fps, durationInFrames, id, defaultPro
|
|
|
73
76
|
parentFolderName: parentName,
|
|
74
77
|
schema: schema !== null && schema !== void 0 ? schema : null,
|
|
75
78
|
calculateMetadata: (_a = compProps.calculateMetadata) !== null && _a !== void 0 ? _a : null,
|
|
79
|
+
stack,
|
|
76
80
|
});
|
|
77
81
|
return () => {
|
|
78
82
|
unregisterComposition(id);
|
|
@@ -90,10 +94,18 @@ const InnerComposition = ({ width, height, fps, durationInFrames, id, defaultPro
|
|
|
90
94
|
parentName,
|
|
91
95
|
schema,
|
|
92
96
|
compProps.calculateMetadata,
|
|
97
|
+
stack,
|
|
93
98
|
registerComposition,
|
|
94
99
|
unregisterComposition,
|
|
95
100
|
]);
|
|
96
101
|
const resolved = (0, ResolveCompositionConfig_js_1.useResolvedVideoConfig)(id);
|
|
102
|
+
const { setError, clearError } = (0, react_1.useContext)(composition_render_error_context_js_1.CompositionRenderErrorContext);
|
|
103
|
+
const onError = (0, react_1.useCallback)((error) => {
|
|
104
|
+
setError(error);
|
|
105
|
+
}, [setError]);
|
|
106
|
+
const onClear = (0, react_1.useCallback)(() => {
|
|
107
|
+
clearError();
|
|
108
|
+
}, [clearError]);
|
|
97
109
|
if (environment.isStudio &&
|
|
98
110
|
video &&
|
|
99
111
|
video.component === lazy &&
|
|
@@ -104,7 +116,7 @@ const InnerComposition = ({ width, height, fps, durationInFrames, id, defaultPro
|
|
|
104
116
|
resolved.type !== 'success-and-refreshing')) {
|
|
105
117
|
return null;
|
|
106
118
|
}
|
|
107
|
-
return (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(CanUseRemotionHooks_js_1.CanUseRemotionHooksProvider, { children: (0, jsx_runtime_1.jsx)(react_1.Suspense, { fallback: (0, jsx_runtime_1.jsx)(loading_indicator_js_1.Loading, {}), children: (0, jsx_runtime_1.jsx)(Comp, { ...((
|
|
119
|
+
return (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(CanUseRemotionHooks_js_1.CanUseRemotionHooksProvider, { children: (0, jsx_runtime_1.jsx)(CompositionErrorBoundary_js_1.CompositionErrorBoundary, { onError: onError, onClear: onClear, children: (0, jsx_runtime_1.jsx)(react_1.Suspense, { fallback: (0, jsx_runtime_1.jsx)(loading_indicator_js_1.Loading, {}), children: (0, jsx_runtime_1.jsx)(Comp, { ...((_c = resolved.result.props) !== null && _c !== void 0 ? _c : {}) }) }) }) }), (0, portal_node_js_1.portalNode)());
|
|
108
120
|
}
|
|
109
121
|
if (environment.isRendering &&
|
|
110
122
|
video &&
|
|
@@ -116,7 +128,7 @@ const InnerComposition = ({ width, height, fps, durationInFrames, id, defaultPro
|
|
|
116
128
|
resolved.type !== 'success-and-refreshing')) {
|
|
117
129
|
return null;
|
|
118
130
|
}
|
|
119
|
-
return (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(CanUseRemotionHooks_js_1.CanUseRemotionHooksProvider, { children: (0, jsx_runtime_1.jsx)(react_1.Suspense, { fallback: (0, jsx_runtime_1.jsx)(Fallback, {}), children: (0, jsx_runtime_1.jsx)(Comp, { ...((
|
|
131
|
+
return (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(CanUseRemotionHooks_js_1.CanUseRemotionHooksProvider, { children: (0, jsx_runtime_1.jsx)(react_1.Suspense, { fallback: (0, jsx_runtime_1.jsx)(Fallback, {}), children: (0, jsx_runtime_1.jsx)(Comp, { ...((_d = resolved.result.props) !== null && _d !== void 0 ? _d : {}) }) }) }), (0, portal_node_js_1.portalNode)());
|
|
120
132
|
}
|
|
121
133
|
return null;
|
|
122
134
|
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type Props = {
|
|
3
|
+
readonly children: React.ReactNode;
|
|
4
|
+
readonly onError: (error: Error) => void;
|
|
5
|
+
readonly onClear: () => void;
|
|
6
|
+
};
|
|
7
|
+
type State = {
|
|
8
|
+
hasError: boolean;
|
|
9
|
+
};
|
|
10
|
+
export declare class CompositionErrorBoundary extends React.Component<Props, State> {
|
|
11
|
+
state: State;
|
|
12
|
+
static getDerivedStateFromError(): Partial<State>;
|
|
13
|
+
componentDidCatch(error: Error): void;
|
|
14
|
+
componentDidUpdate(_prevProps: Props): void;
|
|
15
|
+
render(): React.ReactNode;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CompositionErrorBoundary = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
class CompositionErrorBoundary extends react_1.default.Component {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this.state = { hasError: false };
|
|
12
|
+
}
|
|
13
|
+
static getDerivedStateFromError() {
|
|
14
|
+
return { hasError: true };
|
|
15
|
+
}
|
|
16
|
+
componentDidCatch(error) {
|
|
17
|
+
this.props.onError(error);
|
|
18
|
+
}
|
|
19
|
+
componentDidUpdate(_prevProps) {
|
|
20
|
+
if (!this.state.hasError) {
|
|
21
|
+
this.props.onClear();
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
render() {
|
|
25
|
+
if (this.state.hasError) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
return this.props.children;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.CompositionErrorBoundary = CompositionErrorBoundary;
|
|
@@ -18,6 +18,7 @@ export type TComposition<Schema extends AnyZodObject, Props extends Record<strin
|
|
|
18
18
|
nonce: NonceHistory;
|
|
19
19
|
schema: Schema | null;
|
|
20
20
|
calculateMetadata: CalculateMetadataFunction<InferProps<Schema, Props>> | null;
|
|
21
|
+
stack: string | null;
|
|
21
22
|
} & PropsIfHasProps<Schema, Props>;
|
|
22
23
|
export type AnyComposition = TComposition<AnyZodObject, Record<string, unknown>>;
|
|
23
24
|
export type TCompMetadataWithCalcFunction<Schema extends AnyZodObject, Props extends Record<string, unknown>> = Pick<TComposition<Schema, Props>, 'id' | 'height' | 'width' | 'fps' | 'durationInFrames' | 'defaultProps' | 'calculateMetadata'>;
|
package/dist/cjs/Img.d.ts
CHANGED
|
@@ -14,5 +14,18 @@ export type ImgProps = NativeImgProps & {
|
|
|
14
14
|
*/
|
|
15
15
|
readonly stack?: string;
|
|
16
16
|
};
|
|
17
|
-
export declare const Img: React.
|
|
17
|
+
export declare const Img: React.ComponentType<NativeImgProps & {
|
|
18
|
+
readonly maxRetries?: number;
|
|
19
|
+
readonly pauseWhenLoading?: boolean;
|
|
20
|
+
readonly delayRenderRetries?: number;
|
|
21
|
+
readonly delayRenderTimeoutInMilliseconds?: number;
|
|
22
|
+
readonly onImageFrame?: (imageElement: HTMLImageElement) => void;
|
|
23
|
+
readonly src: string;
|
|
24
|
+
readonly showInTimeline?: boolean;
|
|
25
|
+
readonly name?: string;
|
|
26
|
+
/**
|
|
27
|
+
* @deprecated For internal use only
|
|
28
|
+
*/
|
|
29
|
+
readonly stack?: string;
|
|
30
|
+
}>;
|
|
18
31
|
export {};
|
package/dist/cjs/Img.js
CHANGED
|
@@ -11,10 +11,41 @@ const use_buffer_state_js_1 = require("./use-buffer-state.js");
|
|
|
11
11
|
const use_delay_render_js_1 = require("./use-delay-render.js");
|
|
12
12
|
const use_media_in_timeline_js_1 = require("./use-media-in-timeline.js");
|
|
13
13
|
const use_remotion_environment_js_1 = require("./use-remotion-environment.js");
|
|
14
|
+
const wrap_in_schema_js_1 = require("./wrap-in-schema.js");
|
|
14
15
|
function exponentialBackoff(errorCount) {
|
|
15
16
|
return 1000 * 2 ** (errorCount - 1);
|
|
16
17
|
}
|
|
17
|
-
const
|
|
18
|
+
const imgSchema = {
|
|
19
|
+
'style.translate': {
|
|
20
|
+
type: 'translate',
|
|
21
|
+
step: 1,
|
|
22
|
+
default: '0px 0px',
|
|
23
|
+
description: 'Position',
|
|
24
|
+
},
|
|
25
|
+
'style.scale': {
|
|
26
|
+
type: 'number',
|
|
27
|
+
min: 0.05,
|
|
28
|
+
max: 100,
|
|
29
|
+
step: 0.01,
|
|
30
|
+
default: 1,
|
|
31
|
+
description: 'Scale',
|
|
32
|
+
},
|
|
33
|
+
'style.rotate': {
|
|
34
|
+
type: 'rotation',
|
|
35
|
+
step: 1,
|
|
36
|
+
default: '0deg',
|
|
37
|
+
description: 'Rotation',
|
|
38
|
+
},
|
|
39
|
+
'style.opacity': {
|
|
40
|
+
type: 'number',
|
|
41
|
+
min: 0,
|
|
42
|
+
max: 1,
|
|
43
|
+
step: 0.01,
|
|
44
|
+
default: 1,
|
|
45
|
+
description: 'Opacity',
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
const ImgInner = ({ onError, maxRetries = 2, src, pauseWhenLoading, delayRenderRetries, delayRenderTimeoutInMilliseconds, onImageFrame, crossOrigin, showInTimeline, name, stack, ref, controls, ...props }) => {
|
|
18
49
|
var _a, _b;
|
|
19
50
|
const imageRef = (0, react_1.useRef)(null);
|
|
20
51
|
const errors = (0, react_1.useRef)({});
|
|
@@ -40,6 +71,7 @@ const ImgRefForwarding = ({ onError, maxRetries = 2, src, pauseWhenLoading, dela
|
|
|
40
71
|
premountDisplay: (_a = sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.premountDisplay) !== null && _a !== void 0 ? _a : null,
|
|
41
72
|
postmountDisplay: (_b = sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.postmountDisplay) !== null && _b !== void 0 ? _b : null,
|
|
42
73
|
loopDisplay: undefined,
|
|
74
|
+
controls: controls !== null && controls !== void 0 ? controls : null,
|
|
43
75
|
});
|
|
44
76
|
const actualSrc = (0, prefetch_js_1.usePreload)(src);
|
|
45
77
|
const retryIn = (0, react_1.useCallback)((timeout) => {
|
|
@@ -188,5 +220,5 @@ const ImgRefForwarding = ({ onError, maxRetries = 2, src, pauseWhenLoading, dela
|
|
|
188
220
|
* @description Works just like a regular HTML img tag. When you use the <Img> tag, Remotion will ensure that the image is loaded before rendering the frame.
|
|
189
221
|
* @see [Documentation](https://remotion.dev/docs/img)
|
|
190
222
|
*/
|
|
191
|
-
exports.Img = (0,
|
|
223
|
+
exports.Img = (0, wrap_in_schema_js_1.wrapInSchema)(ImgInner, imgSchema);
|
|
192
224
|
(0, enable_sequence_stack_traces_js_1.addSequenceStackTraces)(exports.Img);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CompositionRenderErrorContext = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
exports.CompositionRenderErrorContext = (0, react_1.createContext)({
|
|
6
|
+
setError: () => { },
|
|
7
|
+
clearError: () => { },
|
|
8
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const getTimelineDuration: ({ compositionDurationInFrames, playbackRate, trimBefore, trimAfter, parentSequenceDurationInFrames, }: {
|
|
2
|
+
compositionDurationInFrames: number;
|
|
3
|
+
playbackRate: number;
|
|
4
|
+
trimBefore: number | undefined;
|
|
5
|
+
trimAfter: number | undefined;
|
|
6
|
+
parentSequenceDurationInFrames: number | null;
|
|
7
|
+
}) => number;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getTimelineDuration = void 0;
|
|
4
|
+
const calculate_media_duration_js_1 = require("./calculate-media-duration.js");
|
|
5
|
+
const getTimelineDuration = ({ compositionDurationInFrames, playbackRate, trimBefore, trimAfter, parentSequenceDurationInFrames, }) => {
|
|
6
|
+
const mediaDuration = (0, calculate_media_duration_js_1.calculateMediaDuration)({
|
|
7
|
+
mediaDurationInFrames: compositionDurationInFrames * playbackRate + (trimBefore !== null && trimBefore !== void 0 ? trimBefore : 0),
|
|
8
|
+
playbackRate,
|
|
9
|
+
trimBefore,
|
|
10
|
+
trimAfter,
|
|
11
|
+
});
|
|
12
|
+
if (parentSequenceDurationInFrames !== null) {
|
|
13
|
+
return Math.floor(Math.min(parentSequenceDurationInFrames * playbackRate, mediaDuration));
|
|
14
|
+
}
|
|
15
|
+
return mediaDuration;
|
|
16
|
+
};
|
|
17
|
+
exports.getTimelineDuration = getTimelineDuration;
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -132,6 +132,7 @@ export * from './use-video-config.js';
|
|
|
132
132
|
export * from './version.js';
|
|
133
133
|
export * from './video-config.js';
|
|
134
134
|
export { Html5Video, OffthreadVideo, OffthreadVideoProps, RemotionMainVideoProps, RemotionOffthreadVideoProps, RemotionVideoProps, Video, } from './video/index.js';
|
|
135
|
+
export { MediaPlaybackError } from './video/MediaPlaybackError.js';
|
|
135
136
|
export type { OnVideoFrame } from './video/props.js';
|
|
136
137
|
export type { VolumeProp } from './volume-prop.js';
|
|
137
138
|
export { watchStaticFile } from './watch-static-file.js';
|
package/dist/cjs/index.js
CHANGED
|
@@ -14,10 +14,11 @@ 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.Config = exports.Experimental = exports.watchStaticFile = exports.Video = exports.OffthreadVideo = exports.Html5Video = exports.useRemotionEnvironment = exports.useDelayRender = exports.useCurrentScale = exports.useCurrentFrame = exports.useBufferState = exports.staticFile = exports.Series = exports.Sequence = exports.registerRoot = exports.prefetch = exports.random = exports.interpolate = exports.Loop = exports.interpolateColors = exports.Img = exports.getStaticFiles = exports.getRemotionEnvironment = exports.delayRender = exports.continueRender = exports.getInputProps = exports.Composition = exports.cancelRender = exports.Html5Audio = exports.Audio = exports.Artifact = void 0;
|
|
17
|
+
exports.Config = exports.Experimental = exports.watchStaticFile = exports.MediaPlaybackError = exports.Video = exports.OffthreadVideo = exports.Html5Video = exports.useRemotionEnvironment = exports.useDelayRender = exports.useCurrentScale = exports.useCurrentFrame = exports.useBufferState = exports.staticFile = exports.Series = exports.Sequence = exports.registerRoot = exports.prefetch = exports.random = exports.interpolate = exports.Loop = exports.interpolateColors = exports.Img = exports.getStaticFiles = exports.getRemotionEnvironment = exports.delayRender = exports.continueRender = exports.getInputProps = exports.Composition = exports.cancelRender = exports.Html5Audio = exports.Audio = exports.Artifact = void 0;
|
|
18
18
|
require("./_check-rsc.js");
|
|
19
19
|
require("./asset-types.js");
|
|
20
20
|
const Clipper_js_1 = require("./Clipper.js");
|
|
21
|
+
const Composition_js_1 = require("./Composition.js");
|
|
21
22
|
const enable_sequence_stack_traces_js_1 = require("./enable-sequence-stack-traces.js");
|
|
22
23
|
const is_player_js_1 = require("./is-player.js");
|
|
23
24
|
const multiple_versions_warning_js_1 = require("./multiple-versions-warning.js");
|
|
@@ -33,8 +34,8 @@ Object.defineProperty(exports, "Audio", { enumerable: true, get: function () { r
|
|
|
33
34
|
Object.defineProperty(exports, "Html5Audio", { enumerable: true, get: function () { return index_js_1.Html5Audio; } });
|
|
34
35
|
var cancel_render_js_1 = require("./cancel-render.js");
|
|
35
36
|
Object.defineProperty(exports, "cancelRender", { enumerable: true, get: function () { return cancel_render_js_1.cancelRender; } });
|
|
36
|
-
var
|
|
37
|
-
Object.defineProperty(exports, "Composition", { enumerable: true, get: function () { return
|
|
37
|
+
var Composition_js_2 = require("./Composition.js");
|
|
38
|
+
Object.defineProperty(exports, "Composition", { enumerable: true, get: function () { return Composition_js_2.Composition; } });
|
|
38
39
|
var input_props_js_1 = require("./config/input-props.js");
|
|
39
40
|
Object.defineProperty(exports, "getInputProps", { enumerable: true, get: function () { return input_props_js_1.getInputProps; } });
|
|
40
41
|
var delay_render_js_1 = require("./delay-render.js");
|
|
@@ -87,6 +88,8 @@ var index_js_4 = require("./video/index.js");
|
|
|
87
88
|
Object.defineProperty(exports, "Html5Video", { enumerable: true, get: function () { return index_js_4.Html5Video; } });
|
|
88
89
|
Object.defineProperty(exports, "OffthreadVideo", { enumerable: true, get: function () { return index_js_4.OffthreadVideo; } });
|
|
89
90
|
Object.defineProperty(exports, "Video", { enumerable: true, get: function () { return index_js_4.Video; } });
|
|
91
|
+
var MediaPlaybackError_js_1 = require("./video/MediaPlaybackError.js");
|
|
92
|
+
Object.defineProperty(exports, "MediaPlaybackError", { enumerable: true, get: function () { return MediaPlaybackError_js_1.MediaPlaybackError; } });
|
|
90
93
|
var watch_static_file_js_1 = require("./watch-static-file.js");
|
|
91
94
|
Object.defineProperty(exports, "watchStaticFile", { enumerable: true, get: function () { return watch_static_file_js_1.watchStaticFile; } });
|
|
92
95
|
exports.Experimental = {
|
|
@@ -130,3 +133,4 @@ exports.Config = new Proxy(proxyObj, {
|
|
|
130
133
|
});
|
|
131
134
|
Sequence_js_1.Sequence.displayName = 'Sequence';
|
|
132
135
|
(0, enable_sequence_stack_traces_js_1.addSequenceStackTraces)(Sequence_js_1.Sequence);
|
|
136
|
+
(0, enable_sequence_stack_traces_js_1.addSequenceStackTraces)(Composition_js_1.Composition);
|
package/dist/cjs/internals.d.ts
CHANGED
|
@@ -440,5 +440,6 @@ export declare const Internals: {
|
|
|
440
440
|
defaultValue: unknown;
|
|
441
441
|
shouldResortToDefaultValueIfUndefined: boolean;
|
|
442
442
|
}) => unknown;
|
|
443
|
+
readonly CompositionRenderErrorContext: import("react").Context<import("./composition-render-error-context.js").CompositionRenderErrorContextType>;
|
|
443
444
|
};
|
|
444
445
|
export type { CompositionManagerContext, ResolvedStackLocation, CompProps, LoggingContextValue, MediaVolumeContextValue, RemotionEnvironment, SequenceFieldSchema, SequenceSchema, SerializedJSONWithCustomFields, SetMediaVolumeContextValue, SetTimelineContextValue, TCompMetadata, TComposition, TimelineContextValue, TRenderAsset, TSequence, WatchRemotionStaticFilesPayload, ScheduleAudioNodeOptions, CanUpdateSequencePropStatus, ScheduleAudioNodeResult, NonceHistory, };
|
package/dist/cjs/internals.js
CHANGED
|
@@ -42,6 +42,7 @@ const use_audio_frame_js_1 = require("./audio/use-audio-frame.js");
|
|
|
42
42
|
const buffering_js_1 = require("./buffering.js");
|
|
43
43
|
const calculate_media_duration_js_1 = require("./calculate-media-duration.js");
|
|
44
44
|
const CanUseRemotionHooks_js_1 = require("./CanUseRemotionHooks.js");
|
|
45
|
+
const composition_render_error_context_js_1 = require("./composition-render-error-context.js");
|
|
45
46
|
const CompositionManager_js_1 = require("./CompositionManager.js");
|
|
46
47
|
const CompositionManagerContext_js_1 = require("./CompositionManagerContext.js");
|
|
47
48
|
const CompositionManagerProvider_js_1 = require("./CompositionManagerProvider.js");
|
|
@@ -208,4 +209,5 @@ exports.Internals = {
|
|
|
208
209
|
AbsoluteTimeContext: TimelineContext_js_1.AbsoluteTimeContext,
|
|
209
210
|
RenderAssetManagerProvider: RenderAssetManager_js_1.RenderAssetManagerProvider,
|
|
210
211
|
getEffectiveVisualModeValue: get_effective_visual_mode_value_js_1.getEffectiveVisualModeValue,
|
|
212
|
+
CompositionRenderErrorContext: composition_render_error_context_js_1.CompositionRenderErrorContext,
|
|
211
213
|
};
|
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
import type { FC, PropsWithChildren } from 'react';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import type { LayoutAndStyle, SequenceProps } from '../Sequence.js';
|
|
4
|
-
import { ENABLE_V5_BREAKING_CHANGES } from '../v5-flag.js';
|
|
5
4
|
type SeriesSequenceProps = PropsWithChildren<{
|
|
6
5
|
readonly durationInFrames: number;
|
|
7
6
|
readonly offset?: number;
|
|
8
7
|
readonly className?: string;
|
|
9
8
|
} & Pick<SequenceProps, 'layout' | 'name'> & LayoutAndStyle>;
|
|
10
9
|
declare const SeriesSequence: React.ForwardRefExoticComponent<SeriesSequenceProps & React.RefAttributes<HTMLDivElement>>;
|
|
11
|
-
type
|
|
12
|
-
children: React.ReactNode;
|
|
13
|
-
};
|
|
14
|
-
type V5Props = SequenceProps;
|
|
15
|
-
type SeriesProps = true extends typeof ENABLE_V5_BREAKING_CHANGES ? V5Props : V4Props;
|
|
10
|
+
type SeriesProps = SequenceProps;
|
|
16
11
|
/**
|
|
17
12
|
* @description with this component, you can easily stitch together scenes that should play sequentially after another.
|
|
18
13
|
* @see [Documentation](https://www.remotion.dev/docs/series)
|
package/dist/cjs/series/index.js
CHANGED
|
@@ -5,7 +5,6 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const enable_sequence_stack_traces_js_1 = require("../enable-sequence-stack-traces.js");
|
|
7
7
|
const Sequence_js_1 = require("../Sequence.js");
|
|
8
|
-
const v5_flag_js_1 = require("../v5-flag.js");
|
|
9
8
|
const validate_duration_in_frames_js_1 = require("../validation/validate-duration-in-frames.js");
|
|
10
9
|
const flatten_children_js_1 = require("./flatten-children.js");
|
|
11
10
|
const is_inside_series_js_1 = require("./is-inside-series.js");
|
|
@@ -64,11 +63,9 @@ const Series = (props) => {
|
|
|
64
63
|
return ((0, jsx_runtime_1.jsx)(Sequence_js_1.Sequence, { name: name || '<Series.Sequence>', from: currentStartFrame, durationInFrames: durationInFramesProp, ...passedProps, ref: castedChild.ref, children: child }));
|
|
65
64
|
});
|
|
66
65
|
}, [props.children]);
|
|
67
|
-
|
|
68
|
-
return ((0, jsx_runtime_1.jsx)(is_inside_series_js_1.IsInsideSeriesContainer, { children: (0, jsx_runtime_1.jsx)(Sequence_js_1.Sequence, { ...props, children: childrenValue }) }));
|
|
69
|
-
}
|
|
70
|
-
return (0, jsx_runtime_1.jsx)(is_inside_series_js_1.IsInsideSeriesContainer, { children: childrenValue });
|
|
66
|
+
return ((0, jsx_runtime_1.jsx)(is_inside_series_js_1.IsInsideSeriesContainer, { children: (0, jsx_runtime_1.jsx)(Sequence_js_1.Sequence, { layout: "none", name: "<Series>", ...props, children: childrenValue }) }));
|
|
71
67
|
};
|
|
72
68
|
exports.Series = Series;
|
|
73
69
|
Series.Sequence = SeriesSequence;
|
|
70
|
+
(0, enable_sequence_stack_traces_js_1.addSequenceStackTraces)(Series);
|
|
74
71
|
(0, enable_sequence_stack_traces_js_1.addSequenceStackTraces)(SeriesSequence);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { LoopDisplay } from './CompositionManager.js';
|
|
1
|
+
import type { LoopDisplay, SequenceControls } from './CompositionManager.js';
|
|
2
2
|
import type { VolumeProp } from './volume-prop.js';
|
|
3
3
|
export declare const useBasicMediaInTimeline: ({ volume, mediaVolume, mediaType, src, displayName, trimBefore, trimAfter, playbackRate, }: {
|
|
4
4
|
volume: VolumeProp | undefined;
|
|
@@ -18,7 +18,7 @@ export declare const useBasicMediaInTimeline: ({ volume, mediaVolume, mediaType,
|
|
|
18
18
|
isStudio: boolean;
|
|
19
19
|
finalDisplayName: string;
|
|
20
20
|
};
|
|
21
|
-
export declare const useImageInTimeline: ({ src, displayName, id, stack, showInTimeline, premountDisplay, postmountDisplay, loopDisplay, }: {
|
|
21
|
+
export declare const useImageInTimeline: ({ src, displayName, id, stack, showInTimeline, premountDisplay, postmountDisplay, loopDisplay, controls, }: {
|
|
22
22
|
src: string | undefined;
|
|
23
23
|
displayName: string | null;
|
|
24
24
|
id: string;
|
|
@@ -27,6 +27,7 @@ export declare const useImageInTimeline: ({ src, displayName, id, stack, showInT
|
|
|
27
27
|
premountDisplay: number | null;
|
|
28
28
|
postmountDisplay: number | null;
|
|
29
29
|
loopDisplay: LoopDisplay | undefined;
|
|
30
|
+
controls: SequenceControls | null;
|
|
30
31
|
}) => void;
|
|
31
32
|
export declare const useMediaInTimeline: ({ volume, mediaVolume, src, mediaType, playbackRate, displayName, id, stack, showInTimeline, premountDisplay, postmountDisplay, loopDisplay, }: {
|
|
32
33
|
volume: VolumeProp | undefined;
|
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useMediaInTimeline = exports.useImageInTimeline = exports.useBasicMediaInTimeline = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const use_audio_frame_js_1 = require("./audio/use-audio-frame.js");
|
|
6
|
-
const calculate_media_duration_js_1 = require("./calculate-media-duration.js");
|
|
7
6
|
const get_asset_file_name_js_1 = require("./get-asset-file-name.js");
|
|
7
|
+
const get_timeline_duration_js_1 = require("./get-timeline-duration.js");
|
|
8
8
|
const nonce_js_1 = require("./nonce.js");
|
|
9
9
|
const SequenceContext_js_1 = require("./SequenceContext.js");
|
|
10
10
|
const SequenceManager_js_1 = require("./SequenceManager.js");
|
|
@@ -22,6 +22,7 @@ const warnOnce = (message) => {
|
|
|
22
22
|
didWarn[message] = true;
|
|
23
23
|
};
|
|
24
24
|
const useBasicMediaInTimeline = ({ volume, mediaVolume, mediaType, src, displayName, trimBefore, trimAfter, playbackRate, }) => {
|
|
25
|
+
var _a;
|
|
25
26
|
if (!src) {
|
|
26
27
|
throw new Error('No src passed');
|
|
27
28
|
}
|
|
@@ -29,15 +30,13 @@ const useBasicMediaInTimeline = ({ volume, mediaVolume, mediaType, src, displayN
|
|
|
29
30
|
const parentSequence = (0, react_1.useContext)(SequenceContext_js_1.SequenceContext);
|
|
30
31
|
const videoConfig = (0, use_video_config_js_1.useVideoConfig)();
|
|
31
32
|
const [initialVolume] = (0, react_1.useState)(() => volume);
|
|
32
|
-
const
|
|
33
|
-
|
|
33
|
+
const duration = (0, get_timeline_duration_js_1.getTimelineDuration)({
|
|
34
|
+
compositionDurationInFrames: videoConfig.durationInFrames,
|
|
34
35
|
playbackRate,
|
|
35
36
|
trimBefore,
|
|
36
37
|
trimAfter,
|
|
38
|
+
parentSequenceDurationInFrames: (_a = parentSequence === null || parentSequence === void 0 ? void 0 : parentSequence.durationInFrames) !== null && _a !== void 0 ? _a : null,
|
|
37
39
|
});
|
|
38
|
-
const duration = parentSequence
|
|
39
|
-
? Math.min(parentSequence.durationInFrames, mediaDuration)
|
|
40
|
-
: mediaDuration;
|
|
41
40
|
const volumes = (0, react_1.useMemo)(() => {
|
|
42
41
|
if (typeof volume === 'number') {
|
|
43
42
|
return volume;
|
|
@@ -73,7 +72,7 @@ const useBasicMediaInTimeline = ({ volume, mediaVolume, mediaType, src, displayN
|
|
|
73
72
|
};
|
|
74
73
|
};
|
|
75
74
|
exports.useBasicMediaInTimeline = useBasicMediaInTimeline;
|
|
76
|
-
const useImageInTimeline = ({ src, displayName, id, stack, showInTimeline, premountDisplay, postmountDisplay, loopDisplay, }) => {
|
|
75
|
+
const useImageInTimeline = ({ src, displayName, id, stack, showInTimeline, premountDisplay, postmountDisplay, loopDisplay, controls, }) => {
|
|
77
76
|
const parentSequence = (0, react_1.useContext)(SequenceContext_js_1.SequenceContext);
|
|
78
77
|
const { registerSequence, unregisterSequence } = (0, react_1.useContext)(SequenceManager_js_1.SequenceManager);
|
|
79
78
|
const { duration, nonce, rootId, isStudio, finalDisplayName } = (0, exports.useBasicMediaInTimeline)({
|
|
@@ -112,7 +111,7 @@ const useImageInTimeline = ({ src, displayName, id, stack, showInTimeline, premo
|
|
|
112
111
|
stack,
|
|
113
112
|
premountDisplay,
|
|
114
113
|
postmountDisplay,
|
|
115
|
-
controls
|
|
114
|
+
controls,
|
|
116
115
|
});
|
|
117
116
|
return () => {
|
|
118
117
|
unregisterSequence(id);
|
|
@@ -133,6 +132,7 @@ const useImageInTimeline = ({ src, displayName, id, stack, showInTimeline, premo
|
|
|
133
132
|
loopDisplay,
|
|
134
133
|
rootId,
|
|
135
134
|
finalDisplayName,
|
|
135
|
+
controls,
|
|
136
136
|
]);
|
|
137
137
|
};
|
|
138
138
|
exports.useImageInTimeline = useImageInTimeline;
|
package/dist/cjs/version.d.ts
CHANGED
package/dist/cjs/version.js
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MediaPlaybackError = void 0;
|
|
4
|
+
class MediaPlaybackError extends Error {
|
|
5
|
+
constructor({ message, src }) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.name = 'MediaPlaybackError';
|
|
8
|
+
this.src = src;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.MediaPlaybackError = MediaPlaybackError;
|
|
@@ -55,6 +55,7 @@ const volume_position_state_js_1 = require("../volume-position-state.js");
|
|
|
55
55
|
const volume_prop_js_1 = require("../volume-prop.js");
|
|
56
56
|
const volume_safeguard_js_1 = require("../volume-safeguard.js");
|
|
57
57
|
const emit_video_frame_js_1 = require("./emit-video-frame.js");
|
|
58
|
+
const MediaPlaybackError_js_1 = require("./MediaPlaybackError.js");
|
|
58
59
|
const video_fragment_js_1 = require("./video-fragment.js");
|
|
59
60
|
const VideoForDevelopmentRefForwardingFunction = (props, ref) => {
|
|
60
61
|
var _a, _b, _c, _d, _e, _f;
|
|
@@ -192,20 +193,32 @@ const VideoForDevelopmentRefForwardingFunction = (props, ref) => {
|
|
|
192
193
|
console.error('Error occurred in video', current === null || current === void 0 ? void 0 : current.error);
|
|
193
194
|
// If user is handling the error, we don't cause an unhandled exception
|
|
194
195
|
if (onError) {
|
|
195
|
-
const err = new
|
|
196
|
+
const err = new MediaPlaybackError_js_1.MediaPlaybackError({
|
|
197
|
+
message: `Code ${current.error.code}: ${current.error.message}`,
|
|
198
|
+
src: src,
|
|
199
|
+
});
|
|
196
200
|
onError(err);
|
|
197
201
|
return;
|
|
198
202
|
}
|
|
199
|
-
throw new
|
|
203
|
+
throw new MediaPlaybackError_js_1.MediaPlaybackError({
|
|
204
|
+
message: `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. Pass an onError() prop to handle the error.`,
|
|
205
|
+
src: src,
|
|
206
|
+
});
|
|
200
207
|
}
|
|
201
208
|
else {
|
|
202
209
|
// If user is handling the error, we don't cause an unhandled exception
|
|
203
210
|
if (onError) {
|
|
204
|
-
const err = new
|
|
211
|
+
const err = new MediaPlaybackError_js_1.MediaPlaybackError({
|
|
212
|
+
message: `The browser threw an error while playing the video ${src}`,
|
|
213
|
+
src: src,
|
|
214
|
+
});
|
|
205
215
|
onError(err);
|
|
206
216
|
return;
|
|
207
217
|
}
|
|
208
|
-
throw new
|
|
218
|
+
throw new MediaPlaybackError_js_1.MediaPlaybackError({
|
|
219
|
+
message: 'The browser threw an error while playing the video',
|
|
220
|
+
src: src,
|
|
221
|
+
});
|
|
209
222
|
}
|
|
210
223
|
};
|
|
211
224
|
current.addEventListener('error', errorHandler, { once: true });
|
|
@@ -18,6 +18,7 @@ const use_unsafe_video_config_js_1 = require("../use-unsafe-video-config.js");
|
|
|
18
18
|
const volume_prop_js_1 = require("../volume-prop.js");
|
|
19
19
|
const volume_safeguard_js_1 = require("../volume-safeguard.js");
|
|
20
20
|
const get_current_time_js_1 = require("./get-current-time.js");
|
|
21
|
+
const MediaPlaybackError_js_1 = require("./MediaPlaybackError.js");
|
|
21
22
|
const seek_until_right_js_1 = require("./seek-until-right.js");
|
|
22
23
|
const VideoForRenderingForwardFunction = ({ onError, volume: volumeProp, allowAmplificationDuringRender, playbackRate, onDuration, toneFrequency, name, acceptableTimeShiftInSeconds, delayRenderRetries, delayRenderTimeoutInMilliseconds, loopVolumeCurveBehavior, audioStreamIndex, onVideoFrame, ...props }, ref) => {
|
|
23
24
|
const absoluteFrame = (0, timeline_position_state_js_1.useTimelinePosition)();
|
|
@@ -155,10 +156,16 @@ const VideoForRenderingForwardFunction = ({ onError, volume: volumeProp, allowAm
|
|
|
155
156
|
if (onError) {
|
|
156
157
|
return;
|
|
157
158
|
}
|
|
158
|
-
throw new
|
|
159
|
+
throw new MediaPlaybackError_js_1.MediaPlaybackError({
|
|
160
|
+
message: `The browser threw an error while playing the video ${props.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. Pass an onError() prop to handle the error.`,
|
|
161
|
+
src: props.src,
|
|
162
|
+
});
|
|
159
163
|
}
|
|
160
164
|
else {
|
|
161
|
-
throw new
|
|
165
|
+
throw new MediaPlaybackError_js_1.MediaPlaybackError({
|
|
166
|
+
message: 'The browser threw an error',
|
|
167
|
+
src: props.src,
|
|
168
|
+
});
|
|
162
169
|
}
|
|
163
170
|
};
|
|
164
171
|
current.addEventListener('error', errorHandler, { once: true });
|