remotion 4.0.354 → 4.0.356
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 +1 -1
- package/dist/cjs/Sequence.js +4 -0
- package/dist/cjs/SequenceContext.d.ts +2 -0
- package/dist/cjs/audio/Audio.js +3 -3
- package/dist/cjs/audio/AudioForPreview.js +3 -3
- package/dist/cjs/audio/AudioForRendering.js +1 -1
- package/dist/cjs/internals.d.ts +5 -1
- package/dist/cjs/internals.js +2 -0
- package/dist/cjs/validate-media-props.d.ts +5 -4
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/video/OffthreadVideo.d.ts +2 -1
- package/dist/cjs/video/OffthreadVideo.js +18 -12
- package/dist/cjs/video/OffthreadVideoForRendering.d.ts +2 -2
- package/dist/cjs/video/OffthreadVideoForRendering.js +7 -7
- package/dist/cjs/video/Video.d.ts +1 -2
- package/dist/cjs/video/Video.js +3 -3
- package/dist/cjs/video/VideoForPreview.js +4 -4
- package/dist/cjs/video/VideoForRendering.js +1 -1
- package/dist/cjs/video/props.d.ts +39 -34
- package/dist/esm/index.mjs +473 -383
- package/dist/esm/version.mjs +1 -1
- package/package.json +2 -2
- package/dist/cjs/video/use-audio-channel-index.d.ts +0 -4
- package/dist/cjs/video/use-audio-channel-index.js +0 -13
- package/dist/esm/index.mjs.map +0 -137
package/dist/cjs/Sequence.js
CHANGED
|
@@ -72,6 +72,8 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, durationInFrames = Inf
|
|
|
72
72
|
width: (_c = width !== null && width !== void 0 ? width : parentSequence === null || parentSequence === void 0 ? void 0 : parentSequence.width) !== null && _c !== void 0 ? _c : null,
|
|
73
73
|
premounting,
|
|
74
74
|
postmounting,
|
|
75
|
+
premountDisplay: premountDisplay !== null && premountDisplay !== void 0 ? premountDisplay : null,
|
|
76
|
+
postmountDisplay: postmountDisplay !== null && postmountDisplay !== void 0 ? postmountDisplay : null,
|
|
75
77
|
};
|
|
76
78
|
}, [
|
|
77
79
|
cumulatedFrom,
|
|
@@ -83,6 +85,8 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, durationInFrames = Inf
|
|
|
83
85
|
width,
|
|
84
86
|
premounting,
|
|
85
87
|
postmounting,
|
|
88
|
+
premountDisplay,
|
|
89
|
+
postmountDisplay,
|
|
86
90
|
]);
|
|
87
91
|
const timelineClipName = (0, react_1.useMemo)(() => {
|
|
88
92
|
return name !== null && name !== void 0 ? name : '';
|
package/dist/cjs/audio/Audio.js
CHANGED
|
@@ -67,17 +67,17 @@ const AudioRefForwardingFunction = (props, ref) => {
|
|
|
67
67
|
}
|
|
68
68
|
const duration = durationFetched * fps;
|
|
69
69
|
return ((0, jsx_runtime_1.jsx)(index_js_1.Loop, { layout: "none", durationInFrames: (0, calculate_loop_js_1.calculateLoopDuration)({
|
|
70
|
-
endAt: trimAfterValue
|
|
70
|
+
endAt: trimAfterValue,
|
|
71
71
|
mediaDuration: duration,
|
|
72
72
|
playbackRate: (_b = props.playbackRate) !== null && _b !== void 0 ? _b : 1,
|
|
73
|
-
startFrom: trimBeforeValue
|
|
73
|
+
startFrom: trimBeforeValue,
|
|
74
74
|
}), children: (0, jsx_runtime_1.jsx)(exports.Audio, { ...propsOtherThanLoop, ref: ref, _remotionInternalNativeLoopPassed: true }) }));
|
|
75
75
|
}
|
|
76
76
|
if (typeof trimBeforeValue !== 'undefined' ||
|
|
77
77
|
typeof trimAfterValue !== 'undefined') {
|
|
78
78
|
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.Audio, { _remotionInternalNeedsDurationCalculation: Boolean(loop), pauseWhenBuffering: pauseWhenBuffering !== null && pauseWhenBuffering !== void 0 ? pauseWhenBuffering : false, ...otherProps, ref: ref }) }));
|
|
79
79
|
}
|
|
80
|
-
(0, validate_media_props_js_1.validateMediaProps)(props, 'Audio');
|
|
80
|
+
(0, validate_media_props_js_1.validateMediaProps)({ playbackRate: props.playbackRate, volume: props.volume }, 'Audio');
|
|
81
81
|
if (environment.isRendering) {
|
|
82
82
|
return ((0, jsx_runtime_1.jsx)(AudioForRendering_js_1.AudioForRendering, { onDuration: onDuration, ...props, ref: ref, onNativeError: onError, _remotionInternalNeedsDurationCalculation: Boolean(loop) }));
|
|
83
83
|
}
|
|
@@ -18,7 +18,7 @@ const volume_safeguard_js_1 = require("../volume-safeguard.js");
|
|
|
18
18
|
const shared_audio_tags_js_1 = require("./shared-audio-tags.js");
|
|
19
19
|
const use_audio_frame_js_1 = require("./use-audio-frame.js");
|
|
20
20
|
const AudioForDevelopmentForwardRefFunction = (props, ref) => {
|
|
21
|
-
var _a;
|
|
21
|
+
var _a, _b, _c;
|
|
22
22
|
const [initialShouldPreMountAudioElements] = (0, react_1.useState)(props.shouldPreMountAudioTags);
|
|
23
23
|
if (props.shouldPreMountAudioTags !== initialShouldPreMountAudioElements) {
|
|
24
24
|
throw new Error('Cannot change the behavior for pre-mounting audio tags dynamically.');
|
|
@@ -100,8 +100,8 @@ const AudioForDevelopmentForwardRefFunction = (props, ref) => {
|
|
|
100
100
|
id: timelineId,
|
|
101
101
|
stack: _remotionInternalStack,
|
|
102
102
|
showInTimeline,
|
|
103
|
-
premountDisplay: null,
|
|
104
|
-
postmountDisplay: null,
|
|
103
|
+
premountDisplay: (_b = sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.premountDisplay) !== null && _b !== void 0 ? _b : null,
|
|
104
|
+
postmountDisplay: (_c = sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.postmountDisplay) !== null && _c !== void 0 ? _c : null,
|
|
105
105
|
onAutoPlayError: null,
|
|
106
106
|
isPremounting: Boolean(sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.premounting),
|
|
107
107
|
isPostmounting: Boolean(sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.postmounting),
|
|
@@ -64,7 +64,7 @@ const AudioForRenderingRefForwardingFunction = (props, ref) => {
|
|
|
64
64
|
volume,
|
|
65
65
|
mediaFrame: frame,
|
|
66
66
|
playbackRate: (_a = props.playbackRate) !== null && _a !== void 0 ? _a : 1,
|
|
67
|
-
toneFrequency: toneFrequency !== null && toneFrequency !== void 0 ? toneFrequency :
|
|
67
|
+
toneFrequency: toneFrequency !== null && toneFrequency !== void 0 ? toneFrequency : 1,
|
|
68
68
|
audioStartFrame: Math.max(0, -((_b = sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.relativeFrom) !== null && _b !== void 0 ? _b : 0)),
|
|
69
69
|
audioStreamIndex: audioStreamIndex !== null && audioStreamIndex !== void 0 ? audioStreamIndex : 0,
|
|
70
70
|
});
|
package/dist/cjs/internals.d.ts
CHANGED
|
@@ -28,7 +28,10 @@ export declare const Internals: {
|
|
|
28
28
|
trimBefore: number | undefined;
|
|
29
29
|
trimAfter: number | undefined;
|
|
30
30
|
}) => void;
|
|
31
|
-
readonly validateMediaProps: (props:
|
|
31
|
+
readonly validateMediaProps: (props: {
|
|
32
|
+
volume: import("./volume-prop.js").VolumeProp | undefined;
|
|
33
|
+
playbackRate: number | undefined;
|
|
34
|
+
}, component: "Video" | "Audio") => void;
|
|
32
35
|
readonly resolveTrimProps: ({ startFrom, endAt, trimBefore, trimAfter, }: {
|
|
33
36
|
startFrom: number | undefined;
|
|
34
37
|
endAt: number | undefined;
|
|
@@ -308,5 +311,6 @@ export declare const Internals: {
|
|
|
308
311
|
readonly onNativeError: React.ReactEventHandler<HTMLAudioElement>;
|
|
309
312
|
}, "ref"> & import("react").RefAttributes<HTMLAudioElement>>;
|
|
310
313
|
readonly OBJECTFIT_CONTAIN_CLASS_NAME: "__remotion_objectfitcontain";
|
|
314
|
+
readonly InnerOffthreadVideo: import("react").FC<import("./video/props.js").AllOffthreadVideoProps>;
|
|
311
315
|
};
|
|
312
316
|
export type { CompositionManagerContext, CompProps, LoggingContextValue, MediaVolumeContextValue, RemotionEnvironment, SerializedJSONWithCustomFields, SetMediaVolumeContextValue, SetTimelineContextValue, TCompMetadata, TComposition, TimelineContextValue, TRenderAsset, TSequence, WatchRemotionStaticFilesPayload, };
|
package/dist/cjs/internals.js
CHANGED
|
@@ -78,6 +78,7 @@ const validate_start_from_props_js_1 = require("./validate-start-from-props.js")
|
|
|
78
78
|
const validate_artifact_js_1 = require("./validation/validate-artifact.js");
|
|
79
79
|
const validate_composition_id_js_1 = require("./validation/validate-composition-id.js");
|
|
80
80
|
const duration_state_js_1 = require("./video/duration-state.js");
|
|
81
|
+
const OffthreadVideo_js_1 = require("./video/OffthreadVideo.js");
|
|
81
82
|
const video_fragment_js_1 = require("./video/video-fragment.js");
|
|
82
83
|
const VideoForPreview_js_1 = require("./video/VideoForPreview.js");
|
|
83
84
|
const volume_position_state_js_1 = require("./volume-position-state.js");
|
|
@@ -169,4 +170,5 @@ exports.Internals = {
|
|
|
169
170
|
warnAboutTooHighVolume: volume_safeguard_js_1.warnAboutTooHighVolume,
|
|
170
171
|
AudioForPreview: AudioForPreview_js_1.AudioForPreview,
|
|
171
172
|
OBJECTFIT_CONTAIN_CLASS_NAME: default_css_js_1.OBJECTFIT_CONTAIN_CLASS_NAME,
|
|
173
|
+
InnerOffthreadVideo: OffthreadVideo_js_1.InnerOffthreadVideo,
|
|
172
174
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import type { VolumeProp } from './volume-prop.js';
|
|
2
|
+
export declare const validateMediaProps: (props: {
|
|
3
|
+
volume: VolumeProp | undefined;
|
|
4
|
+
playbackRate: number | undefined;
|
|
5
|
+
}, component: "Video" | "Audio") => void;
|
package/dist/cjs/version.d.ts
CHANGED
package/dist/cjs/version.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { RemotionOffthreadVideoProps } from './props.js';
|
|
2
|
+
import type { AllOffthreadVideoProps, RemotionOffthreadVideoProps } from './props.js';
|
|
3
|
+
export declare const InnerOffthreadVideo: React.FC<AllOffthreadVideoProps>;
|
|
3
4
|
export declare const OffthreadVideo: React.FC<RemotionOffthreadVideoProps>;
|
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.OffthreadVideo = void 0;
|
|
3
|
+
exports.OffthreadVideo = exports.InnerOffthreadVideo = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const Sequence_js_1 = require("../Sequence.js");
|
|
7
|
+
const enable_sequence_stack_traces_js_1 = require("../enable-sequence-stack-traces.js");
|
|
7
8
|
const use_remotion_environment_js_1 = require("../use-remotion-environment.js");
|
|
8
9
|
const validate_media_props_js_1 = require("../validate-media-props.js");
|
|
9
10
|
const validate_start_from_props_js_1 = require("../validate-start-from-props.js");
|
|
10
11
|
const OffthreadVideoForRendering_js_1 = require("./OffthreadVideoForRendering.js");
|
|
11
12
|
const VideoForPreview_js_1 = require("./VideoForPreview.js");
|
|
12
|
-
|
|
13
|
-
* @description This method imports and displays a video, similar to <Video />. During rendering, it extracts the exact frame from the video and displays it in an <img> tag
|
|
14
|
-
* @see [Documentation](https://www.remotion.dev/docs/offthreadvideo)
|
|
15
|
-
*/
|
|
16
|
-
const OffthreadVideo = (props) => {
|
|
13
|
+
const InnerOffthreadVideo = (props) => {
|
|
17
14
|
// Should only destruct `startFrom` and `endAt` from props,
|
|
18
15
|
// rest gets drilled down
|
|
19
16
|
const { startFrom, endAt, trimBefore, trimAfter, name, pauseWhenBuffering, stack, showInTimeline, ...otherProps } = props;
|
|
@@ -22,9 +19,6 @@ const OffthreadVideo = (props) => {
|
|
|
22
19
|
if (typeof props.src !== 'string') {
|
|
23
20
|
throw new TypeError(`The \`<OffthreadVideo>\` tag requires a string for \`src\`, but got ${JSON.stringify(props.src)} instead.`);
|
|
24
21
|
}
|
|
25
|
-
if (props.imageFormat) {
|
|
26
|
-
throw new TypeError(`The \`<OffthreadVideo>\` tag does no longer accept \`imageFormat\`. Use the \`transparent\` prop if you want to render a transparent video.`);
|
|
27
|
-
}
|
|
28
22
|
(0, validate_start_from_props_js_1.validateMediaTrimProps)({ startFrom, endAt, trimBefore, trimAfter });
|
|
29
23
|
const { trimBeforeValue, trimAfterValue } = (0, validate_start_from_props_js_1.resolveTrimProps)({
|
|
30
24
|
startFrom,
|
|
@@ -34,13 +28,25 @@ const OffthreadVideo = (props) => {
|
|
|
34
28
|
});
|
|
35
29
|
if (typeof trimBeforeValue !== 'undefined' ||
|
|
36
30
|
typeof trimAfterValue !== 'undefined') {
|
|
37
|
-
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.
|
|
31
|
+
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.InnerOffthreadVideo, { pauseWhenBuffering: pauseWhenBuffering !== null && pauseWhenBuffering !== void 0 ? pauseWhenBuffering : false, ...otherProps, trimAfter: undefined, name: undefined, showInTimeline: showInTimeline, trimBefore: undefined, stack: undefined, startFrom: undefined, endAt: undefined }) }));
|
|
38
32
|
}
|
|
39
33
|
(0, validate_media_props_js_1.validateMediaProps)(props, 'Video');
|
|
40
34
|
if (environment.isRendering) {
|
|
41
|
-
return (0, jsx_runtime_1.jsx)(OffthreadVideoForRendering_js_1.OffthreadVideoForRendering, { ...otherProps });
|
|
35
|
+
return ((0, jsx_runtime_1.jsx)(OffthreadVideoForRendering_js_1.OffthreadVideoForRendering, { pauseWhenBuffering: pauseWhenBuffering !== null && pauseWhenBuffering !== void 0 ? pauseWhenBuffering : false, ...otherProps, trimAfter: undefined, name: undefined, showInTimeline: showInTimeline, trimBefore: undefined, stack: undefined, startFrom: undefined, endAt: undefined }));
|
|
42
36
|
}
|
|
43
37
|
const { transparent, toneMapped, onAutoPlayError, onVideoFrame, crossOrigin, delayRenderRetries, delayRenderTimeoutInMilliseconds, ...propsForPreview } = otherProps;
|
|
44
|
-
return ((0, jsx_runtime_1.jsx)(VideoForPreview_js_1.VideoForPreview, { _remotionInternalStack: stack !== null && stack !== void 0 ? stack : null,
|
|
38
|
+
return ((0, jsx_runtime_1.jsx)(VideoForPreview_js_1.VideoForPreview, { _remotionInternalStack: stack !== null && stack !== void 0 ? stack : null, onDuration: onDuration, onlyWarnForMediaSeekingError: true, pauseWhenBuffering: pauseWhenBuffering !== null && pauseWhenBuffering !== void 0 ? pauseWhenBuffering : false, showInTimeline: showInTimeline !== null && showInTimeline !== void 0 ? showInTimeline : true, onAutoPlayError: onAutoPlayError !== null && onAutoPlayError !== void 0 ? onAutoPlayError : undefined, onVideoFrame: onVideoFrame !== null && onVideoFrame !== void 0 ? onVideoFrame : null, crossOrigin: crossOrigin, ...propsForPreview, _remotionInternalNativeLoopPassed: false }));
|
|
39
|
+
};
|
|
40
|
+
exports.InnerOffthreadVideo = InnerOffthreadVideo;
|
|
41
|
+
/*
|
|
42
|
+
* @description This method imports and displays a video, similar to <Video />. During rendering, it extracts the exact frame from the video and displays it in an <img> tag
|
|
43
|
+
* @see [Documentation](https://www.remotion.dev/docs/offthreadvideo)
|
|
44
|
+
*/
|
|
45
|
+
const OffthreadVideo = ({ src, acceptableTimeShiftInSeconds, allowAmplificationDuringRender, audioStreamIndex, className, crossOrigin, delayRenderRetries, delayRenderTimeoutInMilliseconds, id, loopVolumeCurveBehavior, muted, name, onAutoPlayError, onError, onVideoFrame, pauseWhenBuffering, playbackRate, showInTimeline, style, toneFrequency, toneMapped, transparent, trimAfter, trimBefore, useWebAudioApi, volume, _remotionInternalNativeLoopPassed, endAt, stack, startFrom, imageFormat, }) => {
|
|
46
|
+
if (imageFormat) {
|
|
47
|
+
throw new TypeError(`The \`<OffthreadVideo>\` tag does no longer accept \`imageFormat\`. Use the \`transparent\` prop if you want to render a transparent video.`);
|
|
48
|
+
}
|
|
49
|
+
return ((0, jsx_runtime_1.jsx)(exports.InnerOffthreadVideo, { acceptableTimeShiftInSeconds: acceptableTimeShiftInSeconds, allowAmplificationDuringRender: allowAmplificationDuringRender !== null && allowAmplificationDuringRender !== void 0 ? allowAmplificationDuringRender : true, audioStreamIndex: audioStreamIndex !== null && audioStreamIndex !== void 0 ? audioStreamIndex : 0, className: className, crossOrigin: crossOrigin, delayRenderRetries: delayRenderRetries, delayRenderTimeoutInMilliseconds: delayRenderTimeoutInMilliseconds, id: id, loopVolumeCurveBehavior: loopVolumeCurveBehavior !== null && loopVolumeCurveBehavior !== void 0 ? loopVolumeCurveBehavior : 'repeat', muted: muted !== null && muted !== void 0 ? muted : false, name: name, onAutoPlayError: onAutoPlayError !== null && onAutoPlayError !== void 0 ? onAutoPlayError : null, onError: onError, onVideoFrame: onVideoFrame, pauseWhenBuffering: pauseWhenBuffering !== null && pauseWhenBuffering !== void 0 ? pauseWhenBuffering : true, playbackRate: playbackRate !== null && playbackRate !== void 0 ? playbackRate : 1, toneFrequency: toneFrequency !== null && toneFrequency !== void 0 ? toneFrequency : 1, showInTimeline: showInTimeline !== null && showInTimeline !== void 0 ? showInTimeline : true, src: src, stack: stack, startFrom: startFrom, _remotionInternalNativeLoopPassed: _remotionInternalNativeLoopPassed !== null && _remotionInternalNativeLoopPassed !== void 0 ? _remotionInternalNativeLoopPassed : false, endAt: endAt, style: style, toneMapped: toneMapped !== null && toneMapped !== void 0 ? toneMapped : true, transparent: transparent !== null && transparent !== void 0 ? transparent : false, trimAfter: trimAfter, trimBefore: trimBefore, useWebAudioApi: useWebAudioApi !== null && useWebAudioApi !== void 0 ? useWebAudioApi : false, volume: volume }));
|
|
45
50
|
};
|
|
46
51
|
exports.OffthreadVideo = OffthreadVideo;
|
|
52
|
+
(0, enable_sequence_stack_traces_js_1.addSequenceStackTraces)(exports.OffthreadVideo);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type {
|
|
3
|
-
export declare const OffthreadVideoForRendering: React.FC<
|
|
2
|
+
import type { AllOffthreadVideoProps } from './props.js';
|
|
3
|
+
export declare const OffthreadVideoForRendering: React.FC<AllOffthreadVideoProps>;
|
|
@@ -20,13 +20,13 @@ const volume_prop_js_1 = require("../volume-prop.js");
|
|
|
20
20
|
const volume_safeguard_js_1 = require("../volume-safeguard.js");
|
|
21
21
|
const get_current_time_js_1 = require("./get-current-time.js");
|
|
22
22
|
const offthread_video_source_js_1 = require("./offthread-video-source.js");
|
|
23
|
-
const OffthreadVideoForRendering = ({ onError, volume: volumeProp, playbackRate, src, muted, allowAmplificationDuringRender, transparent
|
|
23
|
+
const OffthreadVideoForRendering = ({ onError, volume: volumeProp, playbackRate, src, muted, allowAmplificationDuringRender, transparent, toneMapped, toneFrequency, name, loopVolumeCurveBehavior, delayRenderRetries, delayRenderTimeoutInMilliseconds, onVideoFrame,
|
|
24
24
|
// Remove crossOrigin prop during rendering
|
|
25
25
|
// https://discord.com/channels/809501355504959528/844143007183667220/1311639632496033813
|
|
26
26
|
crossOrigin, audioStreamIndex, ...props }) => {
|
|
27
27
|
const absoluteFrame = (0, timeline_position_state_js_1.useTimelinePosition)();
|
|
28
28
|
const frame = (0, use_current_frame_js_1.useCurrentFrame)();
|
|
29
|
-
const volumePropsFrame = (0, use_audio_frame_js_1.useFrameForVolumeProp)(loopVolumeCurveBehavior
|
|
29
|
+
const volumePropsFrame = (0, use_audio_frame_js_1.useFrameForVolumeProp)(loopVolumeCurveBehavior);
|
|
30
30
|
const videoConfig = (0, use_unsafe_video_config_js_1.useUnsafeVideoConfig)();
|
|
31
31
|
const sequenceContext = (0, react_1.useContext)(SequenceContext_js_1.SequenceContext);
|
|
32
32
|
const mediaStartsAt = (0, use_audio_frame_js_1.useMediaStartsAt)();
|
|
@@ -36,7 +36,7 @@ crossOrigin, audioStreamIndex, ...props }) => {
|
|
|
36
36
|
}
|
|
37
37
|
// Generate a string that's as unique as possible for this asset
|
|
38
38
|
// but at the same time the same on all threads
|
|
39
|
-
const id = (0, react_1.useMemo)(() => `offthreadvideo-${(0, random_js_1.random)(src
|
|
39
|
+
const id = (0, react_1.useMemo)(() => `offthreadvideo-${(0, random_js_1.random)(src)}-${sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.cumulatedFrom}-${sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.relativeFrom}-${sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.durationInFrames}`, [
|
|
40
40
|
src,
|
|
41
41
|
sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.cumulatedFrom,
|
|
42
42
|
sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.relativeFrom,
|
|
@@ -72,10 +72,10 @@ crossOrigin, audioStreamIndex, ...props }) => {
|
|
|
72
72
|
frame: absoluteFrame,
|
|
73
73
|
volume,
|
|
74
74
|
mediaFrame: frame,
|
|
75
|
-
playbackRate
|
|
76
|
-
toneFrequency
|
|
75
|
+
playbackRate,
|
|
76
|
+
toneFrequency,
|
|
77
77
|
audioStartFrame: Math.max(0, -((_a = sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.relativeFrom) !== null && _a !== void 0 ? _a : 0)),
|
|
78
|
-
audioStreamIndex
|
|
78
|
+
audioStreamIndex,
|
|
79
79
|
});
|
|
80
80
|
return () => unregisterRenderAsset(id);
|
|
81
81
|
}, [
|
|
@@ -206,6 +206,6 @@ crossOrigin, audioStreamIndex, ...props }) => {
|
|
|
206
206
|
return null;
|
|
207
207
|
}
|
|
208
208
|
continueRender(imageSrc.handle);
|
|
209
|
-
return ((0, jsx_runtime_1.jsx)(Img_js_1.Img, { src: imageSrc.src,
|
|
209
|
+
return ((0, jsx_runtime_1.jsx)(Img_js_1.Img, { src: imageSrc.src, delayRenderRetries: delayRenderRetries, delayRenderTimeoutInMilliseconds: delayRenderTimeoutInMilliseconds, onImageFrame: onImageFrame, ...props, onError: onErr, className: className }));
|
|
210
210
|
};
|
|
211
211
|
exports.OffthreadVideoForRendering = OffthreadVideoForRendering;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { RemotionMainVideoProps } from './props';
|
|
3
2
|
export declare const Video: React.ForwardRefExoticComponent<Omit<import("./props").NativeVideoProps & {
|
|
4
3
|
name?: string;
|
|
5
4
|
volume?: import("../volume-prop.js").VolumeProp;
|
|
@@ -16,7 +15,7 @@ export declare const Video: React.ForwardRefExoticComponent<Omit<import("./props
|
|
|
16
15
|
onError?: (err: Error) => void;
|
|
17
16
|
onAutoPlayError?: null | (() => void);
|
|
18
17
|
audioStreamIndex?: number;
|
|
19
|
-
} &
|
|
18
|
+
} & Partial<import("./props").CommonVideoProps> & {
|
|
20
19
|
/**
|
|
21
20
|
* @deprecated For internal use only
|
|
22
21
|
*/
|
package/dist/cjs/video/Video.js
CHANGED
|
@@ -49,17 +49,17 @@ const VideoForwardingFunction = (props, ref) => {
|
|
|
49
49
|
}
|
|
50
50
|
const mediaDuration = durationFetched * fps;
|
|
51
51
|
return ((0, jsx_runtime_1.jsx)(index_js_1.Loop, { durationInFrames: (0, calculate_loop_js_1.calculateLoopDuration)({
|
|
52
|
-
endAt: trimAfterValue
|
|
52
|
+
endAt: trimAfterValue,
|
|
53
53
|
mediaDuration,
|
|
54
54
|
playbackRate: (_b = props.playbackRate) !== null && _b !== void 0 ? _b : 1,
|
|
55
|
-
startFrom: trimBeforeValue
|
|
55
|
+
startFrom: trimBeforeValue,
|
|
56
56
|
}), layout: "none", name: name, children: (0, jsx_runtime_1.jsx)(exports.Video, { ...propsOtherThanLoop, ref: ref, _remotionInternalNativeLoopPassed: true }) }));
|
|
57
57
|
}
|
|
58
58
|
if (typeof trimBeforeValue !== 'undefined' ||
|
|
59
59
|
typeof trimAfterValue !== 'undefined') {
|
|
60
60
|
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.Video, { pauseWhenBuffering: pauseWhenBuffering !== null && pauseWhenBuffering !== void 0 ? pauseWhenBuffering : false, ...otherProps, ref: ref }) }));
|
|
61
61
|
}
|
|
62
|
-
(0, validate_media_props_js_1.validateMediaProps)(props, 'Video');
|
|
62
|
+
(0, validate_media_props_js_1.validateMediaProps)({ playbackRate: props.playbackRate, volume: props.volume }, 'Video');
|
|
63
63
|
if (environment.isRendering) {
|
|
64
64
|
return ((0, jsx_runtime_1.jsx)(VideoForRendering_js_1.VideoForRendering, { onDuration: onDuration, onVideoFrame: onVideoFrame !== null && onVideoFrame !== void 0 ? onVideoFrame : null, ...otherProps, ref: ref }));
|
|
65
65
|
}
|
|
@@ -23,7 +23,7 @@ const volume_safeguard_js_1 = require("../volume-safeguard.js");
|
|
|
23
23
|
const emit_video_frame_js_1 = require("./emit-video-frame.js");
|
|
24
24
|
const video_fragment_js_1 = require("./video-fragment.js");
|
|
25
25
|
const VideoForDevelopmentRefForwardingFunction = (props, ref) => {
|
|
26
|
-
var _a, _b, _c;
|
|
26
|
+
var _a, _b, _c, _d, _e;
|
|
27
27
|
const context = (0, react_1.useContext)(shared_audio_tags_js_1.SharedAudioContext);
|
|
28
28
|
if (!context) {
|
|
29
29
|
throw new Error('SharedAudioContext not found');
|
|
@@ -75,8 +75,8 @@ const VideoForDevelopmentRefForwardingFunction = (props, ref) => {
|
|
|
75
75
|
id: timelineId,
|
|
76
76
|
stack: _remotionInternalStack,
|
|
77
77
|
showInTimeline,
|
|
78
|
-
premountDisplay: null,
|
|
79
|
-
postmountDisplay: null,
|
|
78
|
+
premountDisplay: (_c = parentSequence === null || parentSequence === void 0 ? void 0 : parentSequence.premountDisplay) !== null && _c !== void 0 ? _c : null,
|
|
79
|
+
postmountDisplay: (_d = parentSequence === null || parentSequence === void 0 ? void 0 : parentSequence.postmountDisplay) !== null && _d !== void 0 ? _d : null,
|
|
80
80
|
onAutoPlayError: onAutoPlayError !== null && onAutoPlayError !== void 0 ? onAutoPlayError : null,
|
|
81
81
|
isPremounting: Boolean(parentSequence === null || parentSequence === void 0 ? void 0 : parentSequence.premounting),
|
|
82
82
|
isPostmounting: Boolean(parentSequence === null || parentSequence === void 0 ? void 0 : parentSequence.postmounting),
|
|
@@ -87,7 +87,7 @@ const VideoForDevelopmentRefForwardingFunction = (props, ref) => {
|
|
|
87
87
|
mediaRef: videoRef,
|
|
88
88
|
src,
|
|
89
89
|
mediaType: 'video',
|
|
90
|
-
playbackRate: (
|
|
90
|
+
playbackRate: (_e = props.playbackRate) !== null && _e !== void 0 ? _e : 1,
|
|
91
91
|
onlyWarnForMediaSeekingError,
|
|
92
92
|
acceptableTimeshift: acceptableTimeShiftInSeconds !== null && acceptableTimeShiftInSeconds !== void 0 ? acceptableTimeShiftInSeconds : null,
|
|
93
93
|
isPremounting: Boolean(parentSequence === null || parentSequence === void 0 ? void 0 : parentSequence.premounting),
|
|
@@ -74,7 +74,7 @@ const VideoForRenderingForwardFunction = ({ onError, volume: volumeProp, allowAm
|
|
|
74
74
|
volume,
|
|
75
75
|
mediaFrame: frame,
|
|
76
76
|
playbackRate: playbackRate !== null && playbackRate !== void 0 ? playbackRate : 1,
|
|
77
|
-
toneFrequency: toneFrequency !== null && toneFrequency !== void 0 ? toneFrequency :
|
|
77
|
+
toneFrequency: toneFrequency !== null && toneFrequency !== void 0 ? toneFrequency : 1,
|
|
78
78
|
audioStartFrame: Math.max(0, -((_a = sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.relativeFrom) !== null && _a !== void 0 ? _a : 0)),
|
|
79
79
|
audioStreamIndex: audioStreamIndex !== null && audioStreamIndex !== void 0 ? audioStreamIndex : 0,
|
|
80
80
|
});
|
|
@@ -1,28 +1,29 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import type { LoopVolumeCurveBehavior } from '../audio/use-audio-frame.js';
|
|
3
3
|
import type { VolumeProp } from '../volume-prop.js';
|
|
4
|
-
export type
|
|
4
|
+
export type CommonVideoProps = {
|
|
5
5
|
/**
|
|
6
6
|
* @deprecated `startFrom` was renamed to `trimBefore`
|
|
7
7
|
*/
|
|
8
|
-
startFrom
|
|
8
|
+
startFrom: number | undefined;
|
|
9
9
|
/**
|
|
10
10
|
* @deprecated `endAt` was renamed to `trimAfter`
|
|
11
11
|
*/
|
|
12
|
-
endAt
|
|
12
|
+
endAt: number | undefined;
|
|
13
13
|
/**
|
|
14
|
-
* Trim of
|
|
14
|
+
* Trim of the video from the left (start) in frames.
|
|
15
15
|
*/
|
|
16
|
-
trimBefore
|
|
16
|
+
trimBefore: number | undefined;
|
|
17
17
|
/**
|
|
18
18
|
* Trim of the video from the right (end) in frames.
|
|
19
19
|
*/
|
|
20
|
-
trimAfter
|
|
20
|
+
trimAfter: number | undefined;
|
|
21
21
|
/**
|
|
22
22
|
* @deprecated Only for internal `transparent` use
|
|
23
23
|
*/
|
|
24
|
-
_remotionInternalNativeLoopPassed
|
|
24
|
+
_remotionInternalNativeLoopPassed: boolean;
|
|
25
25
|
};
|
|
26
|
+
export type RemotionMainVideoProps = Partial<CommonVideoProps>;
|
|
26
27
|
export type NativeVideoProps = Omit<React.DetailedHTMLProps<React.VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>, 'autoPlay' | 'controls' | 'onEnded' | 'nonce' | 'onError' | 'disableRemotePlayback'>;
|
|
27
28
|
export type RemotionVideoProps = NativeVideoProps & {
|
|
28
29
|
name?: string;
|
|
@@ -45,37 +46,41 @@ type DeprecatedOffthreadVideoProps = {
|
|
|
45
46
|
/**
|
|
46
47
|
* @deprecated Use the `transparent` prop instead
|
|
47
48
|
*/
|
|
48
|
-
imageFormat
|
|
49
|
+
imageFormat: never;
|
|
49
50
|
};
|
|
50
|
-
|
|
51
|
+
type MandatoryOffthreadVideoProps = {
|
|
51
52
|
src: string;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
53
|
+
};
|
|
54
|
+
type OptionalOffthreadVideoProps = {
|
|
55
|
+
className: string | undefined;
|
|
56
|
+
name: string | undefined;
|
|
57
|
+
id: string | undefined;
|
|
58
|
+
style: React.CSSProperties | undefined;
|
|
59
|
+
volume: VolumeProp | undefined;
|
|
60
|
+
playbackRate: number;
|
|
61
|
+
muted: boolean;
|
|
62
|
+
onError: undefined | ((err: Error) => void);
|
|
63
|
+
acceptableTimeShiftInSeconds: undefined | number;
|
|
64
|
+
allowAmplificationDuringRender: boolean;
|
|
65
|
+
toneFrequency: number;
|
|
66
|
+
transparent: boolean;
|
|
67
|
+
toneMapped: boolean;
|
|
68
|
+
pauseWhenBuffering: boolean;
|
|
69
|
+
loopVolumeCurveBehavior: LoopVolumeCurveBehavior;
|
|
70
|
+
delayRenderTimeoutInMilliseconds: number | undefined;
|
|
71
|
+
delayRenderRetries: number | undefined;
|
|
72
|
+
useWebAudioApi: boolean;
|
|
70
73
|
/**
|
|
71
74
|
* @deprecated For internal use only
|
|
72
75
|
*/
|
|
73
|
-
stack
|
|
74
|
-
showInTimeline
|
|
75
|
-
onAutoPlayError
|
|
76
|
-
onVideoFrame
|
|
77
|
-
crossOrigin
|
|
78
|
-
audioStreamIndex
|
|
79
|
-
}
|
|
76
|
+
stack: string | undefined;
|
|
77
|
+
showInTimeline: boolean;
|
|
78
|
+
onAutoPlayError: null | (() => void);
|
|
79
|
+
onVideoFrame: OnVideoFrame | undefined;
|
|
80
|
+
crossOrigin: '' | 'anonymous' | 'use-credentials' | undefined;
|
|
81
|
+
audioStreamIndex: number;
|
|
82
|
+
};
|
|
83
|
+
export type AllOffthreadVideoProps = MandatoryOffthreadVideoProps & OptionalOffthreadVideoProps & CommonVideoProps;
|
|
84
|
+
export type RemotionOffthreadVideoProps = MandatoryOffthreadVideoProps & Partial<OptionalOffthreadVideoProps> & Partial<CommonVideoProps> & Partial<DeprecatedOffthreadVideoProps>;
|
|
80
85
|
export type OnVideoFrame = (frame: CanvasImageSource) => void;
|
|
81
86
|
export {};
|