remotion 4.0.379 → 4.0.380
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/RemotionRoot.js +12 -1
- package/dist/cjs/audio/shared-audio-tags.d.ts +2 -1
- package/dist/cjs/audio/shared-audio-tags.js +1 -9
- package/dist/cjs/calculate-loop.d.ts +6 -0
- package/dist/cjs/calculate-loop.js +17 -0
- package/dist/cjs/internals.d.ts +1 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/video/use-audio-channel-index.d.ts +4 -0
- package/dist/cjs/video/use-audio-channel-index.js +13 -0
- package/dist/esm/index.mjs +20 -17
- package/dist/esm/index.mjs.map +137 -0
- package/dist/esm/version.mjs +1 -1
- package/package.json +2 -2
package/dist/cjs/RemotionRoot.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.RemotionRootContexts = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
+
const CompositionManagerContext_js_1 = require("./CompositionManagerContext.js");
|
|
6
7
|
const EditorProps_js_1 = require("./EditorProps.js");
|
|
7
8
|
const SequenceManager_js_1 = require("./SequenceManager.js");
|
|
8
9
|
const TimelineContext_js_1 = require("./TimelineContext.js");
|
|
@@ -14,6 +15,7 @@ const prefetch_state_js_1 = require("./prefetch-state.js");
|
|
|
14
15
|
const use_media_enabled_js_1 = require("./use-media-enabled.js");
|
|
15
16
|
const duration_state_js_1 = require("./video/duration-state.js");
|
|
16
17
|
const RemotionRootContexts = ({ children, numberOfAudioTags, logLevel, audioLatencyHint, videoEnabled, audioEnabled, frameState, }) => {
|
|
18
|
+
var _a;
|
|
17
19
|
const [fastRefreshes, setFastRefreshes] = (0, react_1.useState)(0);
|
|
18
20
|
const [manualRefreshes, setManualRefreshes] = (0, react_1.useState)(0);
|
|
19
21
|
const nonceContext = (0, react_1.useMemo)(() => {
|
|
@@ -45,6 +47,15 @@ const RemotionRootContexts = ({ children, numberOfAudioTags, logLevel, audioLate
|
|
|
45
47
|
const logging = (0, react_1.useMemo)(() => {
|
|
46
48
|
return { logLevel, mountTime: Date.now() };
|
|
47
49
|
}, [logLevel]);
|
|
48
|
-
|
|
50
|
+
const compositionManager = (0, react_1.useContext)(CompositionManagerContext_js_1.CompositionManager);
|
|
51
|
+
const composition = (0, react_1.useMemo)(() => {
|
|
52
|
+
return compositionManager.compositions.find((c) => {
|
|
53
|
+
var _a;
|
|
54
|
+
return ((_a = compositionManager.canvasContent) === null || _a === void 0 ? void 0 : _a.type) === 'composition'
|
|
55
|
+
? c.id === compositionManager.canvasContent.compositionId
|
|
56
|
+
: false;
|
|
57
|
+
});
|
|
58
|
+
}, [compositionManager.compositions, compositionManager.canvasContent]);
|
|
59
|
+
return ((0, jsx_runtime_1.jsx)(log_level_context_js_1.LogLevelContext.Provider, { value: logging, children: (0, jsx_runtime_1.jsx)(nonce_js_1.NonceContext.Provider, { value: nonceContext, children: (0, jsx_runtime_1.jsx)(nonce_js_1.SetNonceContext.Provider, { value: setNonceContext, children: (0, jsx_runtime_1.jsx)(TimelineContext_js_1.TimelineContextProvider, { frameState: frameState, children: (0, jsx_runtime_1.jsx)(use_media_enabled_js_1.MediaEnabledProvider, { videoEnabled: videoEnabled, audioEnabled: audioEnabled, children: (0, jsx_runtime_1.jsx)(EditorProps_js_1.EditorPropsProvider, { children: (0, jsx_runtime_1.jsx)(prefetch_state_js_1.PrefetchProvider, { children: (0, jsx_runtime_1.jsx)(SequenceManager_js_1.SequenceManagerProvider, { children: (0, jsx_runtime_1.jsx)(shared_audio_tags_js_1.SharedAudioContextProvider, { numberOfAudioTags: numberOfAudioTags, audioLatencyHint: audioLatencyHint, component: (_a = composition === null || composition === void 0 ? void 0 : composition.component) !== null && _a !== void 0 ? _a : null, children: (0, jsx_runtime_1.jsx)(duration_state_js_1.DurationsContextProvider, { children: (0, jsx_runtime_1.jsx)(buffering_js_1.BufferingProvider, { children: children }) }) }) }) }) }) }) }) }) }) }));
|
|
49
60
|
};
|
|
50
61
|
exports.RemotionRootContexts = RemotionRootContexts;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AudioHTMLAttributes } from 'react';
|
|
1
|
+
import type { AudioHTMLAttributes, ComponentType, LazyExoticComponent } from 'react';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import type { SharedElementSourceNode } from './shared-element-source-node.js';
|
|
4
4
|
/**
|
|
@@ -42,6 +42,7 @@ export declare const SharedAudioContextProvider: React.FC<{
|
|
|
42
42
|
readonly numberOfAudioTags: number;
|
|
43
43
|
readonly children: React.ReactNode;
|
|
44
44
|
readonly audioLatencyHint: AudioContextLatencyCategory;
|
|
45
|
+
readonly component: LazyExoticComponent<ComponentType<Record<string, unknown>>> | ComponentType<Record<string, unknown>> | null;
|
|
45
46
|
}>;
|
|
46
47
|
export declare const useSharedAudio: ({ aud, audioId, premounting, }: {
|
|
47
48
|
aud: AudioHTMLAttributes<HTMLAudioElement>;
|
|
@@ -36,7 +36,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.useSharedAudio = exports.SharedAudioContextProvider = exports.SharedAudioContext = void 0;
|
|
37
37
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
38
|
const react_1 = __importStar(require("react"));
|
|
39
|
-
const CompositionManagerContext_js_1 = require("../CompositionManagerContext.js");
|
|
40
39
|
const log_level_context_js_1 = require("../log-level-context.js");
|
|
41
40
|
const play_and_handle_not_allowed_error_js_1 = require("../play-and-handle-not-allowed-error.js");
|
|
42
41
|
const use_remotion_environment_js_1 = require("../use-remotion-environment.js");
|
|
@@ -75,19 +74,12 @@ const didPropChange = (key, newProp, prevProp) => {
|
|
|
75
74
|
return true;
|
|
76
75
|
};
|
|
77
76
|
exports.SharedAudioContext = (0, react_1.createContext)(null);
|
|
78
|
-
const SharedAudioContextProvider = ({ children, numberOfAudioTags, audioLatencyHint }) => {
|
|
77
|
+
const SharedAudioContextProvider = ({ children, numberOfAudioTags, audioLatencyHint, component }) => {
|
|
79
78
|
const audios = (0, react_1.useRef)([]);
|
|
80
79
|
const [initialNumberOfAudioTags] = (0, react_1.useState)(numberOfAudioTags);
|
|
81
80
|
if (numberOfAudioTags !== initialNumberOfAudioTags) {
|
|
82
81
|
throw new Error('The number of shared audio tags has changed dynamically. Once you have set this property, you cannot change it afterwards.');
|
|
83
82
|
}
|
|
84
|
-
const compositionManager = (0, react_1.useContext)(CompositionManagerContext_js_1.CompositionManager);
|
|
85
|
-
const component = compositionManager.compositions.find((c) => {
|
|
86
|
-
var _a;
|
|
87
|
-
return ((_a = compositionManager.canvasContent) === null || _a === void 0 ? void 0 : _a.type) === 'composition'
|
|
88
|
-
? c.id === compositionManager.canvasContent.compositionId
|
|
89
|
-
: null;
|
|
90
|
-
});
|
|
91
83
|
const logLevel = (0, log_level_context_js_1.useLogLevel)();
|
|
92
84
|
const audioContext = (0, use_audio_context_js_1.useSingletonAudioContext)(logLevel, audioLatencyHint);
|
|
93
85
|
const refs = (0, react_1.useMemo)(() => {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.calculateLoopDuration = void 0;
|
|
4
|
+
const calculateLoopDuration = ({ endAt, mediaDuration, playbackRate, startFrom, }) => {
|
|
5
|
+
let duration = mediaDuration;
|
|
6
|
+
// Account for endAt
|
|
7
|
+
if (typeof endAt !== 'undefined') {
|
|
8
|
+
duration = endAt;
|
|
9
|
+
}
|
|
10
|
+
// Account for startFrom
|
|
11
|
+
if (typeof startFrom !== 'undefined') {
|
|
12
|
+
duration -= startFrom;
|
|
13
|
+
}
|
|
14
|
+
const actualDuration = duration / playbackRate;
|
|
15
|
+
return Math.floor(actualDuration);
|
|
16
|
+
};
|
|
17
|
+
exports.calculateLoopDuration = calculateLoopDuration;
|
package/dist/cjs/internals.d.ts
CHANGED
|
@@ -152,6 +152,7 @@ export declare const Internals: {
|
|
|
152
152
|
readonly numberOfAudioTags: number;
|
|
153
153
|
readonly children: React.ReactNode;
|
|
154
154
|
readonly audioLatencyHint: AudioContextLatencyCategory;
|
|
155
|
+
readonly component: import("react").LazyExoticComponent<import("react").ComponentType<Record<string, unknown>>> | import("react").ComponentType<Record<string, unknown>> | null;
|
|
155
156
|
}>;
|
|
156
157
|
readonly invalidCompositionErrorMessage: string;
|
|
157
158
|
readonly calculateMediaDuration: ({ trimAfter, mediaDurationInFrames, playbackRate, trimBefore, }: {
|
package/dist/cjs/version.d.ts
CHANGED
package/dist/cjs/version.js
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useAudioChannelIndex = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const useAudioChannelIndex = ({ ref, audioChannelIndex, }) => {
|
|
6
|
+
(0, react_1.useEffect)(() => {
|
|
7
|
+
var _a;
|
|
8
|
+
// @ts-expect-error
|
|
9
|
+
const audioChannels = (_a = ref === null || ref === void 0 ? void 0 : ref.current) === null || _a === void 0 ? void 0 : _a.audioTracks;
|
|
10
|
+
console.log({ audioChannels, audioChannelIndex });
|
|
11
|
+
}, [ref, audioChannelIndex]);
|
|
12
|
+
};
|
|
13
|
+
exports.useAudioChannelIndex = useAudioChannelIndex;
|
package/dist/esm/index.mjs
CHANGED
|
@@ -110,7 +110,7 @@ function truthy(value) {
|
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
// src/version.ts
|
|
113
|
-
var VERSION = "4.0.
|
|
113
|
+
var VERSION = "4.0.380";
|
|
114
114
|
|
|
115
115
|
// src/multiple-versions-warning.ts
|
|
116
116
|
var checkMultipleRemotionVersions = () => {
|
|
@@ -3152,14 +3152,12 @@ var didPropChange = (key, newProp, prevProp) => {
|
|
|
3152
3152
|
return true;
|
|
3153
3153
|
};
|
|
3154
3154
|
var SharedAudioContext = createContext16(null);
|
|
3155
|
-
var SharedAudioContextProvider = ({ children, numberOfAudioTags, audioLatencyHint }) => {
|
|
3155
|
+
var SharedAudioContextProvider = ({ children, numberOfAudioTags, audioLatencyHint, component }) => {
|
|
3156
3156
|
const audios = useRef5([]);
|
|
3157
3157
|
const [initialNumberOfAudioTags] = useState11(numberOfAudioTags);
|
|
3158
3158
|
if (numberOfAudioTags !== initialNumberOfAudioTags) {
|
|
3159
3159
|
throw new Error("The number of shared audio tags has changed dynamically. Once you have set this property, you cannot change it afterwards.");
|
|
3160
3160
|
}
|
|
3161
|
-
const compositionManager = useContext16(CompositionManager);
|
|
3162
|
-
const component = compositionManager.compositions.find((c) => compositionManager.canvasContent?.type === "composition" ? c.id === compositionManager.canvasContent.compositionId : null);
|
|
3163
3161
|
const logLevel = useLogLevel();
|
|
3164
3162
|
const audioContext = useSingletonAudioContext(logLevel, audioLatencyHint);
|
|
3165
3163
|
const refs = useMemo15(() => {
|
|
@@ -6095,7 +6093,7 @@ var waitForRoot = (fn) => {
|
|
|
6095
6093
|
};
|
|
6096
6094
|
|
|
6097
6095
|
// src/RemotionRoot.tsx
|
|
6098
|
-
import { useEffect as useEffect17, useMemo as useMemo27, useState as useState18 } from "react";
|
|
6096
|
+
import { useContext as useContext32, useEffect as useEffect17, useMemo as useMemo27, useState as useState18 } from "react";
|
|
6099
6097
|
|
|
6100
6098
|
// src/use-media-enabled.tsx
|
|
6101
6099
|
import { createContext as createContext19, useContext as useContext31, useMemo as useMemo26 } from "react";
|
|
@@ -6175,6 +6173,10 @@ var RemotionRootContexts = ({
|
|
|
6175
6173
|
const logging = useMemo27(() => {
|
|
6176
6174
|
return { logLevel, mountTime: Date.now() };
|
|
6177
6175
|
}, [logLevel]);
|
|
6176
|
+
const compositionManager = useContext32(CompositionManager);
|
|
6177
|
+
const composition = useMemo27(() => {
|
|
6178
|
+
return compositionManager.compositions.find((c2) => compositionManager.canvasContent?.type === "composition" ? c2.id === compositionManager.canvasContent.compositionId : false);
|
|
6179
|
+
}, [compositionManager.compositions, compositionManager.canvasContent]);
|
|
6178
6180
|
return /* @__PURE__ */ jsx28(LogLevelContext.Provider, {
|
|
6179
6181
|
value: logging,
|
|
6180
6182
|
children: /* @__PURE__ */ jsx28(NonceContext.Provider, {
|
|
@@ -6192,6 +6194,7 @@ var RemotionRootContexts = ({
|
|
|
6192
6194
|
children: /* @__PURE__ */ jsx28(SharedAudioContextProvider, {
|
|
6193
6195
|
numberOfAudioTags,
|
|
6194
6196
|
audioLatencyHint,
|
|
6197
|
+
component: composition?.component ?? null,
|
|
6195
6198
|
children: /* @__PURE__ */ jsx28(DurationsContextProvider, {
|
|
6196
6199
|
children: /* @__PURE__ */ jsx28(BufferingProvider, {
|
|
6197
6200
|
children
|
|
@@ -6298,7 +6301,7 @@ import { useCallback as useCallback16 } from "react";
|
|
|
6298
6301
|
// src/video/OffthreadVideoForRendering.tsx
|
|
6299
6302
|
import {
|
|
6300
6303
|
useCallback as useCallback15,
|
|
6301
|
-
useContext as
|
|
6304
|
+
useContext as useContext33,
|
|
6302
6305
|
useEffect as useEffect18,
|
|
6303
6306
|
useLayoutEffect as useLayoutEffect10,
|
|
6304
6307
|
useMemo as useMemo28,
|
|
@@ -6340,9 +6343,9 @@ var OffthreadVideoForRendering = ({
|
|
|
6340
6343
|
const frame = useCurrentFrame();
|
|
6341
6344
|
const volumePropsFrame = useFrameForVolumeProp(loopVolumeCurveBehavior);
|
|
6342
6345
|
const videoConfig = useUnsafeVideoConfig();
|
|
6343
|
-
const sequenceContext =
|
|
6346
|
+
const sequenceContext = useContext33(SequenceContext);
|
|
6344
6347
|
const mediaStartsAt = useMediaStartsAt();
|
|
6345
|
-
const { registerRenderAsset, unregisterRenderAsset } =
|
|
6348
|
+
const { registerRenderAsset, unregisterRenderAsset } = useContext33(RenderAssetManager);
|
|
6346
6349
|
if (!src) {
|
|
6347
6350
|
throw new TypeError("No `src` was passed to <OffthreadVideo>.");
|
|
6348
6351
|
}
|
|
@@ -6522,7 +6525,7 @@ var OffthreadVideoForRendering = ({
|
|
|
6522
6525
|
// src/video/VideoForPreview.tsx
|
|
6523
6526
|
import {
|
|
6524
6527
|
forwardRef as forwardRef9,
|
|
6525
|
-
useContext as
|
|
6528
|
+
useContext as useContext34,
|
|
6526
6529
|
useEffect as useEffect20,
|
|
6527
6530
|
useImperativeHandle as useImperativeHandle10,
|
|
6528
6531
|
useMemo as useMemo29,
|
|
@@ -6562,7 +6565,7 @@ var useEmitVideoFrame = ({
|
|
|
6562
6565
|
// src/video/VideoForPreview.tsx
|
|
6563
6566
|
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
6564
6567
|
var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
|
|
6565
|
-
const context =
|
|
6568
|
+
const context = useContext34(SharedAudioContext);
|
|
6566
6569
|
if (!context) {
|
|
6567
6570
|
throw new Error("SharedAudioContext not found");
|
|
6568
6571
|
}
|
|
@@ -6610,8 +6613,8 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
|
|
|
6610
6613
|
}
|
|
6611
6614
|
const volumePropFrame = useFrameForVolumeProp(loopVolumeCurveBehavior ?? "repeat");
|
|
6612
6615
|
const { fps, durationInFrames } = useVideoConfig();
|
|
6613
|
-
const parentSequence =
|
|
6614
|
-
const { hidden } =
|
|
6616
|
+
const parentSequence = useContext34(SequenceContext);
|
|
6617
|
+
const { hidden } = useContext34(SequenceVisibilityToggleContext);
|
|
6615
6618
|
const logLevel = useLogLevel();
|
|
6616
6619
|
const mountTime = useMountTime();
|
|
6617
6620
|
const [timelineId] = useState20(() => String(Math.random()));
|
|
@@ -7967,12 +7970,12 @@ var Still = (props2) => {
|
|
|
7967
7970
|
return React36.createElement(Composition, newProps);
|
|
7968
7971
|
};
|
|
7969
7972
|
// src/video/Video.tsx
|
|
7970
|
-
import { forwardRef as forwardRef12, useCallback as useCallback17, useContext as
|
|
7973
|
+
import { forwardRef as forwardRef12, useCallback as useCallback17, useContext as useContext36 } from "react";
|
|
7971
7974
|
|
|
7972
7975
|
// src/video/VideoForRendering.tsx
|
|
7973
7976
|
import {
|
|
7974
7977
|
forwardRef as forwardRef11,
|
|
7975
|
-
useContext as
|
|
7978
|
+
useContext as useContext35,
|
|
7976
7979
|
useEffect as useEffect21,
|
|
7977
7980
|
useImperativeHandle as useImperativeHandle11,
|
|
7978
7981
|
useLayoutEffect as useLayoutEffect11,
|
|
@@ -8126,13 +8129,13 @@ var VideoForRenderingForwardFunction = ({
|
|
|
8126
8129
|
const volumePropsFrame = useFrameForVolumeProp(loopVolumeCurveBehavior ?? "repeat");
|
|
8127
8130
|
const videoConfig = useUnsafeVideoConfig();
|
|
8128
8131
|
const videoRef = useRef17(null);
|
|
8129
|
-
const sequenceContext =
|
|
8132
|
+
const sequenceContext = useContext35(SequenceContext);
|
|
8130
8133
|
const mediaStartsAt = useMediaStartsAt();
|
|
8131
8134
|
const environment = useRemotionEnvironment();
|
|
8132
8135
|
const logLevel = useLogLevel();
|
|
8133
8136
|
const mountTime = useMountTime();
|
|
8134
8137
|
const { delayRender: delayRender2, continueRender: continueRender2 } = useDelayRender();
|
|
8135
|
-
const { registerRenderAsset, unregisterRenderAsset } =
|
|
8138
|
+
const { registerRenderAsset, unregisterRenderAsset } = useContext35(RenderAssetManager);
|
|
8136
8139
|
const id = useMemo32(() => `video-${random(props2.src ?? "")}-${sequenceContext?.cumulatedFrom}-${sequenceContext?.relativeFrom}-${sequenceContext?.durationInFrames}`, [
|
|
8137
8140
|
props2.src,
|
|
8138
8141
|
sequenceContext?.cumulatedFrom,
|
|
@@ -8336,7 +8339,7 @@ var VideoForwardingFunction = (props2, ref) => {
|
|
|
8336
8339
|
const { loop, ...propsOtherThanLoop } = props2;
|
|
8337
8340
|
const { fps } = useVideoConfig();
|
|
8338
8341
|
const environment = useRemotionEnvironment();
|
|
8339
|
-
const { durations, setDurations } =
|
|
8342
|
+
const { durations, setDurations } = useContext36(DurationsContext);
|
|
8340
8343
|
if (typeof ref === "string") {
|
|
8341
8344
|
throw new Error("string refs are not supported");
|
|
8342
8345
|
}
|