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
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateOffthreadVideoImageFormat = void 0;
|
|
4
|
+
const validateOffthreadVideoImageFormat = (input) => {
|
|
5
|
+
if (typeof input === 'undefined') {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
if (typeof input !== 'string') {
|
|
9
|
+
throw new TypeError(`<OffthreadVideo imageFormat=""> must be a string, but got ${JSON.stringify(input)} instead.`);
|
|
10
|
+
}
|
|
11
|
+
if (input !== 'png' && input !== 'jpeg') {
|
|
12
|
+
throw new TypeError(`<OffthreadVideo imageFormat=""> must be either "png" or "jpeg", but got ${input}`);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
exports.validateOffthreadVideoImageFormat = validateOffthreadVideoImageFormat;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const validateSpringDuration: (dur: unknown) => void;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateSpringDuration = void 0;
|
|
4
|
+
const validateSpringDuration = (dur) => {
|
|
5
|
+
if (typeof dur === 'undefined') {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
if (typeof dur !== 'number') {
|
|
9
|
+
throw new TypeError(`A "duration" of a spring must be a "number" but is "${typeof dur}"`);
|
|
10
|
+
}
|
|
11
|
+
if (Number.isNaN(dur)) {
|
|
12
|
+
throw new TypeError('A "duration" of a spring is NaN, which it must not be');
|
|
13
|
+
}
|
|
14
|
+
if (!Number.isFinite(dur)) {
|
|
15
|
+
throw new TypeError('A "duration" of a spring must be finite, but is ' + dur);
|
|
16
|
+
}
|
|
17
|
+
if (dur <= 0) {
|
|
18
|
+
throw new TypeError('A "duration" of a spring must be positive, but is ' + dur);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
exports.validateSpringDuration = validateSpringDuration;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const VERSION = "4.0.0-prefetch.7+47cce0679";
|
package/dist/version.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OffthreadVideo = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const get_environment_1 = require("../get-environment");
|
|
6
|
+
const Sequence_1 = require("../Sequence");
|
|
7
|
+
const validate_media_props_1 = require("../validate-media-props");
|
|
8
|
+
const validate_start_from_props_1 = require("../validate-start-from-props");
|
|
9
|
+
const validate_offthreadvideo_image_format_1 = require("../validation/validate-offthreadvideo-image-format");
|
|
10
|
+
const OffthreadVideoForRendering_1 = require("./OffthreadVideoForRendering");
|
|
11
|
+
const VideoForDevelopment_1 = require("./VideoForDevelopment");
|
|
12
|
+
const OffthreadVideo = (props) => {
|
|
13
|
+
const { startFrom, endAt, ...otherProps } = props;
|
|
14
|
+
if (typeof startFrom !== 'undefined' || typeof endAt !== 'undefined') {
|
|
15
|
+
(0, validate_start_from_props_1.validateStartFromProps)(startFrom, endAt);
|
|
16
|
+
const startFromFrameNo = startFrom !== null && startFrom !== void 0 ? startFrom : 0;
|
|
17
|
+
const endAtFrameNo = endAt !== null && endAt !== void 0 ? endAt : Infinity;
|
|
18
|
+
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.OffthreadVideo, { ...otherProps }) }));
|
|
19
|
+
}
|
|
20
|
+
(0, validate_media_props_1.validateMediaProps)(props, 'Video');
|
|
21
|
+
(0, validate_offthreadvideo_image_format_1.validateOffthreadVideoImageFormat)(props.imageFormat);
|
|
22
|
+
if ((0, get_environment_1.getRemotionEnvironment)() === 'rendering') {
|
|
23
|
+
return (0, jsx_runtime_1.jsx)(OffthreadVideoForRendering_1.OffthreadVideoForRendering, { ...otherProps });
|
|
24
|
+
}
|
|
25
|
+
return (0, jsx_runtime_1.jsx)(VideoForDevelopment_1.VideoForDevelopment, { onlyWarnForMediaSeekingError: true, ...otherProps });
|
|
26
|
+
};
|
|
27
|
+
exports.OffthreadVideo = OffthreadVideo;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OffthreadVideoForRendering = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const absolute_src_1 = require("../absolute-src");
|
|
7
|
+
const use_audio_frame_1 = require("../audio/use-audio-frame");
|
|
8
|
+
const CompositionManager_1 = require("../CompositionManager");
|
|
9
|
+
const default_css_1 = require("../default-css");
|
|
10
|
+
const Img_1 = require("../Img");
|
|
11
|
+
const internals_1 = require("../internals");
|
|
12
|
+
const random_1 = require("../random");
|
|
13
|
+
const Sequence_1 = require("../Sequence");
|
|
14
|
+
const timeline_position_state_1 = require("../timeline-position-state");
|
|
15
|
+
const use_current_frame_1 = require("../use-current-frame");
|
|
16
|
+
const use_unsafe_video_config_1 = require("../use-unsafe-video-config");
|
|
17
|
+
const volume_prop_1 = require("../volume-prop");
|
|
18
|
+
const get_current_time_1 = require("./get-current-time");
|
|
19
|
+
const DEFAULT_IMAGE_FORMAT = 'jpeg';
|
|
20
|
+
const OffthreadVideoForRendering = ({ onError, volume: volumeProp, playbackRate, src, muted, imageFormat, ...props }) => {
|
|
21
|
+
const absoluteFrame = (0, timeline_position_state_1.useTimelinePosition)();
|
|
22
|
+
const frame = (0, use_current_frame_1.useCurrentFrame)();
|
|
23
|
+
const volumePropsFrame = (0, use_audio_frame_1.useFrameForVolumeProp)();
|
|
24
|
+
const videoConfig = (0, use_unsafe_video_config_1.useUnsafeVideoConfig)();
|
|
25
|
+
const sequenceContext = (0, react_1.useContext)(Sequence_1.SequenceContext);
|
|
26
|
+
const mediaStartsAt = (0, use_audio_frame_1.useMediaStartsAt)();
|
|
27
|
+
const { registerAsset, unregisterAsset } = (0, react_1.useContext)(CompositionManager_1.CompositionManager);
|
|
28
|
+
if (!src) {
|
|
29
|
+
throw new TypeError('No `src` was passed to <OffthreadVideo>.');
|
|
30
|
+
}
|
|
31
|
+
// Generate a string that's as unique as possible for this asset
|
|
32
|
+
// but at the same time the same on all threads
|
|
33
|
+
const id = (0, react_1.useMemo)(() => `offthreadvideo-${(0, random_1.random)(src !== null && src !== void 0 ? 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}`, [
|
|
34
|
+
src,
|
|
35
|
+
sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.cumulatedFrom,
|
|
36
|
+
sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.relativeFrom,
|
|
37
|
+
sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.durationInFrames,
|
|
38
|
+
]);
|
|
39
|
+
if (!videoConfig) {
|
|
40
|
+
throw new Error('No video config found');
|
|
41
|
+
}
|
|
42
|
+
const volume = (0, volume_prop_1.evaluateVolume)({
|
|
43
|
+
volume: volumeProp,
|
|
44
|
+
frame: volumePropsFrame,
|
|
45
|
+
mediaVolume: 1,
|
|
46
|
+
});
|
|
47
|
+
(0, react_1.useEffect)(() => {
|
|
48
|
+
if (!src) {
|
|
49
|
+
throw new Error('No src passed');
|
|
50
|
+
}
|
|
51
|
+
if (!window.remotion_videoEnabled) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
if (muted) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (volume <= 0) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
registerAsset({
|
|
61
|
+
type: 'video',
|
|
62
|
+
src: (0, absolute_src_1.getAbsoluteSrc)(src),
|
|
63
|
+
id,
|
|
64
|
+
frame: absoluteFrame,
|
|
65
|
+
volume,
|
|
66
|
+
mediaFrame: frame,
|
|
67
|
+
playbackRate: playbackRate !== null && playbackRate !== void 0 ? playbackRate : 1,
|
|
68
|
+
});
|
|
69
|
+
return () => unregisterAsset(id);
|
|
70
|
+
}, [
|
|
71
|
+
muted,
|
|
72
|
+
src,
|
|
73
|
+
registerAsset,
|
|
74
|
+
id,
|
|
75
|
+
unregisterAsset,
|
|
76
|
+
volume,
|
|
77
|
+
frame,
|
|
78
|
+
absoluteFrame,
|
|
79
|
+
playbackRate,
|
|
80
|
+
]);
|
|
81
|
+
const currentTime = (0, react_1.useMemo)(() => {
|
|
82
|
+
return ((0, get_current_time_1.getExpectedMediaFrameUncorrected)({
|
|
83
|
+
frame,
|
|
84
|
+
playbackRate: playbackRate || 1,
|
|
85
|
+
startFrom: -mediaStartsAt,
|
|
86
|
+
}) / videoConfig.fps);
|
|
87
|
+
}, [frame, mediaStartsAt, playbackRate, videoConfig.fps]);
|
|
88
|
+
const actualSrc = (0, react_1.useMemo)(() => {
|
|
89
|
+
return `http://localhost:${window.remotion_proxyPort}/proxy?src=${encodeURIComponent((0, absolute_src_1.getAbsoluteSrc)(src))}&time=${encodeURIComponent(currentTime)}&imageFormat=${imageFormat !== null && imageFormat !== void 0 ? imageFormat : DEFAULT_IMAGE_FORMAT}`;
|
|
90
|
+
}, [currentTime, imageFormat, src]);
|
|
91
|
+
const onErr = (0, react_1.useCallback)((e) => {
|
|
92
|
+
onError === null || onError === void 0 ? void 0 : onError(e);
|
|
93
|
+
}, [onError]);
|
|
94
|
+
const className = (0, react_1.useMemo)(() => {
|
|
95
|
+
return [default_css_1.OFFTHREAD_VIDEO_CLASS_NAME, props.className]
|
|
96
|
+
.filter(internals_1.Internals.truthy)
|
|
97
|
+
.join(' ');
|
|
98
|
+
}, [props.className]);
|
|
99
|
+
return ((0, jsx_runtime_1.jsx)(Img_1.Img, { src: actualSrc, className: className, ...props, onError: onErr }));
|
|
100
|
+
};
|
|
101
|
+
exports.OffthreadVideoForRendering = OffthreadVideoForRendering;
|
package/dist/video/Video.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { RemotionMainVideoProps } from './props';
|
|
3
|
-
export declare const Video: React.ForwardRefExoticComponent<Pick<Omit<React.DetailedHTMLProps<React.VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>, "
|
|
2
|
+
import type { RemotionMainVideoProps } from './props';
|
|
3
|
+
export declare const Video: React.ForwardRefExoticComponent<Pick<Omit<React.DetailedHTMLProps<React.VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>, "onEnded" | "autoPlay" | "controls" | "loop"> & {
|
|
4
4
|
volume?: import("../volume-prop").VolumeProp | undefined;
|
|
5
5
|
playbackRate?: number | undefined;
|
|
6
|
-
} & RemotionMainVideoProps, "
|
|
6
|
+
} & RemotionMainVideoProps, "id" | "height" | "width" | "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" | "poster" | "disablePictureInPicture" | "disableRemotePlayback" | keyof RemotionMainVideoProps> & React.RefAttributes<HTMLVideoElement>>;
|
package/dist/video/Video.js
CHANGED
|
@@ -4,7 +4,7 @@ exports.Video = 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 VideoForDevelopment_1 = require("./VideoForDevelopment");
|
|
@@ -18,12 +18,12 @@ const VideoForwardingFunction = (props, ref) => {
|
|
|
18
18
|
(0, validate_start_from_props_1.validateStartFromProps)(startFrom, endAt);
|
|
19
19
|
const startFromFrameNo = startFrom !== null && startFrom !== void 0 ? startFrom : 0;
|
|
20
20
|
const endAtFrameNo = endAt !== null && endAt !== void 0 ? endAt : Infinity;
|
|
21
|
-
return ((0, jsx_runtime_1.jsx)(
|
|
21
|
+
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.Video, { ...otherProps, ref: ref }) }));
|
|
22
22
|
}
|
|
23
23
|
(0, validate_media_props_1.validateMediaProps)(props, 'Video');
|
|
24
24
|
if ((0, get_environment_1.getRemotionEnvironment)() === 'rendering') {
|
|
25
|
-
return (0, jsx_runtime_1.jsx)(VideoForRendering_1.VideoForRendering, { ...otherProps, ref: ref }
|
|
25
|
+
return (0, jsx_runtime_1.jsx)(VideoForRendering_1.VideoForRendering, { ...otherProps, ref: ref });
|
|
26
26
|
}
|
|
27
|
-
return (0, jsx_runtime_1.jsx)(VideoForDevelopment_1.VideoForDevelopment, { ...otherProps, ref: ref }
|
|
27
|
+
return ((0, jsx_runtime_1.jsx)(VideoForDevelopment_1.VideoForDevelopment, { onlyWarnForMediaSeekingError: false, ...otherProps, ref: ref }));
|
|
28
28
|
};
|
|
29
29
|
exports.Video = (0, react_1.forwardRef)(VideoForwardingFunction);
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import type { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
1
2
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
3
|
+
export declare const VideoForDevelopment: ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>, "onEnded" | "autoPlay" | "controls" | "loop"> & {
|
|
4
|
+
volume?: import("../volume-prop").VolumeProp | undefined;
|
|
5
|
+
playbackRate?: number | undefined;
|
|
6
|
+
} & {
|
|
7
|
+
onlyWarnForMediaSeekingError: boolean;
|
|
8
|
+
} & RefAttributes<HTMLVideoElement>>;
|
|
@@ -4,6 +4,7 @@ exports.VideoForDevelopment = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const use_audio_frame_1 = require("../audio/use-audio-frame");
|
|
7
|
+
const preload_1 = require("../preload");
|
|
7
8
|
const use_media_in_timeline_1 = require("../use-media-in-timeline");
|
|
8
9
|
const use_media_playback_1 = require("../use-media-playback");
|
|
9
10
|
const use_media_tag_volume_1 = require("../use-media-tag-volume");
|
|
@@ -13,7 +14,7 @@ const VideoForDevelopmentRefForwardingFunction = (props, ref) => {
|
|
|
13
14
|
var _a;
|
|
14
15
|
const videoRef = (0, react_1.useRef)(null);
|
|
15
16
|
const volumePropFrame = (0, use_audio_frame_1.useFrameForVolumeProp)();
|
|
16
|
-
const { volume, muted, playbackRate, ...nativeProps } = props;
|
|
17
|
+
const { volume, muted, playbackRate, onlyWarnForMediaSeekingError, src, ...nativeProps } = props;
|
|
17
18
|
const actualVolume = (0, use_media_tag_volume_1.useMediaTagVolume)(videoRef);
|
|
18
19
|
const [mediaVolume] = (0, volume_position_state_1.useMediaVolumeState)();
|
|
19
20
|
const [mediaMuted] = (0, volume_position_state_1.useMediaMutedState)();
|
|
@@ -22,7 +23,7 @@ const VideoForDevelopmentRefForwardingFunction = (props, ref) => {
|
|
|
22
23
|
volume,
|
|
23
24
|
mediaVolume,
|
|
24
25
|
mediaType: 'video',
|
|
25
|
-
src
|
|
26
|
+
src,
|
|
26
27
|
});
|
|
27
28
|
(0, use_sync_volume_with_media_tag_1.useSyncVolumeWithMediaTag)({
|
|
28
29
|
volumePropFrame,
|
|
@@ -33,13 +34,36 @@ const VideoForDevelopmentRefForwardingFunction = (props, ref) => {
|
|
|
33
34
|
});
|
|
34
35
|
(0, use_media_playback_1.useMediaPlayback)({
|
|
35
36
|
mediaRef: videoRef,
|
|
36
|
-
src
|
|
37
|
+
src,
|
|
37
38
|
mediaType: 'video',
|
|
38
39
|
playbackRate: (_a = props.playbackRate) !== null && _a !== void 0 ? _a : 1,
|
|
40
|
+
onlyWarnForMediaSeekingError,
|
|
39
41
|
});
|
|
42
|
+
const actualSrc = (0, preload_1.usePreload)(src);
|
|
40
43
|
(0, react_1.useImperativeHandle)(ref, () => {
|
|
41
44
|
return videoRef.current;
|
|
42
45
|
});
|
|
43
|
-
|
|
46
|
+
(0, react_1.useEffect)(() => {
|
|
47
|
+
const { current } = videoRef;
|
|
48
|
+
if (!current) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const errorHandler = () => {
|
|
52
|
+
var _a;
|
|
53
|
+
if (current === null || current === void 0 ? void 0 : current.error) {
|
|
54
|
+
console.error('Error occurred in video', current === null || current === void 0 ? void 0 : current.error);
|
|
55
|
+
throw new Error(`The browser threw an error while playing the video ${src}: Code ${current.error.code} - ${(_a = current === null || current === void 0 ? void 0 : current.error) === null || _a === void 0 ? void 0 : _a.message}. See https://remotion.dev/docs/media-playback-error for help`);
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
throw new Error('The browser threw an error');
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
current.addEventListener('error', errorHandler, { once: true });
|
|
62
|
+
return () => {
|
|
63
|
+
current.removeEventListener('error', errorHandler);
|
|
64
|
+
};
|
|
65
|
+
}, [src]);
|
|
66
|
+
return ((0, jsx_runtime_1.jsx)("video", { ref: videoRef, muted: muted || mediaMuted, playsInline: true, src: actualSrc, ...nativeProps }));
|
|
44
67
|
};
|
|
68
|
+
// Copy types from forwardRef but not necessary to remove ref
|
|
45
69
|
exports.VideoForDevelopment = (0, react_1.forwardRef)(VideoForDevelopmentRefForwardingFunction);
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import type { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
1
2
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
3
|
+
export declare const VideoForRendering: ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>, "onEnded" | "autoPlay" | "controls" | "loop"> & {
|
|
4
|
+
volume?: import("../volume-prop").VolumeProp | undefined;
|
|
5
|
+
playbackRate?: number | undefined;
|
|
6
|
+
} & RefAttributes<HTMLVideoElement>>;
|
|
@@ -9,28 +9,29 @@ const CompositionManager_1 = require("../CompositionManager");
|
|
|
9
9
|
const delay_render_1 = require("../delay-render");
|
|
10
10
|
const is_approximately_the_same_1 = require("../is-approximately-the-same");
|
|
11
11
|
const random_1 = require("../random");
|
|
12
|
-
const
|
|
13
|
-
const
|
|
12
|
+
const Sequence_1 = require("../Sequence");
|
|
13
|
+
const timeline_position_state_1 = require("../timeline-position-state");
|
|
14
|
+
const use_current_frame_1 = require("../use-current-frame");
|
|
14
15
|
const use_unsafe_video_config_1 = require("../use-unsafe-video-config");
|
|
15
16
|
const volume_prop_1 = require("../volume-prop");
|
|
17
|
+
const warn_about_non_seekable_media_1 = require("../warn-about-non-seekable-media");
|
|
16
18
|
const get_current_time_1 = require("./get-current-time");
|
|
17
19
|
const VideoForRenderingForwardFunction = ({ onError, volume: volumeProp, playbackRate, ...props }, ref) => {
|
|
18
|
-
const absoluteFrame = (0,
|
|
19
|
-
const frame = (0,
|
|
20
|
+
const absoluteFrame = (0, timeline_position_state_1.useTimelinePosition)();
|
|
21
|
+
const frame = (0, use_current_frame_1.useCurrentFrame)();
|
|
20
22
|
const volumePropsFrame = (0, use_audio_frame_1.useFrameForVolumeProp)();
|
|
21
23
|
const videoConfig = (0, use_unsafe_video_config_1.useUnsafeVideoConfig)();
|
|
22
24
|
const videoRef = (0, react_1.useRef)(null);
|
|
23
|
-
const sequenceContext = (0, react_1.useContext)(
|
|
25
|
+
const sequenceContext = (0, react_1.useContext)(Sequence_1.SequenceContext);
|
|
24
26
|
const mediaStartsAt = (0, use_audio_frame_1.useMediaStartsAt)();
|
|
25
27
|
const { registerAsset, unregisterAsset } = (0, react_1.useContext)(CompositionManager_1.CompositionManager);
|
|
26
28
|
// Generate a string that's as unique as possible for this asset
|
|
27
29
|
// but at the same time the same on all threads
|
|
28
30
|
const id = (0, react_1.useMemo)(() => {
|
|
29
31
|
var _a;
|
|
30
|
-
return `video-${(0, random_1.random)((_a = props.src) !== null && _a !== void 0 ? _a : '')}-${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}
|
|
32
|
+
return `video-${(0, random_1.random)((_a = props.src) !== null && _a !== void 0 ? _a : '')}-${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}`;
|
|
31
33
|
}, [
|
|
32
34
|
props.src,
|
|
33
|
-
props.muted,
|
|
34
35
|
sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.cumulatedFrom,
|
|
35
36
|
sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.relativeFrom,
|
|
36
37
|
sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.durationInFrames,
|
|
@@ -50,6 +51,12 @@ const VideoForRenderingForwardFunction = ({ onError, volume: volumeProp, playbac
|
|
|
50
51
|
if (props.muted) {
|
|
51
52
|
return;
|
|
52
53
|
}
|
|
54
|
+
if (volume <= 0) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (!window.remotion_audioEnabled) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
53
60
|
registerAsset({
|
|
54
61
|
type: 'video',
|
|
55
62
|
src: (0, absolute_src_1.getAbsoluteSrc)(props.src),
|
|
@@ -75,7 +82,11 @@ const VideoForRenderingForwardFunction = ({ onError, volume: volumeProp, playbac
|
|
|
75
82
|
return videoRef.current;
|
|
76
83
|
});
|
|
77
84
|
(0, react_1.useEffect)(() => {
|
|
78
|
-
if (!
|
|
85
|
+
if (!window.remotion_videoEnabled) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
const { current } = videoRef;
|
|
89
|
+
if (!current) {
|
|
79
90
|
return;
|
|
80
91
|
}
|
|
81
92
|
const currentTime = (() => {
|
|
@@ -85,6 +96,7 @@ const VideoForRenderingForwardFunction = ({ onError, volume: volumeProp, playbac
|
|
|
85
96
|
src: props.src,
|
|
86
97
|
playbackRate: playbackRate || 1,
|
|
87
98
|
startFrom: -mediaStartsAt,
|
|
99
|
+
mediaType: 'video',
|
|
88
100
|
});
|
|
89
101
|
})();
|
|
90
102
|
const handle = (0, delay_render_1.delayRender)(`Rendering <Video /> with src="${props.src}"`);
|
|
@@ -92,47 +104,57 @@ const VideoForRenderingForwardFunction = ({ onError, volume: volumeProp, playbac
|
|
|
92
104
|
(0, delay_render_1.continueRender)(handle);
|
|
93
105
|
return;
|
|
94
106
|
}
|
|
95
|
-
if ((0, is_approximately_the_same_1.isApproximatelyTheSame)(
|
|
96
|
-
if (
|
|
107
|
+
if ((0, is_approximately_the_same_1.isApproximatelyTheSame)(current.currentTime, currentTime)) {
|
|
108
|
+
if (current.readyState >= 2) {
|
|
97
109
|
(0, delay_render_1.continueRender)(handle);
|
|
98
110
|
return;
|
|
99
111
|
}
|
|
100
|
-
|
|
112
|
+
const loadedDataHandler = () => {
|
|
101
113
|
(0, delay_render_1.continueRender)(handle);
|
|
102
|
-
}
|
|
103
|
-
|
|
114
|
+
};
|
|
115
|
+
current.addEventListener('loadeddata', loadedDataHandler, { once: true });
|
|
116
|
+
return () => {
|
|
117
|
+
current.removeEventListener('loadeddata', loadedDataHandler);
|
|
118
|
+
};
|
|
104
119
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
window.
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
// Only affects macOS since it uses VideoToolbox decoding.
|
|
114
|
-
console.log('new frame ', frame, now, JSON.stringify(metadata), (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.readyState, (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.currentTime, currentTime);
|
|
120
|
+
current.currentTime = currentTime;
|
|
121
|
+
const seekedHandler = () => {
|
|
122
|
+
(0, warn_about_non_seekable_media_1.warnAboutNonSeekableMedia)(current, 'exception');
|
|
123
|
+
if (window.navigator.platform.startsWith('Mac')) {
|
|
124
|
+
// Improve me: This is ensures frame perfectness but slows down render.
|
|
125
|
+
// Please see this issue for context: https://github.com/remotion-dev/remotion/issues/200
|
|
126
|
+
// Only affects macOS since it uses VideoToolbox decoding.
|
|
127
|
+
setTimeout(() => {
|
|
115
128
|
(0, delay_render_1.continueRender)(handle);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
});
|
|
123
|
-
|
|
129
|
+
}, 100);
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
(0, delay_render_1.continueRender)(handle);
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
current.addEventListener('seeked', seekedHandler, { once: true });
|
|
136
|
+
const endedHandler = () => {
|
|
124
137
|
(0, delay_render_1.continueRender)(handle);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
138
|
+
};
|
|
139
|
+
current.addEventListener('ended', endedHandler, { once: true });
|
|
140
|
+
const errorHandler = () => {
|
|
141
|
+
var _a;
|
|
142
|
+
if (current === null || current === void 0 ? void 0 : current.error) {
|
|
143
|
+
console.error('Error occurred in video', current === null || current === void 0 ? void 0 : current.error);
|
|
144
|
+
throw new Error(`The browser threw an error while playing the video ${props.src}: Code ${current.error.code} - ${(_a = current === null || current === void 0 ? void 0 : current.error) === null || _a === void 0 ? void 0 : _a.message}. See https://remotion.dev/docs/media-playback-error for help`);
|
|
131
145
|
}
|
|
132
146
|
else {
|
|
133
|
-
throw new Error('The browser threw an
|
|
147
|
+
throw new Error('The browser threw an error');
|
|
134
148
|
}
|
|
135
|
-
}
|
|
149
|
+
};
|
|
150
|
+
current.addEventListener('error', errorHandler, { once: true });
|
|
151
|
+
// If video skips to another frame or unmounts, we clear the created handle
|
|
152
|
+
return () => {
|
|
153
|
+
current.removeEventListener('ended', endedHandler);
|
|
154
|
+
current.removeEventListener('error', errorHandler);
|
|
155
|
+
current.removeEventListener('seeked', seekedHandler);
|
|
156
|
+
(0, delay_render_1.continueRender)(handle);
|
|
157
|
+
};
|
|
136
158
|
}, [
|
|
137
159
|
volumePropsFrame,
|
|
138
160
|
props.src,
|
|
@@ -141,6 +163,6 @@ const VideoForRenderingForwardFunction = ({ onError, volume: volumeProp, playbac
|
|
|
141
163
|
frame,
|
|
142
164
|
mediaStartsAt,
|
|
143
165
|
]);
|
|
144
|
-
return (0, jsx_runtime_1.jsx)("video", { ref: videoRef, ...props, onError: onError }
|
|
166
|
+
return (0, jsx_runtime_1.jsx)("video", { ref: videoRef, ...props, onError: onError });
|
|
145
167
|
};
|
|
146
168
|
exports.VideoForRendering = (0, react_1.forwardRef)(VideoForRenderingForwardFunction);
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const getExpectedMediaFrameUncorrected: ({ frame, playbackRate, startFrom, }: {
|
|
2
|
+
frame: number;
|
|
3
|
+
playbackRate: number;
|
|
4
|
+
startFrom: number;
|
|
5
|
+
}) => number;
|
|
6
|
+
export declare const getMediaTime: ({ fps, frame, src, playbackRate, startFrom, mediaType, }: {
|
|
2
7
|
fps: number;
|
|
3
8
|
frame: number;
|
|
4
9
|
src: string;
|
|
5
10
|
playbackRate: number;
|
|
6
11
|
startFrom: number;
|
|
12
|
+
mediaType: 'video' | 'audio';
|
|
7
13
|
}) => number;
|
|
@@ -1,22 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Calculate the `.currentTime` of a video or audio element
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.getMediaTime = void 0;
|
|
4
|
+
exports.getMediaTime = exports.getExpectedMediaFrameUncorrected = void 0;
|
|
5
5
|
const interpolate_1 = require("../interpolate");
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
const getExpectedMediaFrameUncorrected = ({ frame, playbackRate, startFrom, }) => {
|
|
7
|
+
return (0, interpolate_1.interpolate)(frame, [-1, startFrom, startFrom + 1], [-1, startFrom, startFrom + playbackRate]);
|
|
8
|
+
};
|
|
9
|
+
exports.getExpectedMediaFrameUncorrected = getExpectedMediaFrameUncorrected;
|
|
10
|
+
const getMediaTime = ({ fps, frame, src, playbackRate, startFrom, mediaType, }) => {
|
|
11
|
+
const expectedFrame = (0, exports.getExpectedMediaFrameUncorrected)({
|
|
12
|
+
frame,
|
|
13
|
+
playbackRate,
|
|
14
|
+
startFrom,
|
|
15
|
+
});
|
|
14
16
|
if (src.endsWith('webm')) {
|
|
15
17
|
// For WebM videos, we need to add a little bit of shift to get the right frame.
|
|
16
18
|
const msPerFrame = 1000 / fps;
|
|
17
19
|
const msShift = msPerFrame / 2;
|
|
18
20
|
return (expectedFrame * msPerFrame + msShift) / 1000;
|
|
19
21
|
}
|
|
22
|
+
if (mediaType === 'video') {
|
|
23
|
+
// In Chrome, for MP4s, if 30fps, the first frame is still displayed at 0.033333
|
|
24
|
+
// even though after that it increases by 0.033333333 each.
|
|
25
|
+
// So frame = 0 in Remotion is like frame = 1 for the browser
|
|
26
|
+
return (expectedFrame + 1) / fps;
|
|
27
|
+
}
|
|
20
28
|
// For audio, we don't do any shift correction
|
|
21
29
|
return expectedFrame / fps;
|
|
22
30
|
};
|
package/dist/video/index.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export { OffthreadVideo } from './OffthreadVideo';
|
|
2
|
+
export { OffthreadVideoImageFormat, OffthreadVideoProps as RemotionOffthreadVideoProps, RemotionMainVideoProps, RemotionVideoProps, } from './props';
|
|
3
|
+
export { Video } from './Video';
|