remotion 4.0.0-oops.3 → 4.0.0-prefetch.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +5 -5
- package/README.md +30 -19
- package/dist/AbsoluteFill.d.ts +6 -2
- package/dist/AbsoluteFill.js +7 -3
- package/dist/CanUseRemotionHooks.d.ts +5 -0
- package/dist/CanUseRemotionHooks.js +10 -0
- package/dist/Composition.d.ts +3 -6
- package/dist/Composition.js +40 -28
- package/dist/CompositionManager.d.ts +7 -12
- package/dist/CompositionManager.js +15 -5
- package/dist/Folder.d.ts +15 -0
- package/dist/Folder.js +33 -0
- package/dist/IFrame.js +1 -1
- package/dist/Img.js +33 -16
- package/dist/RemotionRoot.js +1 -1
- package/dist/{sequencing/index.d.ts → Sequence.d.ts} +13 -3
- package/dist/{sequencing/index.js → Sequence.js} +40 -34
- package/dist/Still.d.ts +1 -1
- package/dist/Still.js +1 -1
- package/dist/asset-types.d.ts +1 -4
- package/dist/audio/Audio.d.ts +2 -2
- package/dist/audio/Audio.js +5 -5
- package/dist/audio/AudioForDevelopment.d.ts +3 -2
- package/dist/audio/AudioForDevelopment.js +19 -6
- package/dist/audio/AudioForRendering.d.ts +5 -2
- package/dist/audio/AudioForRendering.js +15 -8
- package/dist/audio/index.js +5 -1
- package/dist/audio/props.d.ts +1 -1
- package/dist/audio/shared-audio-tags.d.ts +4 -3
- package/dist/audio/shared-audio-tags.js +115 -42
- package/dist/audio/use-audio-frame.js +4 -4
- package/dist/config/bundle-out-dir.d.ts +2 -0
- package/dist/config/bundle-out-dir.js +12 -0
- package/dist/config/input-props.js +12 -14
- package/dist/config/public-path.d.ts +2 -0
- package/dist/config/public-path.js +12 -0
- package/dist/{config/index.d.ts → config.d.ts} +70 -22
- package/dist/config.js +21 -0
- package/dist/default-css.d.ts +1 -0
- package/dist/default-css.js +9 -2
- package/dist/delay-render.d.ts +1 -1
- package/dist/delay-render.js +4 -4
- package/dist/freeze.d.ts +2 -2
- package/dist/freeze.js +2 -2
- package/dist/get-timeline-clip-name.js +2 -1
- package/dist/index.d.ts +23 -8
- package/dist/index.js +18 -8
- package/dist/internals.d.ts +35 -101
- package/dist/internals.js +18 -94
- package/dist/{interpolateColors.d.ts → interpolate-colors.d.ts} +0 -0
- package/dist/{interpolateColors.js → interpolate-colors.js} +0 -0
- package/dist/loading-indicator.d.ts +2 -0
- package/dist/loading-indicator.js +35 -0
- package/dist/loop/index.js +5 -4
- package/dist/multiple-versions-warning.js +18 -4
- package/dist/play-and-handle-not-allowed-error.d.ts +1 -1
- package/dist/portal-node.d.ts +1 -0
- package/dist/portal-node.js +23 -0
- package/dist/preload.d.ts +7 -0
- package/dist/preload.js +83 -0
- package/dist/register-root.d.ts +2 -1
- package/dist/register-root.js +20 -5
- package/dist/series/index.d.ts +2 -2
- package/dist/series/index.js +4 -4
- package/dist/spring/index.d.ts +8 -4
- package/dist/spring/index.js +21 -6
- package/dist/spring/measure-spring.d.ts +1 -1
- package/dist/spring/measure-spring.js +1 -1
- package/dist/static-file.js +6 -0
- package/dist/timeline-position-state.d.ts +1 -1
- package/dist/{use-frame.d.ts → use-current-frame.d.ts} +0 -1
- package/dist/use-current-frame.js +28 -0
- package/dist/use-lazy-component.d.ts +3 -3
- package/dist/use-lazy-component.js +5 -1
- package/dist/use-media-in-timeline.d.ts +2 -2
- package/dist/use-media-in-timeline.js +10 -7
- package/dist/use-media-playback.d.ts +3 -2
- package/dist/use-media-playback.js +9 -6
- package/dist/use-media-tag-volume.d.ts +1 -1
- package/dist/use-sync-volume-with-media-tag.d.ts +2 -2
- package/dist/use-unsafe-video-config.d.ts +1 -1
- package/dist/use-unsafe-video-config.js +2 -2
- package/dist/use-video-config.d.ts +1 -1
- package/dist/use-video-config.js +6 -0
- package/dist/use-video.d.ts +13 -1
- package/dist/use-video.js +16 -3
- package/dist/validate-media-props.d.ts +4 -3
- package/dist/validation/validate-fps.d.ts +1 -1
- package/dist/validation/validate-fps.js +4 -1
- package/dist/validation/validate-offthreadvideo-image-format.d.ts +1 -0
- package/dist/validation/validate-offthreadvideo-image-format.js +15 -0
- package/dist/validation/validation-spring-duration.d.ts +1 -0
- package/dist/validation/validation-spring-duration.js +21 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +5 -0
- package/dist/video/OffthreadVideo.d.ts +3 -0
- package/dist/video/OffthreadVideo.js +27 -0
- package/dist/video/OffthreadVideoForRendering.d.ts +3 -0
- package/dist/video/OffthreadVideoForRendering.js +101 -0
- package/dist/video/Video.d.ts +3 -3
- package/dist/video/Video.js +4 -4
- package/dist/video/VideoForDevelopment.d.ts +7 -2
- package/dist/video/VideoForDevelopment.js +28 -4
- package/dist/video/VideoForRendering.d.ts +5 -2
- package/dist/video/VideoForRendering.js +62 -40
- package/dist/video/get-current-time.d.ts +7 -1
- package/dist/video/get-current-time.js +17 -9
- package/dist/video/index.d.ts +3 -2
- package/dist/video/index.js +5 -12
- package/dist/video/props.d.ts +13 -2
- package/dist/volume-prop.js +1 -1
- package/dist/warn-about-non-seekable-media.d.ts +1 -1
- package/dist/warn-about-non-seekable-media.js +14 -2
- package/dist/wrap-remotion-context.d.ts +2 -1
- package/dist/wrap-remotion-context.js +12 -4
- package/ensure-correct-version.js +24 -0
- package/package.json +10 -11
- package/version.d.ts +1 -0
- package/version.js +1 -0
- package/dist/compress-assets.d.ts +0 -7
- package/dist/compress-assets.js +0 -25
- package/dist/config/browser-executable.d.ts +0 -3
- package/dist/config/browser-executable.js +0 -12
- package/dist/config/browser.d.ts +0 -4
- package/dist/config/browser.js +0 -19
- package/dist/config/chromium-flags.d.ts +0 -10
- package/dist/config/chromium-flags.js +0 -34
- package/dist/config/codec.d.ts +0 -17
- package/dist/config/codec.js +0 -103
- package/dist/config/concurrency.d.ts +0 -3
- package/dist/config/concurrency.js +0 -15
- package/dist/config/crf.d.ts +0 -9
- package/dist/config/crf.js +0 -83
- package/dist/config/env-file.d.ts +0 -2
- package/dist/config/env-file.js +0 -10
- package/dist/config/ffmpeg-executable.d.ts +0 -3
- package/dist/config/ffmpeg-executable.js +0 -12
- package/dist/config/frame-range.d.ts +0 -5
- package/dist/config/frame-range.js +0 -80
- package/dist/config/image-format.d.ts +0 -8
- package/dist/config/image-format.js +0 -37
- package/dist/config/image-sequence.d.ts +0 -3
- package/dist/config/image-sequence.js +0 -15
- package/dist/config/index.js +0 -175
- package/dist/config/log.d.ts +0 -7
- package/dist/config/log.js +0 -25
- package/dist/config/max-timeline-tracks.d.ts +0 -2
- package/dist/config/max-timeline-tracks.js +0 -24
- package/dist/config/override-webpack.d.ts +0 -12
- package/dist/config/override-webpack.js +0 -14
- package/dist/config/overwrite.d.ts +0 -3
- package/dist/config/overwrite.js +0 -14
- package/dist/config/pixel-format.d.ts +0 -8
- package/dist/config/pixel-format.js +0 -38
- package/dist/config/preview-server.d.ts +0 -2
- package/dist/config/preview-server.js +0 -20
- package/dist/config/prores-profile.d.ts +0 -7
- package/dist/config/prores-profile.js +0 -32
- package/dist/config/quality.d.ts +0 -2
- package/dist/config/quality.js +0 -17
- package/dist/config/scale.d.ts +0 -3
- package/dist/config/scale.js +0 -15
- package/dist/config/still-frame.d.ts +0 -2
- package/dist/config/still-frame.js +0 -12
- package/dist/config/timeout.d.ts +0 -2
- package/dist/config/timeout.js +0 -17
- package/dist/config/webpack-caching.d.ts +0 -3
- package/dist/config/webpack-caching.js +0 -16
- package/dist/feature-flags.d.ts +0 -1
- package/dist/feature-flags.js +0 -7
- package/dist/initial-frame.d.ts +0 -2
- package/dist/initial-frame.js +0 -12
- package/dist/is-audio-codec.d.ts +0 -2
- package/dist/is-audio-codec.js +0 -7
- package/dist/perf/index.d.ts +0 -5
- package/dist/perf/index.js +0 -33
- package/dist/timeline-inout-position-state.d.ts +0 -12
- package/dist/timeline-inout-position-state.js +0 -23
- package/dist/timeout.d.ts +0 -2
- package/dist/timeout.js +0 -12
- package/dist/use-frame.js +0 -25
- package/dist/validation/validate-frame.d.ts +0 -1
- package/dist/validation/validate-frame.js +0 -24
- package/dist/validation/validate-image-format.d.ts +0 -2
- package/dist/validation/validate-image-format.js +0 -9
- package/dist/validation/validate-opengl-renderer.d.ts +0 -4
- package/dist/validation/validate-opengl-renderer.js +0 -14
- package/dist/validation/validate-quality.d.ts +0 -1
- package/dist/validation/validate-quality.js +0 -21
|
@@ -3,25 +3,30 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Sequence = exports.SequenceContext = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
6
|
+
const AbsoluteFill_1 = require("./AbsoluteFill");
|
|
7
|
+
const CompositionManager_1 = require("./CompositionManager");
|
|
8
|
+
const get_environment_1 = require("./get-environment");
|
|
9
|
+
const get_timeline_clip_name_1 = require("./get-timeline-clip-name");
|
|
10
|
+
const nonce_1 = require("./nonce");
|
|
11
|
+
const timeline_position_state_1 = require("./timeline-position-state");
|
|
12
|
+
const use_video_config_1 = require("./use-video-config");
|
|
12
13
|
exports.SequenceContext = (0, react_1.createContext)(null);
|
|
13
|
-
const
|
|
14
|
+
const SequenceRefForwardingFunction = ({ from, durationInFrames = Infinity, children, name, showInTimeline = true, showLoopTimesInTimeline, ...other }, ref) => {
|
|
15
|
+
const { layout = 'absolute-fill' } = other;
|
|
14
16
|
const [id] = (0, react_1.useState)(() => String(Math.random()));
|
|
15
17
|
const parentSequence = (0, react_1.useContext)(exports.SequenceContext);
|
|
16
18
|
const { rootId } = (0, react_1.useContext)(timeline_position_state_1.TimelineContext);
|
|
17
19
|
const cumulatedFrom = parentSequence
|
|
18
20
|
? parentSequence.cumulatedFrom + parentSequence.relativeFrom
|
|
19
21
|
: 0;
|
|
20
|
-
const actualFrom = cumulatedFrom + from;
|
|
21
22
|
const nonce = (0, nonce_1.useNonce)();
|
|
22
23
|
if (layout !== 'absolute-fill' && layout !== 'none') {
|
|
23
24
|
throw new TypeError(`The layout prop of <Sequence /> expects either "absolute-fill" or "none", but you passed: ${layout}`);
|
|
24
25
|
}
|
|
26
|
+
// @ts-expect-error
|
|
27
|
+
if (layout === 'none' && typeof other.style !== 'undefined') {
|
|
28
|
+
throw new TypeError('If layout="none", you may not pass a style.');
|
|
29
|
+
}
|
|
25
30
|
if (typeof durationInFrames !== 'number') {
|
|
26
31
|
throw new TypeError(`You passed to durationInFrames an argument of type ${typeof durationInFrames}, but it must be a number.`);
|
|
27
32
|
}
|
|
@@ -38,16 +43,12 @@ const Sequence = ({ from, durationInFrames = Infinity, children, name, layout =
|
|
|
38
43
|
if (from % 1 !== 0) {
|
|
39
44
|
throw new TypeError(`The "from" prop of a sequence must be an integer, but got ${from}.`);
|
|
40
45
|
}
|
|
41
|
-
const absoluteFrame = (0,
|
|
42
|
-
const
|
|
43
|
-
const
|
|
44
|
-
?
|
|
45
|
-
:
|
|
46
|
-
const actualDurationInFrames = Math.min(
|
|
47
|
-
? Math.min(parentSequence.durationInFrames +
|
|
48
|
-
(parentSequence.cumulatedFrom + parentSequence.relativeFrom) -
|
|
49
|
-
actualFrom, durationInFrames)
|
|
50
|
-
: durationInFrames);
|
|
46
|
+
const absoluteFrame = (0, timeline_position_state_1.useTimelinePosition)();
|
|
47
|
+
const videoConfig = (0, use_video_config_1.useVideoConfig)();
|
|
48
|
+
const parentSequenceDuration = parentSequence
|
|
49
|
+
? Math.min(parentSequence.durationInFrames - from, durationInFrames)
|
|
50
|
+
: durationInFrames;
|
|
51
|
+
const actualDurationInFrames = Math.max(0, Math.min(videoConfig.durationInFrames - from, parentSequenceDuration));
|
|
51
52
|
const { registerSequence, unregisterSequence } = (0, react_1.useContext)(CompositionManager_1.CompositionManager);
|
|
52
53
|
const contextValue = (0, react_1.useMemo)(() => {
|
|
53
54
|
var _a;
|
|
@@ -70,6 +71,9 @@ const Sequence = ({ from, durationInFrames = Infinity, children, name, layout =
|
|
|
70
71
|
}, [children, name]);
|
|
71
72
|
(0, react_1.useEffect)(() => {
|
|
72
73
|
var _a;
|
|
74
|
+
if ((0, get_environment_1.getRemotionEnvironment)() !== 'preview') {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
73
77
|
registerSequence({
|
|
74
78
|
from,
|
|
75
79
|
duration: actualDurationInFrames,
|
|
@@ -87,7 +91,6 @@ const Sequence = ({ from, durationInFrames = Infinity, children, name, layout =
|
|
|
87
91
|
};
|
|
88
92
|
}, [
|
|
89
93
|
durationInFrames,
|
|
90
|
-
actualFrom,
|
|
91
94
|
id,
|
|
92
95
|
name,
|
|
93
96
|
registerSequence,
|
|
@@ -101,23 +104,26 @@ const Sequence = ({ from, durationInFrames = Infinity, children, name, layout =
|
|
|
101
104
|
nonce,
|
|
102
105
|
showLoopTimesInTimeline,
|
|
103
106
|
]);
|
|
104
|
-
const endThreshold =
|
|
105
|
-
|
|
106
|
-
})();
|
|
107
|
-
const content = absoluteFrame < actualFrom
|
|
107
|
+
const endThreshold = cumulatedFrom + from + durationInFrames - 1;
|
|
108
|
+
const content = absoluteFrame < cumulatedFrom + from
|
|
108
109
|
? null
|
|
109
110
|
: absoluteFrame > endThreshold
|
|
110
111
|
? null
|
|
111
112
|
: children;
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
113
|
+
const styleIfThere = other.layout === 'none' ? undefined : other.style;
|
|
114
|
+
const defaultStyle = (0, react_1.useMemo)(() => {
|
|
115
|
+
return {
|
|
116
|
+
flexDirection: undefined,
|
|
117
|
+
...(styleIfThere !== null && styleIfThere !== void 0 ? styleIfThere : {}),
|
|
118
|
+
};
|
|
119
|
+
}, [styleIfThere]);
|
|
120
|
+
if (ref !== null && layout === 'none') {
|
|
121
|
+
throw new TypeError('It is not supported to pass both a `ref` and `layout="none"` to <Sequence />.');
|
|
122
|
+
}
|
|
123
|
+
return ((0, jsx_runtime_1.jsx)(exports.SequenceContext.Provider, { value: contextValue, children: content === null ? null : layout === 'absolute-fill' ? ((0, jsx_runtime_1.jsx)(AbsoluteFill_1.AbsoluteFill, { ref: ref, style: defaultStyle, children: content })) : (content) }));
|
|
122
124
|
};
|
|
123
|
-
|
|
125
|
+
/**
|
|
126
|
+
* A component that time-shifts its children and wraps them in an absolutely positioned <div>.
|
|
127
|
+
* @link https://www.remotion.dev/docs/sequence
|
|
128
|
+
*/
|
|
129
|
+
exports.Sequence = (0, react_1.forwardRef)(SequenceRefForwardingFunction);
|
package/dist/Still.d.ts
CHANGED
package/dist/Still.js
CHANGED
|
@@ -4,6 +4,6 @@ exports.Still = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const Composition_1 = require("./Composition");
|
|
6
6
|
const Still = (props) => {
|
|
7
|
-
return (0, jsx_runtime_1.jsx)(Composition_1.Composition, { fps: 1, durationInFrames: 1, ...props }
|
|
7
|
+
return (0, jsx_runtime_1.jsx)(Composition_1.Composition, { fps: 1, durationInFrames: 1, ...props });
|
|
8
8
|
};
|
|
9
9
|
exports.Still = Still;
|
package/dist/asset-types.d.ts
CHANGED
package/dist/audio/Audio.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { RemotionMainAudioProps } from './props';
|
|
2
|
+
import type { RemotionMainAudioProps } from './props';
|
|
3
3
|
export declare const Audio: React.ForwardRefExoticComponent<Pick<Omit<React.DetailedHTMLProps<React.AudioHTMLAttributes<HTMLAudioElement>, HTMLAudioElement>, "onEnded" | "autoPlay" | "controls" | "loop"> & {
|
|
4
4
|
volume?: import("../volume-prop").VolumeProp | undefined;
|
|
5
5
|
playbackRate?: number | undefined;
|
|
6
|
-
} & RemotionMainAudioProps, "
|
|
6
|
+
} & RemotionMainAudioProps, "id" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "lang" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "src" | "volume" | "playbackRate" | "controlsList" | "crossOrigin" | "mediaGroup" | "muted" | "playsInline" | "preload" | keyof RemotionMainAudioProps> & React.RefAttributes<HTMLAudioElement>>;
|
package/dist/audio/Audio.js
CHANGED
|
@@ -4,7 +4,7 @@ exports.Audio = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const get_environment_1 = require("../get-environment");
|
|
7
|
-
const
|
|
7
|
+
const Sequence_1 = require("../Sequence");
|
|
8
8
|
const validate_media_props_1 = require("../validate-media-props");
|
|
9
9
|
const validate_start_from_props_1 = require("../validate-start-from-props");
|
|
10
10
|
const AudioForDevelopment_1 = require("./AudioForDevelopment");
|
|
@@ -15,18 +15,18 @@ const AudioRefForwardingFunction = (props, ref) => {
|
|
|
15
15
|
const { startFrom, endAt, ...otherProps } = props;
|
|
16
16
|
const onError = (0, react_1.useCallback)((e) => {
|
|
17
17
|
console.log(e.currentTarget.error);
|
|
18
|
-
throw new Error(`Could not play audio with src ${otherProps.src}: ${e.currentTarget.error}
|
|
18
|
+
throw new Error(`Could not play audio with src ${otherProps.src}: ${e.currentTarget.error}. See https://remotion.dev/docs/media-playback-error for help.`);
|
|
19
19
|
}, [otherProps.src]);
|
|
20
20
|
if (typeof startFrom !== 'undefined' || typeof endAt !== 'undefined') {
|
|
21
21
|
(0, validate_start_from_props_1.validateStartFromProps)(startFrom, endAt);
|
|
22
22
|
const startFromFrameNo = startFrom !== null && startFrom !== void 0 ? startFrom : 0;
|
|
23
23
|
const endAtFrameNo = endAt !== null && endAt !== void 0 ? endAt : Infinity;
|
|
24
|
-
return ((0, jsx_runtime_1.jsx)(
|
|
24
|
+
return ((0, jsx_runtime_1.jsx)(Sequence_1.Sequence, { layout: "none", from: 0 - startFromFrameNo, showInTimeline: false, durationInFrames: endAtFrameNo, children: (0, jsx_runtime_1.jsx)(exports.Audio, { ...otherProps, ref: ref }) }));
|
|
25
25
|
}
|
|
26
26
|
(0, validate_media_props_1.validateMediaProps)(props, 'Audio');
|
|
27
27
|
if ((0, get_environment_1.getRemotionEnvironment)() === 'rendering') {
|
|
28
|
-
return (0, jsx_runtime_1.jsx)(AudioForRendering_1.AudioForRendering, { ...props, ref: ref, onError: onError }
|
|
28
|
+
return (0, jsx_runtime_1.jsx)(AudioForRendering_1.AudioForRendering, { ...props, ref: ref, onError: onError });
|
|
29
29
|
}
|
|
30
|
-
return ((0, jsx_runtime_1.jsx)(AudioForDevelopment_1.AudioForDevelopment, { shouldPreMountAudioTags: audioContext !== null && audioContext.numberOfAudioTags > 0, ...props, ref: ref, onError: onError }
|
|
30
|
+
return ((0, jsx_runtime_1.jsx)(AudioForDevelopment_1.AudioForDevelopment, { shouldPreMountAudioTags: audioContext !== null && audioContext.numberOfAudioTags > 0, ...props, ref: ref, onError: onError }));
|
|
31
31
|
};
|
|
32
32
|
exports.Audio = (0, react_1.forwardRef)(AudioRefForwardingFunction);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import type { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
1
2
|
import React from 'react';
|
|
2
|
-
export declare const AudioForDevelopment:
|
|
3
|
+
export declare const AudioForDevelopment: ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.AudioHTMLAttributes<HTMLAudioElement>, HTMLAudioElement>, "onEnded" | "autoPlay" | "controls" | "loop"> & {
|
|
3
4
|
volume?: import("../volume-prop").VolumeProp | undefined;
|
|
4
5
|
playbackRate?: number | undefined;
|
|
5
6
|
} & {
|
|
6
7
|
shouldPreMountAudioTags: boolean;
|
|
7
|
-
}
|
|
8
|
+
} & RefAttributes<HTMLAudioElement>>;
|
|
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.AudioForDevelopment = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
+
const preload_1 = require("../preload");
|
|
7
|
+
const random_1 = require("../random");
|
|
8
|
+
const Sequence_1 = require("../Sequence");
|
|
6
9
|
const use_media_in_timeline_1 = require("../use-media-in-timeline");
|
|
7
10
|
const use_media_playback_1 = require("../use-media-playback");
|
|
8
11
|
const use_media_tag_volume_1 = require("../use-media-tag-volume");
|
|
@@ -18,14 +21,23 @@ const AudioForDevelopmentForwardRefFunction = (props, ref) => {
|
|
|
18
21
|
const [mediaVolume] = (0, volume_position_state_1.useMediaVolumeState)();
|
|
19
22
|
const [mediaMuted] = (0, volume_position_state_1.useMediaMutedState)();
|
|
20
23
|
const volumePropFrame = (0, use_audio_frame_1.useFrameForVolumeProp)();
|
|
21
|
-
const { volume, muted, playbackRate, shouldPreMountAudioTags, ...nativeProps } = props;
|
|
24
|
+
const { volume, muted, playbackRate, shouldPreMountAudioTags, src, ...nativeProps } = props;
|
|
25
|
+
if (!src) {
|
|
26
|
+
throw new TypeError("No 'src' was passed to <Audio>.");
|
|
27
|
+
}
|
|
28
|
+
const preloadedSrc = (0, preload_1.usePreload)(src);
|
|
22
29
|
const propsToPass = (0, react_1.useMemo)(() => {
|
|
23
30
|
return {
|
|
24
31
|
muted: muted || mediaMuted,
|
|
32
|
+
src: preloadedSrc,
|
|
25
33
|
...nativeProps,
|
|
26
34
|
};
|
|
27
|
-
}, [mediaMuted, muted, nativeProps]);
|
|
28
|
-
const
|
|
35
|
+
}, [mediaMuted, muted, nativeProps, preloadedSrc]);
|
|
36
|
+
const sequenceContext = (0, react_1.useContext)(Sequence_1.SequenceContext);
|
|
37
|
+
// Generate a string that's as unique as possible for this asset
|
|
38
|
+
// but at the same time deterministic. We use it to combat strict mode issues.
|
|
39
|
+
const id = (0, react_1.useMemo)(() => `audio-${(0, random_1.random)(src !== null && src !== void 0 ? src : '')}-${sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.relativeFrom}-${sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.cumulatedFrom}-${sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.durationInFrames}-muted:${props.muted}`, [props.muted, src, sequenceContext]);
|
|
40
|
+
const audioRef = (0, shared_audio_tags_1.useSharedAudio)(propsToPass, id).el;
|
|
29
41
|
const actualVolume = (0, use_media_tag_volume_1.useMediaTagVolume)(audioRef);
|
|
30
42
|
(0, use_sync_volume_with_media_tag_1.useSyncVolumeWithMediaTag)({
|
|
31
43
|
volumePropFrame,
|
|
@@ -38,14 +50,15 @@ const AudioForDevelopmentForwardRefFunction = (props, ref) => {
|
|
|
38
50
|
volume,
|
|
39
51
|
mediaVolume,
|
|
40
52
|
mediaRef: audioRef,
|
|
41
|
-
src
|
|
53
|
+
src,
|
|
42
54
|
mediaType: 'audio',
|
|
43
55
|
});
|
|
44
56
|
(0, use_media_playback_1.useMediaPlayback)({
|
|
45
57
|
mediaRef: audioRef,
|
|
46
|
-
src
|
|
58
|
+
src,
|
|
47
59
|
mediaType: 'audio',
|
|
48
60
|
playbackRate: playbackRate !== null && playbackRate !== void 0 ? playbackRate : 1,
|
|
61
|
+
onlyWarnForMediaSeekingError: false,
|
|
49
62
|
});
|
|
50
63
|
(0, react_1.useImperativeHandle)(ref, () => {
|
|
51
64
|
return audioRef.current;
|
|
@@ -53,6 +66,6 @@ const AudioForDevelopmentForwardRefFunction = (props, ref) => {
|
|
|
53
66
|
if (initialShouldPreMountAudioElements) {
|
|
54
67
|
return null;
|
|
55
68
|
}
|
|
56
|
-
return (0, jsx_runtime_1.jsx)("audio", { ref: audioRef, ...propsToPass }
|
|
69
|
+
return (0, jsx_runtime_1.jsx)("audio", { ref: audioRef, ...propsToPass });
|
|
57
70
|
};
|
|
58
71
|
exports.AudioForDevelopment = (0, react_1.forwardRef)(AudioForDevelopmentForwardRefFunction);
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import type { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
1
2
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
3
|
+
export declare const AudioForRendering: ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.AudioHTMLAttributes<HTMLAudioElement>, HTMLAudioElement>, "onEnded" | "autoPlay" | "controls" | "loop"> & {
|
|
4
|
+
volume?: import("../volume-prop").VolumeProp | undefined;
|
|
5
|
+
playbackRate?: number | undefined;
|
|
6
|
+
} & RefAttributes<HTMLAudioElement>>;
|
|
@@ -6,23 +6,24 @@ const react_1 = require("react");
|
|
|
6
6
|
const absolute_src_1 = require("../absolute-src");
|
|
7
7
|
const CompositionManager_1 = require("../CompositionManager");
|
|
8
8
|
const random_1 = require("../random");
|
|
9
|
-
const
|
|
10
|
-
const
|
|
9
|
+
const Sequence_1 = require("../Sequence");
|
|
10
|
+
const timeline_position_state_1 = require("../timeline-position-state");
|
|
11
|
+
const use_current_frame_1 = require("../use-current-frame");
|
|
11
12
|
const volume_prop_1 = require("../volume-prop");
|
|
12
13
|
const use_audio_frame_1 = require("./use-audio-frame");
|
|
13
14
|
const AudioForRenderingRefForwardingFunction = (props, ref) => {
|
|
14
15
|
const audioRef = (0, react_1.useRef)(null);
|
|
15
|
-
const absoluteFrame = (0,
|
|
16
|
+
const absoluteFrame = (0, timeline_position_state_1.useTimelinePosition)();
|
|
16
17
|
const volumePropFrame = (0, use_audio_frame_1.useFrameForVolumeProp)();
|
|
17
|
-
const frame = (0,
|
|
18
|
-
const sequenceContext = (0, react_1.useContext)(
|
|
18
|
+
const frame = (0, use_current_frame_1.useCurrentFrame)();
|
|
19
|
+
const sequenceContext = (0, react_1.useContext)(Sequence_1.SequenceContext);
|
|
19
20
|
const { registerAsset, unregisterAsset } = (0, react_1.useContext)(CompositionManager_1.CompositionManager);
|
|
20
21
|
// Generate a string that's as unique as possible for this asset
|
|
21
22
|
// but at the same time the same on all threads
|
|
22
23
|
const id = (0, react_1.useMemo)(() => {
|
|
23
24
|
var _a;
|
|
24
|
-
return `audio-${(0, random_1.random)((_a = props.src) !== null && _a !== void 0 ? _a : '')}-${sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.relativeFrom}-${sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.cumulatedFrom}-${sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.durationInFrames}
|
|
25
|
-
}, [props.
|
|
25
|
+
return `audio-${(0, random_1.random)((_a = props.src) !== null && _a !== void 0 ? _a : '')}-${sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.relativeFrom}-${sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.cumulatedFrom}-${sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.durationInFrames}`;
|
|
26
|
+
}, [props.src, sequenceContext]);
|
|
26
27
|
const { volume: volumeProp, playbackRate, ...nativeProps } = props;
|
|
27
28
|
const volume = (0, volume_prop_1.evaluateVolume)({
|
|
28
29
|
volume: volumeProp,
|
|
@@ -37,9 +38,15 @@ const AudioForRenderingRefForwardingFunction = (props, ref) => {
|
|
|
37
38
|
if (!props.src) {
|
|
38
39
|
throw new Error('No src passed');
|
|
39
40
|
}
|
|
41
|
+
if (!window.remotion_audioEnabled) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
40
44
|
if (props.muted) {
|
|
41
45
|
return;
|
|
42
46
|
}
|
|
47
|
+
if (volume <= 0) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
43
50
|
registerAsset({
|
|
44
51
|
type: 'audio',
|
|
45
52
|
src: (0, absolute_src_1.getAbsoluteSrc)(props.src),
|
|
@@ -63,6 +70,6 @@ const AudioForRenderingRefForwardingFunction = (props, ref) => {
|
|
|
63
70
|
playbackRate,
|
|
64
71
|
props.playbackRate,
|
|
65
72
|
]);
|
|
66
|
-
return (0, jsx_runtime_1.jsx)("audio", { ref: audioRef, ...nativeProps }
|
|
73
|
+
return (0, jsx_runtime_1.jsx)("audio", { ref: audioRef, ...nativeProps });
|
|
67
74
|
};
|
|
68
75
|
exports.AudioForRendering = (0, react_1.forwardRef)(AudioForRenderingRefForwardingFunction);
|
package/dist/audio/index.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];
|
package/dist/audio/props.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { RemotionAudioProps } from './props';
|
|
2
|
+
import type { RemotionAudioProps } from './props';
|
|
3
3
|
/**
|
|
4
4
|
* This functionality of Remotion will keep a certain amount
|
|
5
5
|
* of <audio> tags pre-mounted and by default filled with an empty audio track.
|
|
@@ -15,9 +15,10 @@ declare type AudioElem = {
|
|
|
15
15
|
id: number;
|
|
16
16
|
props: RemotionAudioProps;
|
|
17
17
|
el: React.RefObject<HTMLAudioElement>;
|
|
18
|
+
audioId: string;
|
|
18
19
|
};
|
|
19
20
|
declare type SharedContext = {
|
|
20
|
-
registerAudio: (aud: RemotionAudioProps) => AudioElem;
|
|
21
|
+
registerAudio: (aud: RemotionAudioProps, audioId: string) => AudioElem;
|
|
21
22
|
unregisterAudio: (id: number) => void;
|
|
22
23
|
updateAudio: (id: number, aud: RemotionAudioProps) => void;
|
|
23
24
|
playAllAudios: () => void;
|
|
@@ -28,5 +29,5 @@ export declare const SharedAudioContextProvider: React.FC<{
|
|
|
28
29
|
numberOfAudioTags: number;
|
|
29
30
|
children: React.ReactNode;
|
|
30
31
|
}>;
|
|
31
|
-
export declare const useSharedAudio: (aud: RemotionAudioProps) => AudioElem;
|
|
32
|
+
export declare const useSharedAudio: (aud: RemotionAudioProps, audioId: string) => AudioElem;
|
|
32
33
|
export {};
|