remotion 4.0.372 → 4.0.374
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/CompositionManager.d.ts +0 -8
- package/dist/cjs/CompositionManager.js +5 -138
- package/dist/cjs/CompositionManagerProvider.d.ts +10 -0
- package/dist/cjs/CompositionManagerProvider.js +100 -0
- package/dist/cjs/RemotionRoot.d.ts +1 -3
- package/dist/cjs/RemotionRoot.js +7 -61
- package/dist/cjs/Sequence.js +2 -1
- package/dist/cjs/TimelineContext.d.ts +22 -0
- package/dist/cjs/TimelineContext.js +89 -0
- package/dist/cjs/audio/shared-audio-tags.d.ts +1 -2
- package/dist/cjs/audio/shared-audio-tags.js +9 -1
- package/dist/cjs/cancel-render.d.ts +7 -0
- package/dist/cjs/cancel-render.js +16 -5
- package/dist/cjs/delay-render.d.ts +26 -2
- package/dist/cjs/delay-render.js +33 -20
- package/dist/cjs/freeze.js +3 -3
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/internals.d.ts +13 -4
- package/dist/cjs/internals.js +8 -0
- package/dist/cjs/timeline-position-state.d.ts +0 -15
- package/dist/cjs/timeline-position-state.js +6 -26
- package/dist/cjs/use-delay-render.d.ts +4 -1
- package/dist/cjs/use-delay-render.js +24 -6
- package/dist/cjs/use-media-in-timeline.js +2 -2
- package/dist/cjs/use-media-playback.js +2 -1
- package/dist/cjs/use-media-tag.js +2 -2
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/wrap-remotion-context.d.ts +2 -2
- package/dist/cjs/wrap-remotion-context.js +8 -8
- package/dist/esm/index.mjs +969 -916
- package/dist/esm/version.mjs +1 -1
- package/package.json +2 -2
package/dist/cjs/delay-render.js
CHANGED
|
@@ -22,9 +22,9 @@ const defaultTimeout = 30000;
|
|
|
22
22
|
* This allows useDelayRender to control its own environment source.
|
|
23
23
|
* @private
|
|
24
24
|
*/
|
|
25
|
-
const delayRenderInternal = (environment, label, options) => {
|
|
25
|
+
const delayRenderInternal = ({ scope, environment, label, options, }) => {
|
|
26
26
|
var _a, _b, _c, _d, _e;
|
|
27
|
-
if (typeof label !== 'string' &&
|
|
27
|
+
if (typeof label !== 'string' && label !== null) {
|
|
28
28
|
throw new Error('The label parameter of delayRender() must be a string or undefined, got: ' +
|
|
29
29
|
JSON.stringify(label));
|
|
30
30
|
}
|
|
@@ -32,12 +32,12 @@ const delayRenderInternal = (environment, label, options) => {
|
|
|
32
32
|
handles.push(handle);
|
|
33
33
|
const called = (_b = (_a = Error().stack) === null || _a === void 0 ? void 0 : _a.replace(/^Error/g, '')) !== null && _b !== void 0 ? _b : '';
|
|
34
34
|
if (environment.isRendering) {
|
|
35
|
-
const timeoutToUse = ((_c = options === null || options === void 0 ? void 0 : options.timeoutInMilliseconds) !== null && _c !== void 0 ? _c : (typeof
|
|
35
|
+
const timeoutToUse = ((_c = options === null || options === void 0 ? void 0 : options.timeoutInMilliseconds) !== null && _c !== void 0 ? _c : (typeof scope === 'undefined'
|
|
36
36
|
? defaultTimeout
|
|
37
|
-
: ((_d =
|
|
38
|
-
if (typeof
|
|
39
|
-
const retriesLeft = ((_e = options === null || options === void 0 ? void 0 : options.retries) !== null && _e !== void 0 ? _e : 0) - (
|
|
40
|
-
|
|
37
|
+
: ((_d = scope.remotion_puppeteerTimeout) !== null && _d !== void 0 ? _d : defaultTimeout))) - 2000;
|
|
38
|
+
if (typeof scope !== 'undefined') {
|
|
39
|
+
const retriesLeft = ((_e = options === null || options === void 0 ? void 0 : options.retries) !== null && _e !== void 0 ? _e : 0) - (scope.remotion_attempt - 1);
|
|
40
|
+
scope.remotion_delayRenderTimeouts[handle] = {
|
|
41
41
|
label: label !== null && label !== void 0 ? label : null,
|
|
42
42
|
startTime: Date.now(),
|
|
43
43
|
timeout: setTimeout(() => {
|
|
@@ -52,13 +52,13 @@ const delayRenderInternal = (environment, label, options) => {
|
|
|
52
52
|
]
|
|
53
53
|
.filter(truthy_js_1.truthy)
|
|
54
54
|
.join(' ');
|
|
55
|
-
(0, cancel_render_js_1.
|
|
55
|
+
(0, cancel_render_js_1.cancelRenderInternal)(scope, Error(message));
|
|
56
56
|
}, timeoutToUse),
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
if (typeof
|
|
61
|
-
|
|
60
|
+
if (typeof scope !== 'undefined') {
|
|
61
|
+
scope.remotion_renderReady = false;
|
|
62
62
|
}
|
|
63
63
|
return handle;
|
|
64
64
|
};
|
|
@@ -68,14 +68,19 @@ exports.delayRenderInternal = delayRenderInternal;
|
|
|
68
68
|
* @see [Documentation](https://remotion.dev/docs/delay-render)
|
|
69
69
|
*/
|
|
70
70
|
const delayRender = (label, options) => {
|
|
71
|
-
return (0, exports.delayRenderInternal)(
|
|
71
|
+
return (0, exports.delayRenderInternal)({
|
|
72
|
+
scope: typeof window !== 'undefined' ? window : undefined,
|
|
73
|
+
environment: (0, get_remotion_environment_js_1.getRemotionEnvironment)(),
|
|
74
|
+
label: label !== null && label !== void 0 ? label : null,
|
|
75
|
+
options: options !== null && options !== void 0 ? options : {},
|
|
76
|
+
});
|
|
72
77
|
};
|
|
73
78
|
exports.delayRender = delayRender;
|
|
74
79
|
/**
|
|
75
80
|
* Internal function that accepts environment as parameter.
|
|
76
81
|
* @private
|
|
77
82
|
*/
|
|
78
|
-
const continueRenderInternal = (handle, environment) => {
|
|
83
|
+
const continueRenderInternal = ({ scope, handle, environment, logLevel, }) => {
|
|
79
84
|
if (typeof handle === 'undefined') {
|
|
80
85
|
throw new TypeError('The continueRender() method must be called with a parameter that is the return value of delayRender(). No value was passed.');
|
|
81
86
|
}
|
|
@@ -85,11 +90,11 @@ const continueRenderInternal = (handle, environment) => {
|
|
|
85
90
|
}
|
|
86
91
|
handles = handles.filter((h) => {
|
|
87
92
|
if (h === handle) {
|
|
88
|
-
if (environment.isRendering) {
|
|
89
|
-
if (!
|
|
93
|
+
if (environment.isRendering && scope !== undefined) {
|
|
94
|
+
if (!scope.remotion_delayRenderTimeouts[handle]) {
|
|
90
95
|
return false;
|
|
91
96
|
}
|
|
92
|
-
const { label, startTime, timeout } =
|
|
97
|
+
const { label, startTime, timeout } = scope.remotion_delayRenderTimeouts[handle];
|
|
93
98
|
clearTimeout(timeout);
|
|
94
99
|
const message = [
|
|
95
100
|
label ? `"${label}"` : 'A handle',
|
|
@@ -98,15 +103,15 @@ const continueRenderInternal = (handle, environment) => {
|
|
|
98
103
|
]
|
|
99
104
|
.filter(truthy_js_1.truthy)
|
|
100
105
|
.join(' ');
|
|
101
|
-
log_js_1.Log.verbose({ logLevel
|
|
102
|
-
delete
|
|
106
|
+
log_js_1.Log.verbose({ logLevel, tag: 'delayRender()' }, message);
|
|
107
|
+
delete scope.remotion_delayRenderTimeouts[handle];
|
|
103
108
|
}
|
|
104
109
|
return false;
|
|
105
110
|
}
|
|
106
111
|
return true;
|
|
107
112
|
});
|
|
108
|
-
if (handles.length === 0 && typeof
|
|
109
|
-
|
|
113
|
+
if (handles.length === 0 && typeof scope !== 'undefined') {
|
|
114
|
+
scope.remotion_renderReady = true;
|
|
110
115
|
}
|
|
111
116
|
};
|
|
112
117
|
exports.continueRenderInternal = continueRenderInternal;
|
|
@@ -115,6 +120,14 @@ exports.continueRenderInternal = continueRenderInternal;
|
|
|
115
120
|
* @see [Documentation](https://remotion.dev/docs/continue-render)
|
|
116
121
|
*/
|
|
117
122
|
const continueRender = (handle) => {
|
|
118
|
-
|
|
123
|
+
var _a;
|
|
124
|
+
(0, exports.continueRenderInternal)({
|
|
125
|
+
scope: typeof window !== 'undefined' ? window : undefined,
|
|
126
|
+
handle,
|
|
127
|
+
environment: (0, get_remotion_environment_js_1.getRemotionEnvironment)(),
|
|
128
|
+
logLevel: typeof window !== 'undefined'
|
|
129
|
+
? ((_a = window.remotion_logLevel) !== null && _a !== void 0 ? _a : 'info')
|
|
130
|
+
: 'info',
|
|
131
|
+
});
|
|
119
132
|
};
|
|
120
133
|
exports.continueRender = continueRender;
|
package/dist/cjs/freeze.js
CHANGED
|
@@ -4,7 +4,7 @@ exports.Freeze = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const SequenceContext_js_1 = require("./SequenceContext.js");
|
|
7
|
-
const
|
|
7
|
+
const TimelineContext_js_1 = require("./TimelineContext.js");
|
|
8
8
|
const use_current_frame_js_1 = require("./use-current-frame.js");
|
|
9
9
|
const use_video_config_js_1 = require("./use-video-config.js");
|
|
10
10
|
/*
|
|
@@ -35,7 +35,7 @@ const Freeze = ({ frame: frameToFreeze, children, active = true, }) => {
|
|
|
35
35
|
return active(frame);
|
|
36
36
|
}
|
|
37
37
|
}, [active, frame]);
|
|
38
|
-
const timelineContext = (0, react_1.useContext)(
|
|
38
|
+
const timelineContext = (0, react_1.useContext)(TimelineContext_js_1.TimelineContext);
|
|
39
39
|
const sequenceContext = (0, react_1.useContext)(SequenceContext_js_1.SequenceContext);
|
|
40
40
|
const relativeFrom = (_a = sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.relativeFrom) !== null && _a !== void 0 ? _a : 0;
|
|
41
41
|
const timelineValue = (0, react_1.useMemo)(() => {
|
|
@@ -66,6 +66,6 @@ const Freeze = ({ frame: frameToFreeze, children, active = true, }) => {
|
|
|
66
66
|
cumulatedFrom: 0,
|
|
67
67
|
};
|
|
68
68
|
}, [sequenceContext, isActive]);
|
|
69
|
-
return ((0, jsx_runtime_1.jsx)(
|
|
69
|
+
return ((0, jsx_runtime_1.jsx)(TimelineContext_js_1.TimelineContext.Provider, { value: timelineValue, children: (0, jsx_runtime_1.jsx)(SequenceContext_js_1.SequenceContext.Provider, { value: newSequenceContext, children: children }) }));
|
|
70
70
|
};
|
|
71
71
|
exports.Freeze = Freeze;
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import './_check-rsc.js';
|
|
|
2
2
|
import './asset-types.js';
|
|
3
3
|
import type { Codec } from './codec.js';
|
|
4
4
|
import type { AnyCompMetadata, AnyComposition, AudioOrVideoAsset, LoopDisplay, TRenderAsset } from './CompositionManager.js';
|
|
5
|
+
import type { DelayRenderScope } from './delay-render.js';
|
|
5
6
|
import type { StaticFile } from './get-static-files.js';
|
|
6
7
|
import type { LogLevel } from './log.js';
|
|
7
8
|
import type { ProResProfile } from './prores-profile.js';
|
|
@@ -153,4 +154,5 @@ export type _InternalTypes = {
|
|
|
153
154
|
TRenderAsset: TRenderAsset;
|
|
154
155
|
LoopDisplay: LoopDisplay;
|
|
155
156
|
ProResProfile: ProResProfile;
|
|
157
|
+
DelayRenderScope: DelayRenderScope;
|
|
156
158
|
};
|
package/dist/cjs/internals.d.ts
CHANGED
|
@@ -5,8 +5,8 @@ import * as CSSUtils from './default-css.js';
|
|
|
5
5
|
import type { SerializedJSONWithCustomFields } from './input-props-serialization.js';
|
|
6
6
|
import type { LoggingContextValue } from './log-level-context.js';
|
|
7
7
|
import type { RemotionEnvironment } from './remotion-environment-context.js';
|
|
8
|
-
import type { SetTimelineContextValue, TimelineContextValue } from './timeline-position-state.js';
|
|
9
8
|
import * as TimelinePosition from './timeline-position-state.js';
|
|
9
|
+
import { type SetTimelineContextValue, type TimelineContextValue } from './TimelineContext.js';
|
|
10
10
|
import { truthy } from './truthy.js';
|
|
11
11
|
import type { MediaVolumeContextValue, SetMediaVolumeContextValue } from './volume-position-state.js';
|
|
12
12
|
import type { WatchRemotionStaticFilesPayload } from './watch-static-file.js';
|
|
@@ -75,12 +75,18 @@ export declare const Internals: {
|
|
|
75
75
|
readonly children: React.ReactNode;
|
|
76
76
|
readonly numberOfAudioTags: number;
|
|
77
77
|
readonly logLevel: import("./log.js").LogLevel;
|
|
78
|
-
readonly onlyRenderComposition: string | null;
|
|
79
|
-
readonly currentCompositionMetadata: import("./CompositionManagerContext.js").BaseMetadata | null;
|
|
80
78
|
readonly audioLatencyHint: AudioContextLatencyCategory;
|
|
81
79
|
readonly videoEnabled: boolean | null;
|
|
82
80
|
readonly audioEnabled: boolean | null;
|
|
81
|
+
readonly frameState: Record<string, number> | null;
|
|
83
82
|
}>;
|
|
83
|
+
readonly CompositionManagerProvider: ({ children, onlyRenderComposition, currentCompositionMetadata, initialCompositions, initialCanvasContent, }: {
|
|
84
|
+
readonly children: React.ReactNode;
|
|
85
|
+
readonly onlyRenderComposition: string | null;
|
|
86
|
+
readonly currentCompositionMetadata: import("./CompositionManagerContext.js").BaseMetadata | null;
|
|
87
|
+
readonly initialCompositions: import("./CompositionManager.js").AnyComposition[];
|
|
88
|
+
readonly initialCanvasContent: import("./CompositionManagerContext.js").CanvasContent | null;
|
|
89
|
+
}) => import("react/jsx-runtime.js").JSX.Element;
|
|
84
90
|
readonly useVideo: () => (import("./video-config.js").VideoConfig & {
|
|
85
91
|
component: import("react").LazyExoticComponent<import("react").ComponentType<Record<string, unknown>>> | import("react").ComponentType<Record<string, unknown>>;
|
|
86
92
|
}) | null;
|
|
@@ -144,7 +150,6 @@ export declare const Internals: {
|
|
|
144
150
|
readonly SharedAudioContextProvider: import("react").FC<{
|
|
145
151
|
readonly numberOfAudioTags: number;
|
|
146
152
|
readonly children: React.ReactNode;
|
|
147
|
-
readonly component: import("react").LazyExoticComponent<import("react").ComponentType<Record<string, unknown>>> | import("react").ComponentType<Record<string, unknown>> | null;
|
|
148
153
|
readonly audioLatencyHint: AudioContextLatencyCategory;
|
|
149
154
|
}>;
|
|
150
155
|
readonly invalidCompositionErrorMessage: string;
|
|
@@ -161,6 +166,7 @@ export declare const Internals: {
|
|
|
161
166
|
} | null>;
|
|
162
167
|
readonly portalNode: () => HTMLElement;
|
|
163
168
|
readonly waitForRoot: (fn: (comp: React.FC) => void) => (() => void);
|
|
169
|
+
readonly SetTimelineContext: import("react").Context<SetTimelineContextValue>;
|
|
164
170
|
readonly CanUseRemotionHooksProvider: import("react").FC<{
|
|
165
171
|
readonly children: React.ReactNode;
|
|
166
172
|
}>;
|
|
@@ -370,5 +376,8 @@ export declare const Internals: {
|
|
|
370
376
|
};
|
|
371
377
|
buffering: React.MutableRefObject<boolean>;
|
|
372
378
|
}) => boolean;
|
|
379
|
+
readonly TimelinePosition: typeof TimelinePosition;
|
|
380
|
+
readonly DelayRenderContextType: import("react").Context<import("./delay-render.js").DelayRenderScope | null>;
|
|
381
|
+
readonly TimelineContext: import("react").Context<TimelineContextValue>;
|
|
373
382
|
};
|
|
374
383
|
export type { CompositionManagerContext, CompProps, LoggingContextValue, MediaVolumeContextValue, RemotionEnvironment, SerializedJSONWithCustomFields, SetMediaVolumeContextValue, SetTimelineContextValue, TCompMetadata, TComposition, TimelineContextValue, TRenderAsset, TSequence, WatchRemotionStaticFilesPayload, };
|
package/dist/cjs/internals.js
CHANGED
|
@@ -44,6 +44,7 @@ const calculate_media_duration_js_1 = require("./calculate-media-duration.js");
|
|
|
44
44
|
const CanUseRemotionHooks_js_1 = require("./CanUseRemotionHooks.js");
|
|
45
45
|
const CompositionManager_js_1 = require("./CompositionManager.js");
|
|
46
46
|
const CompositionManagerContext_js_1 = require("./CompositionManagerContext.js");
|
|
47
|
+
const CompositionManagerProvider_js_1 = require("./CompositionManagerProvider.js");
|
|
47
48
|
const CSSUtils = __importStar(require("./default-css.js"));
|
|
48
49
|
const default_css_js_1 = require("./default-css.js");
|
|
49
50
|
const EditorProps_js_1 = require("./EditorProps.js");
|
|
@@ -70,8 +71,10 @@ const SequenceManager_js_1 = require("./SequenceManager.js");
|
|
|
70
71
|
const setup_env_variables_js_1 = require("./setup-env-variables.js");
|
|
71
72
|
const TimelinePosition = __importStar(require("./timeline-position-state.js"));
|
|
72
73
|
const timeline_position_state_js_1 = require("./timeline-position-state.js");
|
|
74
|
+
const TimelineContext_js_1 = require("./TimelineContext.js");
|
|
73
75
|
const truthy_js_1 = require("./truthy.js");
|
|
74
76
|
const use_current_scale_js_1 = require("./use-current-scale.js");
|
|
77
|
+
const use_delay_render_js_1 = require("./use-delay-render.js");
|
|
75
78
|
const use_lazy_component_js_1 = require("./use-lazy-component.js");
|
|
76
79
|
const use_media_enabled_js_1 = require("./use-media-enabled.js");
|
|
77
80
|
const use_media_in_timeline_js_1 = require("./use-media-in-timeline.js");
|
|
@@ -110,6 +113,7 @@ exports.Internals = {
|
|
|
110
113
|
SequenceManager: SequenceManager_js_1.SequenceManager,
|
|
111
114
|
SequenceVisibilityToggleContext: SequenceManager_js_1.SequenceVisibilityToggleContext,
|
|
112
115
|
RemotionRoot: RemotionRoot_js_1.RemotionRoot,
|
|
116
|
+
CompositionManagerProvider: CompositionManagerProvider_js_1.CompositionManagerProvider,
|
|
113
117
|
useVideo: use_video_js_1.useVideo,
|
|
114
118
|
getRoot: register_root_js_1.getRoot,
|
|
115
119
|
useMediaVolumeState: volume_position_state_js_1.useMediaVolumeState,
|
|
@@ -134,6 +138,7 @@ exports.Internals = {
|
|
|
134
138
|
compositionsRef: CompositionManager_js_1.compositionsRef,
|
|
135
139
|
portalNode: portal_node_js_1.portalNode,
|
|
136
140
|
waitForRoot: register_root_js_1.waitForRoot,
|
|
141
|
+
SetTimelineContext: TimelineContext_js_1.SetTimelineContext,
|
|
137
142
|
CanUseRemotionHooksProvider: CanUseRemotionHooks_js_1.CanUseRemotionHooksProvider,
|
|
138
143
|
CanUseRemotionHooks: CanUseRemotionHooks_js_1.CanUseRemotionHooks,
|
|
139
144
|
PrefetchProvider: prefetch_state_js_1.PrefetchProvider,
|
|
@@ -183,4 +188,7 @@ exports.Internals = {
|
|
|
183
188
|
useVideoEnabled: use_media_enabled_js_1.useVideoEnabled,
|
|
184
189
|
useAudioEnabled: use_media_enabled_js_1.useAudioEnabled,
|
|
185
190
|
useIsPlayerBuffering: buffering_js_1.useIsPlayerBuffering,
|
|
191
|
+
TimelinePosition,
|
|
192
|
+
DelayRenderContextType: use_delay_render_js_1.DelayRenderContextType,
|
|
193
|
+
TimelineContext: TimelineContext_js_1.TimelineContext,
|
|
186
194
|
};
|
|
@@ -3,21 +3,6 @@ export type PlayableMediaTag = {
|
|
|
3
3
|
play: (reason: string) => void;
|
|
4
4
|
id: string;
|
|
5
5
|
};
|
|
6
|
-
export type TimelineContextValue = {
|
|
7
|
-
frame: Record<string, number>;
|
|
8
|
-
playing: boolean;
|
|
9
|
-
rootId: string;
|
|
10
|
-
playbackRate: number;
|
|
11
|
-
imperativePlaying: MutableRefObject<boolean>;
|
|
12
|
-
setPlaybackRate: (u: React.SetStateAction<number>) => void;
|
|
13
|
-
audioAndVideoTags: MutableRefObject<PlayableMediaTag[]>;
|
|
14
|
-
};
|
|
15
|
-
export type SetTimelineContextValue = {
|
|
16
|
-
setFrame: (u: React.SetStateAction<Record<string, number>>) => void;
|
|
17
|
-
setPlaying: (u: React.SetStateAction<boolean>) => void;
|
|
18
|
-
};
|
|
19
|
-
export declare const TimelineContext: import("react").Context<TimelineContextValue>;
|
|
20
|
-
export declare const SetTimelineContext: import("react").Context<SetTimelineContextValue>;
|
|
21
6
|
type CurrentTimePerComposition = Record<string, number>;
|
|
22
7
|
export declare const persistCurrentFrame: (time: CurrentTimePerComposition) => void;
|
|
23
8
|
export declare const getInitialFrameState: () => CurrentTimePerComposition;
|
|
@@ -1,30 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.usePlayingState = exports.useTimelineSetFrame = exports.useTimelinePosition = exports.getFrameForComposition = exports.getInitialFrameState = exports.persistCurrentFrame =
|
|
3
|
+
exports.usePlayingState = exports.useTimelineSetFrame = exports.useTimelinePosition = exports.getFrameForComposition = exports.getInitialFrameState = exports.persistCurrentFrame = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
+
const TimelineContext_js_1 = require("./TimelineContext.js");
|
|
5
6
|
const use_remotion_environment_js_1 = require("./use-remotion-environment.js");
|
|
6
7
|
const use_video_js_1 = require("./use-video.js");
|
|
7
|
-
exports.TimelineContext = (0, react_1.createContext)({
|
|
8
|
-
frame: {},
|
|
9
|
-
playing: false,
|
|
10
|
-
playbackRate: 1,
|
|
11
|
-
rootId: '',
|
|
12
|
-
imperativePlaying: {
|
|
13
|
-
current: false,
|
|
14
|
-
},
|
|
15
|
-
setPlaybackRate: () => {
|
|
16
|
-
throw new Error('default');
|
|
17
|
-
},
|
|
18
|
-
audioAndVideoTags: { current: [] },
|
|
19
|
-
});
|
|
20
|
-
exports.SetTimelineContext = (0, react_1.createContext)({
|
|
21
|
-
setFrame: () => {
|
|
22
|
-
throw new Error('default');
|
|
23
|
-
},
|
|
24
|
-
setPlaying: () => {
|
|
25
|
-
throw new Error('default');
|
|
26
|
-
},
|
|
27
|
-
});
|
|
28
8
|
const makeKey = () => {
|
|
29
9
|
return `remotion.time-all`;
|
|
30
10
|
};
|
|
@@ -55,7 +35,7 @@ exports.getFrameForComposition = getFrameForComposition;
|
|
|
55
35
|
const useTimelinePosition = () => {
|
|
56
36
|
var _a, _b;
|
|
57
37
|
const videoConfig = (0, use_video_js_1.useVideo)();
|
|
58
|
-
const state = (0, react_1.useContext)(
|
|
38
|
+
const state = (0, react_1.useContext)(TimelineContext_js_1.TimelineContext);
|
|
59
39
|
const env = (0, use_remotion_environment_js_1.useRemotionEnvironment)();
|
|
60
40
|
if (!videoConfig) {
|
|
61
41
|
return typeof window === 'undefined'
|
|
@@ -67,13 +47,13 @@ const useTimelinePosition = () => {
|
|
|
67
47
|
};
|
|
68
48
|
exports.useTimelinePosition = useTimelinePosition;
|
|
69
49
|
const useTimelineSetFrame = () => {
|
|
70
|
-
const { setFrame } = (0, react_1.useContext)(
|
|
50
|
+
const { setFrame } = (0, react_1.useContext)(TimelineContext_js_1.SetTimelineContext);
|
|
71
51
|
return setFrame;
|
|
72
52
|
};
|
|
73
53
|
exports.useTimelineSetFrame = useTimelineSetFrame;
|
|
74
54
|
const usePlayingState = () => {
|
|
75
|
-
const { playing, imperativePlaying } = (0, react_1.useContext)(
|
|
76
|
-
const { setPlaying } = (0, react_1.useContext)(
|
|
55
|
+
const { playing, imperativePlaying } = (0, react_1.useContext)(TimelineContext_js_1.TimelineContext);
|
|
56
|
+
const { setPlaying } = (0, react_1.useContext)(TimelineContext_js_1.SetTimelineContext);
|
|
77
57
|
return (0, react_1.useMemo)(() => [playing, setPlaying, imperativePlaying], [imperativePlaying, playing, setPlaying]);
|
|
78
58
|
};
|
|
79
59
|
exports.usePlayingState = usePlayingState;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import type { DelayRenderOptions } from './delay-render.js';
|
|
1
|
+
import type { DelayRenderOptions, DelayRenderScope } from './delay-render.js';
|
|
2
2
|
type DelayRenderFn = (label?: string, options?: DelayRenderOptions) => number;
|
|
3
3
|
type ContinueRenderFn = (handle: number) => void;
|
|
4
|
+
type CancelRenderFn = (err: unknown) => never;
|
|
5
|
+
export declare const DelayRenderContextType: import("react").Context<DelayRenderScope | null>;
|
|
4
6
|
export declare const useDelayRender: () => {
|
|
5
7
|
delayRender: DelayRenderFn;
|
|
6
8
|
continueRender: ContinueRenderFn;
|
|
9
|
+
cancelRender: CancelRenderFn;
|
|
7
10
|
};
|
|
8
11
|
export {};
|
|
@@ -1,17 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useDelayRender = void 0;
|
|
3
|
+
exports.useDelayRender = exports.DelayRenderContextType = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
+
const cancel_render_js_1 = require("./cancel-render.js");
|
|
5
6
|
const delay_render_js_1 = require("./delay-render.js");
|
|
7
|
+
const log_level_context_js_1 = require("./log-level-context.js");
|
|
6
8
|
const use_remotion_environment_js_1 = require("./use-remotion-environment.js");
|
|
9
|
+
exports.DelayRenderContextType = (0, react_1.createContext)(null);
|
|
7
10
|
const useDelayRender = () => {
|
|
8
11
|
const environment = (0, use_remotion_environment_js_1.useRemotionEnvironment)();
|
|
12
|
+
const scope = (0, react_1.useContext)(exports.DelayRenderContextType);
|
|
13
|
+
const logLevel = (0, log_level_context_js_1.useLogLevel)();
|
|
9
14
|
const delayRender = (0, react_1.useCallback)((label, options) => {
|
|
10
|
-
return (0, delay_render_js_1.delayRenderInternal)(
|
|
11
|
-
|
|
15
|
+
return (0, delay_render_js_1.delayRenderInternal)({
|
|
16
|
+
scope: scope !== null && scope !== void 0 ? scope : (typeof window !== 'undefined' ? window : undefined),
|
|
17
|
+
environment,
|
|
18
|
+
label: label !== null && label !== void 0 ? label : null,
|
|
19
|
+
options: options !== null && options !== void 0 ? options : {},
|
|
20
|
+
});
|
|
21
|
+
}, [environment, scope]);
|
|
12
22
|
const continueRender = (0, react_1.useCallback)((handle) => {
|
|
13
|
-
(0, delay_render_js_1.continueRenderInternal)(
|
|
14
|
-
|
|
15
|
-
|
|
23
|
+
(0, delay_render_js_1.continueRenderInternal)({
|
|
24
|
+
scope: scope !== null && scope !== void 0 ? scope : (typeof window !== 'undefined' ? window : undefined),
|
|
25
|
+
handle,
|
|
26
|
+
environment,
|
|
27
|
+
logLevel,
|
|
28
|
+
});
|
|
29
|
+
}, [environment, logLevel, scope]);
|
|
30
|
+
const cancelRender = (0, react_1.useCallback)((err) => {
|
|
31
|
+
return (0, cancel_render_js_1.cancelRenderInternal)(scope !== null && scope !== void 0 ? scope : (typeof window !== 'undefined' ? window : undefined), err);
|
|
32
|
+
}, [scope]);
|
|
33
|
+
return { delayRender, continueRender, cancelRender };
|
|
16
34
|
};
|
|
17
35
|
exports.useDelayRender = useDelayRender;
|
|
@@ -4,11 +4,11 @@ exports.useMediaInTimeline = exports.useBasicMediaInTimeline = void 0;
|
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const SequenceContext_js_1 = require("./SequenceContext.js");
|
|
6
6
|
const SequenceManager_js_1 = require("./SequenceManager.js");
|
|
7
|
+
const TimelineContext_js_1 = require("./TimelineContext.js");
|
|
7
8
|
const use_audio_frame_js_1 = require("./audio/use-audio-frame.js");
|
|
8
9
|
const calculate_media_duration_js_1 = require("./calculate-media-duration.js");
|
|
9
10
|
const get_asset_file_name_js_1 = require("./get-asset-file-name.js");
|
|
10
11
|
const nonce_js_1 = require("./nonce.js");
|
|
11
|
-
const timeline_position_state_js_1 = require("./timeline-position-state.js");
|
|
12
12
|
const use_remotion_environment_js_1 = require("./use-remotion-environment.js");
|
|
13
13
|
const use_video_config_js_1 = require("./use-video-config.js");
|
|
14
14
|
const volume_prop_js_1 = require("./volume-prop.js");
|
|
@@ -60,7 +60,7 @@ const useBasicMediaInTimeline = ({ volume, mediaVolume, mediaType, src, displayN
|
|
|
60
60
|
}, [initialVolume, mediaType, src, volume]);
|
|
61
61
|
const doesVolumeChange = typeof volume === 'function';
|
|
62
62
|
const nonce = (0, nonce_js_1.useNonce)();
|
|
63
|
-
const { rootId } = (0, react_1.useContext)(
|
|
63
|
+
const { rootId } = (0, react_1.useContext)(TimelineContext_js_1.TimelineContext);
|
|
64
64
|
const env = (0, use_remotion_environment_js_1.useRemotionEnvironment)();
|
|
65
65
|
return {
|
|
66
66
|
volumes,
|
|
@@ -12,6 +12,7 @@ const play_and_handle_not_allowed_error_js_1 = require("./play-and-handle-not-al
|
|
|
12
12
|
const playback_logging_js_1 = require("./playback-logging.js");
|
|
13
13
|
const seek_js_1 = require("./seek.js");
|
|
14
14
|
const timeline_position_state_js_1 = require("./timeline-position-state.js");
|
|
15
|
+
const TimelineContext_js_1 = require("./TimelineContext.js");
|
|
15
16
|
const use_current_frame_js_1 = require("./use-current-frame.js");
|
|
16
17
|
const use_media_buffering_js_1 = require("./use-media-buffering.js");
|
|
17
18
|
const use_remotion_environment_js_1 = require("./use-remotion-environment.js");
|
|
@@ -20,7 +21,7 @@ const use_video_config_js_1 = require("./use-video-config.js");
|
|
|
20
21
|
const get_current_time_js_1 = require("./video/get-current-time.js");
|
|
21
22
|
const warn_about_non_seekable_media_js_1 = require("./warn-about-non-seekable-media.js");
|
|
22
23
|
const useMediaPlayback = ({ mediaRef, src, mediaType, playbackRate: localPlaybackRate, onlyWarnForMediaSeekingError, acceptableTimeshift, pauseWhenBuffering, isPremounting, isPostmounting, onAutoPlayError, }) => {
|
|
23
|
-
const { playbackRate: globalPlaybackRate } = (0, react_1.useContext)(
|
|
24
|
+
const { playbackRate: globalPlaybackRate } = (0, react_1.useContext)(TimelineContext_js_1.TimelineContext);
|
|
24
25
|
const frame = (0, use_current_frame_js_1.useCurrentFrame)();
|
|
25
26
|
const absoluteFrame = (0, timeline_position_state_js_1.useTimelinePosition)();
|
|
26
27
|
const [playing] = (0, timeline_position_state_js_1.usePlayingState)();
|
|
@@ -4,10 +4,10 @@ exports.useMediaTag = void 0;
|
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const log_level_context_js_1 = require("./log-level-context.js");
|
|
6
6
|
const play_and_handle_not_allowed_error_js_1 = require("./play-and-handle-not-allowed-error.js");
|
|
7
|
-
const
|
|
7
|
+
const TimelineContext_js_1 = require("./TimelineContext.js");
|
|
8
8
|
const use_remotion_environment_js_1 = require("./use-remotion-environment.js");
|
|
9
9
|
const useMediaTag = ({ mediaRef, id, mediaType, onAutoPlayError, isPremounting, isPostmounting, }) => {
|
|
10
|
-
const { audioAndVideoTags, imperativePlaying } = (0, react_1.useContext)(
|
|
10
|
+
const { audioAndVideoTags, imperativePlaying } = (0, react_1.useContext)(TimelineContext_js_1.TimelineContext);
|
|
11
11
|
const logLevel = (0, log_level_context_js_1.useLogLevel)();
|
|
12
12
|
const mountTime = (0, log_level_context_js_1.useMountTime)();
|
|
13
13
|
const env = (0, use_remotion_environment_js_1.useRemotionEnvironment)();
|
package/dist/cjs/version.d.ts
CHANGED
package/dist/cjs/version.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export declare function useRemotionContexts(): {
|
|
3
3
|
compositionManagerCtx: import("./CompositionManagerContext.js").CompositionManagerContext;
|
|
4
|
-
timelineContext: import("./
|
|
5
|
-
setTimelineContext: import("./
|
|
4
|
+
timelineContext: import("./TimelineContext.js").TimelineContextValue;
|
|
5
|
+
setTimelineContext: import("./TimelineContext.js").SetTimelineContextValue;
|
|
6
6
|
sequenceContext: import("./SequenceContext.js").SequenceContextType | null;
|
|
7
7
|
nonceContext: import("./nonce.js").TNonceContext;
|
|
8
8
|
canUseRemotionHooksContext: boolean;
|
|
@@ -40,21 +40,21 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
40
40
|
// such as in React Three Fiber. All the contexts need to be passed again
|
|
41
41
|
// for them to be useable
|
|
42
42
|
const react_1 = __importStar(require("react"));
|
|
43
|
+
const buffering_js_1 = require("./buffering.js");
|
|
43
44
|
const CanUseRemotionHooks_js_1 = require("./CanUseRemotionHooks.js");
|
|
44
45
|
const CompositionManagerContext_js_1 = require("./CompositionManagerContext.js");
|
|
46
|
+
const log_level_context_js_1 = require("./log-level-context.js");
|
|
47
|
+
const nonce_js_1 = require("./nonce.js");
|
|
48
|
+
const prefetch_state_js_1 = require("./prefetch-state.js");
|
|
45
49
|
const RenderAssetManager_js_1 = require("./RenderAssetManager.js");
|
|
46
50
|
const ResolveCompositionConfig_js_1 = require("./ResolveCompositionConfig.js");
|
|
47
51
|
const SequenceContext_js_1 = require("./SequenceContext.js");
|
|
48
52
|
const SequenceManager_js_1 = require("./SequenceManager.js");
|
|
49
|
-
const
|
|
50
|
-
const log_level_context_js_1 = require("./log-level-context.js");
|
|
51
|
-
const nonce_js_1 = require("./nonce.js");
|
|
52
|
-
const prefetch_state_js_1 = require("./prefetch-state.js");
|
|
53
|
-
const timeline_position_state_js_1 = require("./timeline-position-state.js");
|
|
53
|
+
const TimelineContext_js_1 = require("./TimelineContext.js");
|
|
54
54
|
function useRemotionContexts() {
|
|
55
55
|
const compositionManagerCtx = react_1.default.useContext(CompositionManagerContext_js_1.CompositionManager);
|
|
56
|
-
const timelineContext = react_1.default.useContext(
|
|
57
|
-
const setTimelineContext = react_1.default.useContext(
|
|
56
|
+
const timelineContext = react_1.default.useContext(TimelineContext_js_1.TimelineContext);
|
|
57
|
+
const setTimelineContext = react_1.default.useContext(TimelineContext_js_1.SetTimelineContext);
|
|
58
58
|
const sequenceContext = react_1.default.useContext(SequenceContext_js_1.SequenceContext);
|
|
59
59
|
const nonceContext = react_1.default.useContext(nonce_js_1.NonceContext);
|
|
60
60
|
const canUseRemotionHooksContext = react_1.default.useContext(CanUseRemotionHooks_js_1.CanUseRemotionHooks);
|
|
@@ -94,6 +94,6 @@ function useRemotionContexts() {
|
|
|
94
94
|
}
|
|
95
95
|
const RemotionContextProvider = (props) => {
|
|
96
96
|
const { children, contexts } = props;
|
|
97
|
-
return ((0, jsx_runtime_1.jsx)(log_level_context_js_1.LogLevelContext.Provider, { value: contexts.logLevelContext, children: (0, jsx_runtime_1.jsx)(CanUseRemotionHooks_js_1.CanUseRemotionHooks.Provider, { value: contexts.canUseRemotionHooksContext, children: (0, jsx_runtime_1.jsx)(nonce_js_1.NonceContext.Provider, { value: contexts.nonceContext, children: (0, jsx_runtime_1.jsx)(prefetch_state_js_1.PreloadContext.Provider, { value: contexts.preloadContext, children: (0, jsx_runtime_1.jsx)(CompositionManagerContext_js_1.CompositionManager.Provider, { value: contexts.compositionManagerCtx, children: (0, jsx_runtime_1.jsx)(SequenceManager_js_1.SequenceManager.Provider, { value: contexts.sequenceManagerContext, children: (0, jsx_runtime_1.jsx)(RenderAssetManager_js_1.RenderAssetManager.Provider, { value: contexts.renderAssetManagerContext, children: (0, jsx_runtime_1.jsx)(ResolveCompositionConfig_js_1.ResolveCompositionContext.Provider, { value: contexts.resolveCompositionContext, children: (0, jsx_runtime_1.jsx)(
|
|
97
|
+
return ((0, jsx_runtime_1.jsx)(log_level_context_js_1.LogLevelContext.Provider, { value: contexts.logLevelContext, children: (0, jsx_runtime_1.jsx)(CanUseRemotionHooks_js_1.CanUseRemotionHooks.Provider, { value: contexts.canUseRemotionHooksContext, children: (0, jsx_runtime_1.jsx)(nonce_js_1.NonceContext.Provider, { value: contexts.nonceContext, children: (0, jsx_runtime_1.jsx)(prefetch_state_js_1.PreloadContext.Provider, { value: contexts.preloadContext, children: (0, jsx_runtime_1.jsx)(CompositionManagerContext_js_1.CompositionManager.Provider, { value: contexts.compositionManagerCtx, children: (0, jsx_runtime_1.jsx)(SequenceManager_js_1.SequenceManager.Provider, { value: contexts.sequenceManagerContext, children: (0, jsx_runtime_1.jsx)(RenderAssetManager_js_1.RenderAssetManager.Provider, { value: contexts.renderAssetManagerContext, children: (0, jsx_runtime_1.jsx)(ResolveCompositionConfig_js_1.ResolveCompositionContext.Provider, { value: contexts.resolveCompositionContext, children: (0, jsx_runtime_1.jsx)(TimelineContext_js_1.TimelineContext.Provider, { value: contexts.timelineContext, children: (0, jsx_runtime_1.jsx)(TimelineContext_js_1.SetTimelineContext.Provider, { value: contexts.setTimelineContext, children: (0, jsx_runtime_1.jsx)(SequenceContext_js_1.SequenceContext.Provider, { value: contexts.sequenceContext, children: (0, jsx_runtime_1.jsx)(buffering_js_1.BufferingContextReact.Provider, { value: contexts.bufferManagerContext, children: children }) }) }) }) }) }) }) }) }) }) }) }));
|
|
98
98
|
};
|
|
99
99
|
exports.RemotionContextProvider = RemotionContextProvider;
|