remotion 4.0.455 → 4.0.456
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/HtmlInCanvas.js +2 -2
- package/dist/cjs/Img.js +1 -1
- package/dist/cjs/Sequence.d.ts +9 -1
- package/dist/cjs/Sequence.js +31 -3
- package/dist/cjs/audio/Audio.d.ts +34 -34
- package/dist/cjs/audio/Audio.js +6 -6
- package/dist/cjs/audio/html5-audio.d.ts +56 -0
- package/dist/cjs/audio/html5-audio.js +101 -0
- package/dist/cjs/audio/index.d.ts +1 -1
- package/dist/cjs/audio/index.js +3 -3
- package/dist/cjs/get-timeline-duration.d.ts +2 -1
- package/dist/cjs/get-timeline-duration.js +4 -1
- package/dist/cjs/internals.d.ts +8 -3
- package/dist/cjs/loop/index.d.ts +2 -2
- package/dist/cjs/loop/index.js +2 -2
- package/dist/cjs/use-media-in-timeline.d.ts +8 -2
- package/dist/cjs/use-media-in-timeline.js +41 -15
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/video/Video.d.ts +32 -32
- package/dist/cjs/video/Video.js +7 -7
- package/dist/cjs/video/html5-video.d.ts +53 -0
- package/dist/cjs/video/html5-video.js +85 -0
- package/dist/cjs/video/index.d.ts +1 -1
- package/dist/cjs/video/index.js +3 -3
- package/dist/cjs/wrap-in-schema.d.ts +1 -1
- package/dist/cjs/wrap-in-schema.js +2 -2
- package/dist/esm/index.mjs +104 -41
- package/dist/esm/version.mjs +1 -1
- package/package.json +2 -2
package/dist/cjs/HtmlInCanvas.js
CHANGED
|
@@ -83,7 +83,7 @@ const htmlInCanvasSchema = {
|
|
|
83
83
|
description: 'Opacity',
|
|
84
84
|
},
|
|
85
85
|
};
|
|
86
|
-
const HtmlInCanvasInner = (0, react_1.forwardRef)(({ width, height, _experimentalEffects: experimentalEffects = [], children, onPaint, onInit, controls, style, durationInFrames, ...sequenceProps }, ref) => {
|
|
86
|
+
const HtmlInCanvasInner = (0, react_1.forwardRef)(({ width, height, _experimentalEffects: experimentalEffects = [], children, onPaint, onInit, _experimentalControls: controls, style, durationInFrames, ...sequenceProps }, ref) => {
|
|
87
87
|
assertHtmlInCanvasDimensions(width, height);
|
|
88
88
|
const { continueRender, cancelRender } = (0, use_delay_render_js_1.useDelayRender)();
|
|
89
89
|
if (!(0, exports.isHtmlInCanvasSupported)()) {
|
|
@@ -246,7 +246,7 @@ const HtmlInCanvasInner = (0, react_1.forwardRef)(({ width, height, _experimenta
|
|
|
246
246
|
...style,
|
|
247
247
|
};
|
|
248
248
|
}, [width, height, style]);
|
|
249
|
-
return ((0, jsx_runtime_1.jsx)(Sequence_js_1.Sequence, { durationInFrames: resolvedDuration, name: "<HtmlInCanvas>",
|
|
249
|
+
return ((0, jsx_runtime_1.jsx)(Sequence_js_1.Sequence, { durationInFrames: resolvedDuration, name: "<HtmlInCanvas>", _experimentalControls: controls, layout: "none", ...sequenceProps, children: (0, jsx_runtime_1.jsx)("canvas", { ref: setLayoutCanvasRef, width: width, height: height, children: (0, jsx_runtime_1.jsx)("div", { ref: divRef, style: innerStyle, children: children }) }) }));
|
|
250
250
|
});
|
|
251
251
|
HtmlInCanvasInner.displayName = 'HtmlInCanvas';
|
|
252
252
|
const HtmlInCanvasWrapped = (0, wrap_in_schema_js_1.wrapInSchema)(HtmlInCanvasInner, htmlInCanvasSchema);
|
package/dist/cjs/Img.js
CHANGED
|
@@ -54,7 +54,7 @@ const imgSchema = {
|
|
|
54
54
|
description: 'Opacity',
|
|
55
55
|
},
|
|
56
56
|
};
|
|
57
|
-
const ImgInner = ({ onError, maxRetries = 2, src, pauseWhenLoading, delayRenderRetries, delayRenderTimeoutInMilliseconds, onImageFrame, crossOrigin, showInTimeline, name, stack, ref, controls, ...props }) => {
|
|
57
|
+
const ImgInner = ({ onError, maxRetries = 2, src, pauseWhenLoading, delayRenderRetries, delayRenderTimeoutInMilliseconds, onImageFrame, crossOrigin, showInTimeline, name, stack, ref, _experimentalControls: controls, ...props }) => {
|
|
58
58
|
var _a, _b;
|
|
59
59
|
const imageRef = (0, react_1.useRef)(null);
|
|
60
60
|
const errors = (0, react_1.useRef)({});
|
package/dist/cjs/Sequence.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { LoopDisplay, SequenceControls } from './CompositionManager.js';
|
|
3
3
|
import type { EffectsProp } from './effects/effect-types.js';
|
|
4
|
+
import type { BasicMediaInTimelineReturnType } from './use-media-in-timeline.js';
|
|
4
5
|
export type AbsoluteFillLayout = {
|
|
5
6
|
layout?: 'absolute-fill';
|
|
6
7
|
premountFor?: number;
|
|
@@ -20,7 +21,7 @@ export type SequencePropsWithoutDuration = {
|
|
|
20
21
|
readonly from?: number;
|
|
21
22
|
readonly name?: string;
|
|
22
23
|
readonly showInTimeline?: boolean;
|
|
23
|
-
readonly
|
|
24
|
+
readonly _experimentalControls?: SequenceControls;
|
|
24
25
|
readonly _experimentalEffects?: EffectsProp;
|
|
25
26
|
/**
|
|
26
27
|
* @deprecated For internal use only.
|
|
@@ -46,6 +47,13 @@ export type SequencePropsWithoutDuration = {
|
|
|
46
47
|
* @deprecated For internal use only.
|
|
47
48
|
*/
|
|
48
49
|
readonly _remotionInternalIsPostmounting?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* @deprecated For internal use only.
|
|
52
|
+
*/
|
|
53
|
+
readonly _remotionInternalIsMedia?: {
|
|
54
|
+
type: 'video' | 'audio';
|
|
55
|
+
data: BasicMediaInTimelineReturnType;
|
|
56
|
+
};
|
|
49
57
|
} & LayoutAndStyle;
|
|
50
58
|
export type SequenceProps = {
|
|
51
59
|
readonly durationInFrames?: number;
|
package/dist/cjs/Sequence.js
CHANGED
|
@@ -17,7 +17,7 @@ const use_current_frame_1 = require("./use-current-frame");
|
|
|
17
17
|
const use_remotion_environment_js_1 = require("./use-remotion-environment.js");
|
|
18
18
|
const use_video_config_js_1 = require("./use-video-config.js");
|
|
19
19
|
const v5_flag_js_1 = require("./v5-flag.js");
|
|
20
|
-
const RegularSequenceRefForwardingFunction = ({ from = 0, durationInFrames = Infinity, children, name, height, width, showInTimeline = true, controls, _experimentalEffects, _remotionInternalLoopDisplay: loopDisplay, _remotionInternalStack: stack, _remotionInternalPremountDisplay: premountDisplay, _remotionInternalPostmountDisplay: postmountDisplay, ...other }, ref) => {
|
|
20
|
+
const RegularSequenceRefForwardingFunction = ({ from = 0, durationInFrames = Infinity, children, name, height, width, showInTimeline = true, _experimentalControls: controls, _experimentalEffects, _remotionInternalLoopDisplay: loopDisplay, _remotionInternalStack: stack, _remotionInternalPremountDisplay: premountDisplay, _remotionInternalPostmountDisplay: postmountDisplay, _remotionInternalIsMedia: isMedia, ...other }, ref) => {
|
|
21
21
|
var _a, _b;
|
|
22
22
|
const { layout = 'absolute-fill' } = other;
|
|
23
23
|
const [id] = (0, react_1.useState)(() => String(Math.random()));
|
|
@@ -99,16 +99,43 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, durationInFrames = Inf
|
|
|
99
99
|
const inheritedStack = (_a = other === null || other === void 0 ? void 0 : other.stack) !== null && _a !== void 0 ? _a : null;
|
|
100
100
|
const memoizedEffects = (0, use_memoized_effects_js_1.useMemoizedEffects)((0, effect_internals_js_1.flattenEffects)(_experimentalEffects !== null && _experimentalEffects !== void 0 ? _experimentalEffects : []));
|
|
101
101
|
(0, react_1.useEffect)(() => {
|
|
102
|
-
var _a;
|
|
102
|
+
var _a, _b;
|
|
103
103
|
if (!env.isStudio) {
|
|
104
104
|
return;
|
|
105
105
|
}
|
|
106
|
+
if (isMedia) {
|
|
107
|
+
registerSequence({
|
|
108
|
+
type: isMedia.type,
|
|
109
|
+
controls: controls !== null && controls !== void 0 ? controls : null,
|
|
110
|
+
effects: memoizedEffects,
|
|
111
|
+
displayName: timelineClipName,
|
|
112
|
+
doesVolumeChange: isMedia.data.doesVolumeChange,
|
|
113
|
+
duration: actualDurationInFrames,
|
|
114
|
+
from,
|
|
115
|
+
id,
|
|
116
|
+
loopDisplay,
|
|
117
|
+
nonce: nonce.get(),
|
|
118
|
+
parent: (_a = parentSequence === null || parentSequence === void 0 ? void 0 : parentSequence.id) !== null && _a !== void 0 ? _a : null,
|
|
119
|
+
playbackRate: isMedia.data.playbackRate,
|
|
120
|
+
postmountDisplay: postmountDisplay !== null && postmountDisplay !== void 0 ? postmountDisplay : null,
|
|
121
|
+
premountDisplay: premountDisplay !== null && premountDisplay !== void 0 ? premountDisplay : null,
|
|
122
|
+
rootId,
|
|
123
|
+
showInTimeline,
|
|
124
|
+
src: isMedia.data.src,
|
|
125
|
+
stack: stack !== null && stack !== void 0 ? stack : inheritedStack,
|
|
126
|
+
startMediaFrom: isMedia.data.startMediaFrom,
|
|
127
|
+
volume: isMedia.data.volumes,
|
|
128
|
+
});
|
|
129
|
+
return () => {
|
|
130
|
+
unregisterSequence(id);
|
|
131
|
+
};
|
|
132
|
+
}
|
|
106
133
|
registerSequence({
|
|
107
134
|
from,
|
|
108
135
|
duration: actualDurationInFrames,
|
|
109
136
|
id,
|
|
110
137
|
displayName: timelineClipName,
|
|
111
|
-
parent: (
|
|
138
|
+
parent: (_b = parentSequence === null || parentSequence === void 0 ? void 0 : parentSequence.id) !== null && _b !== void 0 ? _b : null,
|
|
112
139
|
type: 'sequence',
|
|
113
140
|
rootId,
|
|
114
141
|
showInTimeline,
|
|
@@ -144,6 +171,7 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, durationInFrames = Inf
|
|
|
144
171
|
inheritedStack,
|
|
145
172
|
controls,
|
|
146
173
|
memoizedEffects,
|
|
174
|
+
isMedia,
|
|
147
175
|
]);
|
|
148
176
|
// Ceil to support floats
|
|
149
177
|
// https://github.com/remotion-dev/remotion/issues/2958
|
|
@@ -5,52 +5,52 @@ import type { RemotionMainAudioProps } from './props.js';
|
|
|
5
5
|
* @see [Documentation](https://remotion.dev/docs/html5-audio)
|
|
6
6
|
*/
|
|
7
7
|
export declare const Html5Audio: React.ForwardRefExoticComponent<Omit<import("./props.js").NativeAudioProps & {
|
|
8
|
-
name?: string;
|
|
9
|
-
volume?: import("../volume-prop.js").VolumeProp;
|
|
10
|
-
playbackRate?: number;
|
|
11
|
-
acceptableTimeShiftInSeconds?: number;
|
|
12
|
-
allowAmplificationDuringRender?: boolean;
|
|
13
|
-
_remotionInternalNeedsDurationCalculation?: boolean;
|
|
14
|
-
_remotionInternalNativeLoopPassed?: boolean;
|
|
15
|
-
toneFrequency?: number;
|
|
16
|
-
useWebAudioApi?: boolean;
|
|
17
|
-
pauseWhenBuffering?: boolean;
|
|
18
|
-
showInTimeline?: boolean;
|
|
19
|
-
delayRenderTimeoutInMilliseconds?: number;
|
|
20
|
-
delayRenderRetries?: number;
|
|
21
|
-
loopVolumeCurveBehavior?: import("./use-audio-frame.js").LoopVolumeCurveBehavior;
|
|
22
|
-
onError?: (err: Error) => void;
|
|
23
|
-
audioStreamIndex?: number;
|
|
8
|
+
name?: string | undefined;
|
|
9
|
+
volume?: import("../volume-prop.js").VolumeProp | undefined;
|
|
10
|
+
playbackRate?: number | undefined;
|
|
11
|
+
acceptableTimeShiftInSeconds?: number | undefined;
|
|
12
|
+
allowAmplificationDuringRender?: boolean | undefined;
|
|
13
|
+
_remotionInternalNeedsDurationCalculation?: boolean | undefined;
|
|
14
|
+
_remotionInternalNativeLoopPassed?: boolean | undefined;
|
|
15
|
+
toneFrequency?: number | undefined;
|
|
16
|
+
useWebAudioApi?: boolean | undefined;
|
|
17
|
+
pauseWhenBuffering?: boolean | undefined;
|
|
18
|
+
showInTimeline?: boolean | undefined;
|
|
19
|
+
delayRenderTimeoutInMilliseconds?: number | undefined;
|
|
20
|
+
delayRenderRetries?: number | undefined;
|
|
21
|
+
loopVolumeCurveBehavior?: import("./use-audio-frame.js").LoopVolumeCurveBehavior | undefined;
|
|
22
|
+
onError?: ((err: Error) => void) | undefined;
|
|
23
|
+
audioStreamIndex?: number | undefined;
|
|
24
24
|
} & RemotionMainAudioProps & {
|
|
25
25
|
/**
|
|
26
26
|
* @deprecated For internal use only
|
|
27
27
|
*/
|
|
28
|
-
readonly stack?: string;
|
|
28
|
+
readonly stack?: string | undefined;
|
|
29
29
|
}, "ref"> & React.RefAttributes<HTMLAudioElement>>;
|
|
30
30
|
/**
|
|
31
31
|
* @deprecated This component has been renamed to `Html5Audio`.
|
|
32
32
|
* @see [Documentation](https://remotion.dev/docs/mediabunny/new-video)
|
|
33
33
|
*/
|
|
34
34
|
export declare const Audio: React.ForwardRefExoticComponent<Omit<import("./props.js").NativeAudioProps & {
|
|
35
|
-
name?: string;
|
|
36
|
-
volume?: import("../volume-prop.js").VolumeProp;
|
|
37
|
-
playbackRate?: number;
|
|
38
|
-
acceptableTimeShiftInSeconds?: number;
|
|
39
|
-
allowAmplificationDuringRender?: boolean;
|
|
40
|
-
_remotionInternalNeedsDurationCalculation?: boolean;
|
|
41
|
-
_remotionInternalNativeLoopPassed?: boolean;
|
|
42
|
-
toneFrequency?: number;
|
|
43
|
-
useWebAudioApi?: boolean;
|
|
44
|
-
pauseWhenBuffering?: boolean;
|
|
45
|
-
showInTimeline?: boolean;
|
|
46
|
-
delayRenderTimeoutInMilliseconds?: number;
|
|
47
|
-
delayRenderRetries?: number;
|
|
48
|
-
loopVolumeCurveBehavior?: import("./use-audio-frame.js").LoopVolumeCurveBehavior;
|
|
49
|
-
onError?: (err: Error) => void;
|
|
50
|
-
audioStreamIndex?: number;
|
|
35
|
+
name?: string | undefined;
|
|
36
|
+
volume?: import("../volume-prop.js").VolumeProp | undefined;
|
|
37
|
+
playbackRate?: number | undefined;
|
|
38
|
+
acceptableTimeShiftInSeconds?: number | undefined;
|
|
39
|
+
allowAmplificationDuringRender?: boolean | undefined;
|
|
40
|
+
_remotionInternalNeedsDurationCalculation?: boolean | undefined;
|
|
41
|
+
_remotionInternalNativeLoopPassed?: boolean | undefined;
|
|
42
|
+
toneFrequency?: number | undefined;
|
|
43
|
+
useWebAudioApi?: boolean | undefined;
|
|
44
|
+
pauseWhenBuffering?: boolean | undefined;
|
|
45
|
+
showInTimeline?: boolean | undefined;
|
|
46
|
+
delayRenderTimeoutInMilliseconds?: number | undefined;
|
|
47
|
+
delayRenderRetries?: number | undefined;
|
|
48
|
+
loopVolumeCurveBehavior?: import("./use-audio-frame.js").LoopVolumeCurveBehavior | undefined;
|
|
49
|
+
onError?: ((err: Error) => void) | undefined;
|
|
50
|
+
audioStreamIndex?: number | undefined;
|
|
51
51
|
} & RemotionMainAudioProps & {
|
|
52
52
|
/**
|
|
53
53
|
* @deprecated For internal use only
|
|
54
54
|
*/
|
|
55
|
-
readonly stack?: string;
|
|
55
|
+
readonly stack?: string | undefined;
|
|
56
56
|
}, "ref"> & React.RefAttributes<HTMLAudioElement>>;
|
package/dist/cjs/audio/Audio.js
CHANGED
|
@@ -66,25 +66,25 @@ const AudioRefForwardingFunction = (props, ref) => {
|
|
|
66
66
|
});
|
|
67
67
|
if (loop && durationFetched !== undefined) {
|
|
68
68
|
if (!Number.isFinite(durationFetched)) {
|
|
69
|
-
return (
|
|
69
|
+
return (jsx_runtime_1.jsx(exports.Html5Audio, { ...propsOtherThanLoop, ref: ref, _remotionInternalNativeLoopPassed: true }));
|
|
70
70
|
}
|
|
71
71
|
const duration = durationFetched * fps;
|
|
72
|
-
return (
|
|
72
|
+
return (jsx_runtime_1.jsx(index_js_1.Loop, { layout: "none", durationInFrames: (0, calculate_media_duration_js_1.calculateMediaDuration)({
|
|
73
73
|
trimAfter: trimAfterValue,
|
|
74
74
|
mediaDurationInFrames: duration,
|
|
75
75
|
playbackRate: (_b = props.playbackRate) !== null && _b !== void 0 ? _b : 1,
|
|
76
76
|
trimBefore: trimBeforeValue,
|
|
77
|
-
}), children:
|
|
77
|
+
}), children: jsx_runtime_1.jsx(exports.Html5Audio, { ...propsOtherThanLoop, ref: ref, _remotionInternalNativeLoopPassed: true }) }));
|
|
78
78
|
}
|
|
79
79
|
if (typeof trimBeforeValue !== 'undefined' ||
|
|
80
80
|
typeof trimAfterValue !== 'undefined') {
|
|
81
|
-
return (
|
|
81
|
+
return (jsx_runtime_1.jsx(Sequence_js_1.Sequence, { layout: "none", from: 0 - (trimBeforeValue !== null && trimBeforeValue !== void 0 ? trimBeforeValue : 0), showInTimeline: false, durationInFrames: trimAfterValue, name: name, children: jsx_runtime_1.jsx(exports.Html5Audio, { _remotionInternalNeedsDurationCalculation: Boolean(loop), pauseWhenBuffering: pauseWhenBuffering !== null && pauseWhenBuffering !== void 0 ? pauseWhenBuffering : false, ...otherProps, ref: ref }) }));
|
|
82
82
|
}
|
|
83
83
|
(0, validate_media_props_js_1.validateMediaProps)({ playbackRate: props.playbackRate, volume: props.volume }, 'Html5Audio');
|
|
84
84
|
if (environment.isRendering) {
|
|
85
|
-
return (
|
|
85
|
+
return (jsx_runtime_1.jsx(AudioForRendering_js_1.AudioForRendering, { onDuration: onDuration, ...props, ref: ref, onNativeError: onError, _remotionInternalNeedsDurationCalculation: Boolean(loop) }));
|
|
86
86
|
}
|
|
87
|
-
return (
|
|
87
|
+
return (jsx_runtime_1.jsx(AudioForPreview_js_1.AudioForPreview, { _remotionInternalNativeLoopPassed: (_c = props._remotionInternalNativeLoopPassed) !== null && _c !== void 0 ? _c : false, _remotionInternalStack: stack !== null && stack !== void 0 ? stack : null, shouldPreMountAudioTags: audioTagsContext !== null && audioTagsContext.numberOfAudioTags > 0, ...props, ref: ref, onNativeError: onError, onDuration: onDuration,
|
|
88
88
|
// Proposal: Make this default to true in v5
|
|
89
89
|
pauseWhenBuffering: pauseWhenBuffering !== null && pauseWhenBuffering !== void 0 ? pauseWhenBuffering : false, _remotionInternalNeedsDurationCalculation: Boolean(loop), showInTimeline: showInTimeline !== null && showInTimeline !== void 0 ? showInTimeline : true }));
|
|
90
90
|
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { RemotionMainAudioProps } from './props.js';
|
|
3
|
+
/**
|
|
4
|
+
* @description With this component, you can add audio to your video. All audio formats which are supported by Chromium are supported by the component.
|
|
5
|
+
* @see [Documentation](https://remotion.dev/docs/html5-audio)
|
|
6
|
+
*/
|
|
7
|
+
export declare const Html5Audio: React.ForwardRefExoticComponent<Omit<import("./props.js").NativeAudioProps & {
|
|
8
|
+
name?: string;
|
|
9
|
+
volume?: import("../volume-prop.js").VolumeProp;
|
|
10
|
+
playbackRate?: number;
|
|
11
|
+
acceptableTimeShiftInSeconds?: number;
|
|
12
|
+
allowAmplificationDuringRender?: boolean;
|
|
13
|
+
_remotionInternalNeedsDurationCalculation?: boolean;
|
|
14
|
+
_remotionInternalNativeLoopPassed?: boolean;
|
|
15
|
+
toneFrequency?: number;
|
|
16
|
+
useWebAudioApi?: boolean;
|
|
17
|
+
pauseWhenBuffering?: boolean;
|
|
18
|
+
showInTimeline?: boolean;
|
|
19
|
+
delayRenderTimeoutInMilliseconds?: number;
|
|
20
|
+
delayRenderRetries?: number;
|
|
21
|
+
loopVolumeCurveBehavior?: import("./use-audio-frame.js").LoopVolumeCurveBehavior;
|
|
22
|
+
onError?: (err: Error) => void;
|
|
23
|
+
audioStreamIndex?: number;
|
|
24
|
+
} & RemotionMainAudioProps & {
|
|
25
|
+
/**
|
|
26
|
+
* @deprecated For internal use only
|
|
27
|
+
*/
|
|
28
|
+
readonly stack?: string;
|
|
29
|
+
}, "ref"> & React.RefAttributes<HTMLAudioElement>>;
|
|
30
|
+
/**
|
|
31
|
+
* @deprecated This component has been renamed to `Html5Audio`.
|
|
32
|
+
* @see [Documentation](https://remotion.dev/docs/mediabunny/new-video)
|
|
33
|
+
*/
|
|
34
|
+
export declare const Audio: React.ForwardRefExoticComponent<Omit<import("./props.js").NativeAudioProps & {
|
|
35
|
+
name?: string;
|
|
36
|
+
volume?: import("../volume-prop.js").VolumeProp;
|
|
37
|
+
playbackRate?: number;
|
|
38
|
+
acceptableTimeShiftInSeconds?: number;
|
|
39
|
+
allowAmplificationDuringRender?: boolean;
|
|
40
|
+
_remotionInternalNeedsDurationCalculation?: boolean;
|
|
41
|
+
_remotionInternalNativeLoopPassed?: boolean;
|
|
42
|
+
toneFrequency?: number;
|
|
43
|
+
useWebAudioApi?: boolean;
|
|
44
|
+
pauseWhenBuffering?: boolean;
|
|
45
|
+
showInTimeline?: boolean;
|
|
46
|
+
delayRenderTimeoutInMilliseconds?: number;
|
|
47
|
+
delayRenderRetries?: number;
|
|
48
|
+
loopVolumeCurveBehavior?: import("./use-audio-frame.js").LoopVolumeCurveBehavior;
|
|
49
|
+
onError?: (err: Error) => void;
|
|
50
|
+
audioStreamIndex?: number;
|
|
51
|
+
} & RemotionMainAudioProps & {
|
|
52
|
+
/**
|
|
53
|
+
* @deprecated For internal use only
|
|
54
|
+
*/
|
|
55
|
+
readonly stack?: string;
|
|
56
|
+
}, "ref"> & React.RefAttributes<HTMLAudioElement>>;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Audio = exports.Html5Audio = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
/* eslint-disable @typescript-eslint/no-use-before-define */
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const absolute_src_js_1 = require("../absolute-src.js");
|
|
8
|
+
const calculate_media_duration_js_1 = require("../calculate-media-duration.js");
|
|
9
|
+
const cancel_render_js_1 = require("../cancel-render.js");
|
|
10
|
+
const enable_sequence_stack_traces_js_1 = require("../enable-sequence-stack-traces.js");
|
|
11
|
+
const index_js_1 = require("../loop/index.js");
|
|
12
|
+
const prefetch_js_1 = require("../prefetch.js");
|
|
13
|
+
const Sequence_js_1 = require("../Sequence.js");
|
|
14
|
+
const use_remotion_environment_js_1 = require("../use-remotion-environment.js");
|
|
15
|
+
const use_video_config_js_1 = require("../use-video-config.js");
|
|
16
|
+
const validate_media_props_js_1 = require("../validate-media-props.js");
|
|
17
|
+
const validate_start_from_props_js_1 = require("../validate-start-from-props.js");
|
|
18
|
+
const duration_state_js_1 = require("../video/duration-state.js");
|
|
19
|
+
const AudioForPreview_js_1 = require("./AudioForPreview.js");
|
|
20
|
+
const AudioForRendering_js_1 = require("./AudioForRendering.js");
|
|
21
|
+
const shared_audio_tags_js_1 = require("./shared-audio-tags.js");
|
|
22
|
+
const AudioRefForwardingFunction = (props, ref) => {
|
|
23
|
+
var _a, _b, _c;
|
|
24
|
+
const audioTagsContext = (0, react_1.useContext)(shared_audio_tags_js_1.SharedAudioTagsContext);
|
|
25
|
+
const { startFrom, endAt, trimBefore, trimAfter, name, stack, pauseWhenBuffering, showInTimeline, onError: onRemotionError, ...otherProps } = props;
|
|
26
|
+
const { loop, ...propsOtherThanLoop } = props;
|
|
27
|
+
const { fps } = (0, use_video_config_js_1.useVideoConfig)();
|
|
28
|
+
const environment = (0, use_remotion_environment_js_1.useRemotionEnvironment)();
|
|
29
|
+
if (environment.isClientSideRendering) {
|
|
30
|
+
throw new Error('<Html5Audio> is not supported in @remotion/web-renderer. Use <Audio> from @remotion/media instead. See https://remotion.dev/docs/client-side-rendering/limitations');
|
|
31
|
+
}
|
|
32
|
+
const { durations, setDurations } = (0, react_1.useContext)(duration_state_js_1.DurationsContext);
|
|
33
|
+
if (typeof props.src !== 'string') {
|
|
34
|
+
throw new TypeError(`The \`<Html5Audio>\` tag requires a string for \`src\`, but got ${JSON.stringify(props.src)} instead.`);
|
|
35
|
+
}
|
|
36
|
+
const preloadedSrc = (0, prefetch_js_1.usePreload)(props.src);
|
|
37
|
+
const onError = (0, react_1.useCallback)((e) => {
|
|
38
|
+
// eslint-disable-next-line no-console
|
|
39
|
+
console.log(e.currentTarget.error);
|
|
40
|
+
// If there is no `loop` property, we don't need to get the duration
|
|
41
|
+
// and this does not need to be a fatal error
|
|
42
|
+
const errMessage = `Could not play audio with src ${preloadedSrc}: ${e.currentTarget.error}. See https://remotion.dev/docs/media-playback-error for help.`;
|
|
43
|
+
if (loop) {
|
|
44
|
+
if (onRemotionError) {
|
|
45
|
+
onRemotionError(new Error(errMessage));
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
(0, cancel_render_js_1.cancelRender)(new Error(errMessage));
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
onRemotionError === null || onRemotionError === void 0 ? void 0 : onRemotionError(new Error(errMessage));
|
|
52
|
+
// eslint-disable-next-line no-console
|
|
53
|
+
console.warn(errMessage);
|
|
54
|
+
}
|
|
55
|
+
}, [loop, onRemotionError, preloadedSrc]);
|
|
56
|
+
const onDuration = (0, react_1.useCallback)((src, durationInSeconds) => {
|
|
57
|
+
setDurations({ type: 'got-duration', durationInSeconds, src });
|
|
58
|
+
}, [setDurations]);
|
|
59
|
+
const durationFetched = (_a = durations[(0, absolute_src_js_1.getAbsoluteSrc)(preloadedSrc)]) !== null && _a !== void 0 ? _a : durations[(0, absolute_src_js_1.getAbsoluteSrc)(props.src)];
|
|
60
|
+
(0, validate_start_from_props_js_1.validateMediaTrimProps)({ startFrom, endAt, trimBefore, trimAfter });
|
|
61
|
+
const { trimBeforeValue, trimAfterValue } = (0, validate_start_from_props_js_1.resolveTrimProps)({
|
|
62
|
+
startFrom,
|
|
63
|
+
endAt,
|
|
64
|
+
trimBefore,
|
|
65
|
+
trimAfter,
|
|
66
|
+
});
|
|
67
|
+
if (loop && durationFetched !== undefined) {
|
|
68
|
+
if (!Number.isFinite(durationFetched)) {
|
|
69
|
+
return ((0, jsx_runtime_1.jsx)(exports.Html5Audio, { ...propsOtherThanLoop, ref: ref, _remotionInternalNativeLoopPassed: true }));
|
|
70
|
+
}
|
|
71
|
+
const duration = durationFetched * fps;
|
|
72
|
+
return ((0, jsx_runtime_1.jsx)(index_js_1.Loop, { layout: "none", durationInFrames: (0, calculate_media_duration_js_1.calculateMediaDuration)({
|
|
73
|
+
trimAfter: trimAfterValue,
|
|
74
|
+
mediaDurationInFrames: duration,
|
|
75
|
+
playbackRate: (_b = props.playbackRate) !== null && _b !== void 0 ? _b : 1,
|
|
76
|
+
trimBefore: trimBeforeValue,
|
|
77
|
+
}), children: (0, jsx_runtime_1.jsx)(exports.Html5Audio, { ...propsOtherThanLoop, ref: ref, _remotionInternalNativeLoopPassed: true }) }));
|
|
78
|
+
}
|
|
79
|
+
if (typeof trimBeforeValue !== 'undefined' ||
|
|
80
|
+
typeof trimAfterValue !== 'undefined') {
|
|
81
|
+
return ((0, jsx_runtime_1.jsx)(Sequence_js_1.Sequence, { layout: "none", from: 0 - (trimBeforeValue !== null && trimBeforeValue !== void 0 ? trimBeforeValue : 0), showInTimeline: false, durationInFrames: trimAfterValue, name: name, children: (0, jsx_runtime_1.jsx)(exports.Html5Audio, { _remotionInternalNeedsDurationCalculation: Boolean(loop), pauseWhenBuffering: pauseWhenBuffering !== null && pauseWhenBuffering !== void 0 ? pauseWhenBuffering : false, ...otherProps, ref: ref }) }));
|
|
82
|
+
}
|
|
83
|
+
(0, validate_media_props_js_1.validateMediaProps)({ playbackRate: props.playbackRate, volume: props.volume }, 'Html5Audio');
|
|
84
|
+
if (environment.isRendering) {
|
|
85
|
+
return ((0, jsx_runtime_1.jsx)(AudioForRendering_js_1.AudioForRendering, { onDuration: onDuration, ...props, ref: ref, onNativeError: onError, _remotionInternalNeedsDurationCalculation: Boolean(loop) }));
|
|
86
|
+
}
|
|
87
|
+
return ((0, jsx_runtime_1.jsx)(AudioForPreview_js_1.AudioForPreview, { _remotionInternalNativeLoopPassed: (_c = props._remotionInternalNativeLoopPassed) !== null && _c !== void 0 ? _c : false, _remotionInternalStack: stack !== null && stack !== void 0 ? stack : null, shouldPreMountAudioTags: audioTagsContext !== null && audioTagsContext.numberOfAudioTags > 0, ...props, ref: ref, onNativeError: onError, onDuration: onDuration,
|
|
88
|
+
// Proposal: Make this default to true in v5
|
|
89
|
+
pauseWhenBuffering: pauseWhenBuffering !== null && pauseWhenBuffering !== void 0 ? pauseWhenBuffering : false, _remotionInternalNeedsDurationCalculation: Boolean(loop), showInTimeline: showInTimeline !== null && showInTimeline !== void 0 ? showInTimeline : true }));
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* @description With this component, you can add audio to your video. All audio formats which are supported by Chromium are supported by the component.
|
|
93
|
+
* @see [Documentation](https://remotion.dev/docs/html5-audio)
|
|
94
|
+
*/
|
|
95
|
+
exports.Html5Audio = (0, react_1.forwardRef)(AudioRefForwardingFunction);
|
|
96
|
+
(0, enable_sequence_stack_traces_js_1.addSequenceStackTraces)(exports.Html5Audio);
|
|
97
|
+
/**
|
|
98
|
+
* @deprecated This component has been renamed to `Html5Audio`.
|
|
99
|
+
* @see [Documentation](https://remotion.dev/docs/mediabunny/new-video)
|
|
100
|
+
*/
|
|
101
|
+
exports.Audio = exports.Html5Audio;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Audio, Html5Audio } from './
|
|
1
|
+
export { Audio, Html5Audio } from './html5-audio.js';
|
|
2
2
|
export * from './props.js';
|
package/dist/cjs/audio/index.js
CHANGED
|
@@ -15,7 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.Html5Audio = exports.Audio = void 0;
|
|
18
|
-
var
|
|
19
|
-
Object.defineProperty(exports, "Audio", { enumerable: true, get: function () { return
|
|
20
|
-
Object.defineProperty(exports, "Html5Audio", { enumerable: true, get: function () { return
|
|
18
|
+
var html5_audio_js_1 = require("./html5-audio.js");
|
|
19
|
+
Object.defineProperty(exports, "Audio", { enumerable: true, get: function () { return html5_audio_js_1.Audio; } });
|
|
20
|
+
Object.defineProperty(exports, "Html5Audio", { enumerable: true, get: function () { return html5_audio_js_1.Html5Audio; } });
|
|
21
21
|
__exportStar(require("./props.js"), exports);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
export declare const getTimelineDuration: ({ compositionDurationInFrames, playbackRate, trimBefore, trimAfter, parentSequenceDurationInFrames, }: {
|
|
1
|
+
export declare const getTimelineDuration: ({ compositionDurationInFrames, playbackRate, trimBefore, trimAfter, parentSequenceDurationInFrames, loop, }: {
|
|
2
2
|
compositionDurationInFrames: number;
|
|
3
3
|
playbackRate: number;
|
|
4
4
|
trimBefore: number | undefined;
|
|
5
5
|
trimAfter: number | undefined;
|
|
6
6
|
parentSequenceDurationInFrames: number | null;
|
|
7
|
+
loop: boolean;
|
|
7
8
|
}) => number;
|
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getTimelineDuration = void 0;
|
|
4
4
|
const calculate_media_duration_js_1 = require("./calculate-media-duration.js");
|
|
5
|
-
const getTimelineDuration = ({ compositionDurationInFrames, playbackRate, trimBefore, trimAfter, parentSequenceDurationInFrames, }) => {
|
|
5
|
+
const getTimelineDuration = ({ compositionDurationInFrames, playbackRate, trimBefore, trimAfter, parentSequenceDurationInFrames, loop, }) => {
|
|
6
|
+
if (loop) {
|
|
7
|
+
return compositionDurationInFrames;
|
|
8
|
+
}
|
|
6
9
|
const mediaDuration = (0, calculate_media_duration_js_1.calculateMediaDuration)({
|
|
7
10
|
mediaDurationInFrames: compositionDurationInFrames * playbackRate + (trimBefore !== null && trimBefore !== void 0 ? trimBefore : 0),
|
|
8
11
|
playbackRate,
|
package/dist/cjs/internals.d.ts
CHANGED
|
@@ -87,7 +87,7 @@ export declare const Internals: {
|
|
|
87
87
|
values: T;
|
|
88
88
|
};
|
|
89
89
|
readonly wrapInSchema: <S extends SequenceSchema, Props extends object>(Component: React.ComponentType<Props & {
|
|
90
|
-
readonly
|
|
90
|
+
readonly _experimentalControls: import("./CompositionManager.js").SequenceControls | undefined;
|
|
91
91
|
}>, schema: S) => React.ComponentType<Props>;
|
|
92
92
|
readonly useSequenceControlOverride: (key: string) => unknown | undefined;
|
|
93
93
|
readonly RemotionRootContexts: import("react").FC<{
|
|
@@ -401,7 +401,7 @@ export declare const Internals: {
|
|
|
401
401
|
}, "ref"> & import("react").RefAttributes<HTMLAudioElement>>;
|
|
402
402
|
readonly OBJECTFIT_CONTAIN_CLASS_NAME: "__remotion_objectfitcontain";
|
|
403
403
|
readonly InnerOffthreadVideo: import("react").FC<import("./video/props.js").AllOffthreadVideoProps>;
|
|
404
|
-
readonly useBasicMediaInTimeline: ({ volume, mediaVolume, mediaType, src, displayName, trimBefore, trimAfter, playbackRate, }: {
|
|
404
|
+
readonly useBasicMediaInTimeline: ({ volume, mediaVolume, mediaType, src, displayName, trimBefore, trimAfter, playbackRate, sequenceDurationInFrames, mediaStartsAt, loop, }: {
|
|
405
405
|
volume: import("./volume-prop.js").VolumeProp | undefined;
|
|
406
406
|
mediaVolume: number;
|
|
407
407
|
mediaType: "audio" | "video" | "image";
|
|
@@ -410,14 +410,19 @@ export declare const Internals: {
|
|
|
410
410
|
trimBefore: number | undefined;
|
|
411
411
|
trimAfter: number | undefined;
|
|
412
412
|
playbackRate: number;
|
|
413
|
+
sequenceDurationInFrames: number;
|
|
414
|
+
mediaStartsAt: number;
|
|
415
|
+
loop: boolean;
|
|
413
416
|
}) => {
|
|
414
417
|
volumes: string | number;
|
|
415
418
|
duration: number;
|
|
416
419
|
doesVolumeChange: boolean;
|
|
417
420
|
nonce: import("./nonce.js").NonceHistoryContext;
|
|
418
421
|
rootId: string;
|
|
419
|
-
isStudio: boolean;
|
|
420
422
|
finalDisplayName: string;
|
|
423
|
+
startMediaFrom: number;
|
|
424
|
+
src: string;
|
|
425
|
+
playbackRate: number;
|
|
421
426
|
};
|
|
422
427
|
readonly getInputPropsOverride: () => Record<string, unknown> | null;
|
|
423
428
|
readonly setInputPropsOverride: (override: Record<string, unknown> | null) => void;
|
package/dist/cjs/loop/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { LayoutAndStyle } from '../Sequence.js';
|
|
2
|
+
import type { LayoutAndStyle, SequenceProps } from '../Sequence.js';
|
|
3
3
|
export type LoopProps = {
|
|
4
4
|
readonly durationInFrames: number;
|
|
5
5
|
readonly times?: number;
|
|
6
6
|
readonly name?: string;
|
|
7
7
|
readonly children: React.ReactNode;
|
|
8
|
-
} & LayoutAndStyle
|
|
8
|
+
} & LayoutAndStyle & Pick<SequenceProps, 'showInTimeline'>;
|
|
9
9
|
type LoopContextType = {
|
|
10
10
|
iteration: number;
|
|
11
11
|
durationInFrames: number;
|
package/dist/cjs/loop/index.js
CHANGED
|
@@ -48,7 +48,7 @@ const useLoop = () => {
|
|
|
48
48
|
* @description This component allows you to quickly lay out an animation so it repeats itself.
|
|
49
49
|
* @see [Documentation](https://remotion.dev/docs/loop)
|
|
50
50
|
*/
|
|
51
|
-
const Loop = ({ durationInFrames, times = Infinity, children, name, ...props }) => {
|
|
51
|
+
const Loop = ({ durationInFrames, times = Infinity, children, name, showInTimeline, ...props }) => {
|
|
52
52
|
const currentFrame = (0, use_current_frame_js_1.useCurrentFrame)();
|
|
53
53
|
const { durationInFrames: compDuration } = (0, use_video_config_js_1.useVideoConfig)();
|
|
54
54
|
(0, validate_duration_in_frames_js_1.validateDurationInFrames)(durationInFrames, {
|
|
@@ -84,7 +84,7 @@ const Loop = ({ durationInFrames, times = Infinity, children, name, ...props })
|
|
|
84
84
|
durationInFrames,
|
|
85
85
|
};
|
|
86
86
|
}, [currentFrame, durationInFrames]);
|
|
87
|
-
return ((0, jsx_runtime_1.jsx)(LoopContext.Provider, { value: loopContext, children: (0, jsx_runtime_1.jsx)(Sequence_js_1.Sequence, { durationInFrames: durationInFrames, from: from, name: name !== null && name !== void 0 ? name : '<Loop>', _remotionInternalLoopDisplay: loopDisplay, layout: props.layout, style: style, children: children }) }));
|
|
87
|
+
return ((0, jsx_runtime_1.jsx)(LoopContext.Provider, { value: loopContext, children: (0, jsx_runtime_1.jsx)(Sequence_js_1.Sequence, { durationInFrames: durationInFrames, from: from, name: name !== null && name !== void 0 ? name : '<Loop>', _remotionInternalLoopDisplay: loopDisplay, layout: props.layout, style: style, showInTimeline: showInTimeline, children: children }) }));
|
|
88
88
|
};
|
|
89
89
|
exports.Loop = Loop;
|
|
90
90
|
exports.Loop.useLoop = useLoop;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { LoopDisplay, SequenceControls } from './CompositionManager.js';
|
|
2
2
|
import type { VolumeProp } from './volume-prop.js';
|
|
3
|
-
export declare const useBasicMediaInTimeline: ({ volume, mediaVolume, mediaType, src, displayName, trimBefore, trimAfter, playbackRate, }: {
|
|
3
|
+
export declare const useBasicMediaInTimeline: ({ volume, mediaVolume, mediaType, src, displayName, trimBefore, trimAfter, playbackRate, sequenceDurationInFrames, mediaStartsAt, loop, }: {
|
|
4
4
|
volume: VolumeProp | undefined;
|
|
5
5
|
mediaVolume: number;
|
|
6
6
|
mediaType: "audio" | "video" | "image";
|
|
@@ -9,15 +9,21 @@ export declare const useBasicMediaInTimeline: ({ volume, mediaVolume, mediaType,
|
|
|
9
9
|
trimBefore: number | undefined;
|
|
10
10
|
trimAfter: number | undefined;
|
|
11
11
|
playbackRate: number;
|
|
12
|
+
sequenceDurationInFrames: number;
|
|
13
|
+
mediaStartsAt: number;
|
|
14
|
+
loop: boolean;
|
|
12
15
|
}) => {
|
|
13
16
|
volumes: string | number;
|
|
14
17
|
duration: number;
|
|
15
18
|
doesVolumeChange: boolean;
|
|
16
19
|
nonce: import("./nonce.js").NonceHistoryContext;
|
|
17
20
|
rootId: string;
|
|
18
|
-
isStudio: boolean;
|
|
19
21
|
finalDisplayName: string;
|
|
22
|
+
startMediaFrom: number;
|
|
23
|
+
src: string;
|
|
24
|
+
playbackRate: number;
|
|
20
25
|
};
|
|
26
|
+
export type BasicMediaInTimelineReturnType = ReturnType<typeof useBasicMediaInTimeline>;
|
|
21
27
|
export declare const useImageInTimeline: ({ src, displayName, id, stack, showInTimeline, premountDisplay, postmountDisplay, loopDisplay, controls, }: {
|
|
22
28
|
src: string | undefined;
|
|
23
29
|
displayName: string | null;
|