remotion 4.0.0-webhook.27 → 4.1.0-alpha1
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/LICENSE.md +8 -8
- package/README.md +7 -7
- package/dist/{AbsoluteFill.d.ts → cjs/AbsoluteFill.d.ts} +2 -2
- package/dist/{AbsoluteFill.js → cjs/AbsoluteFill.js} +2 -2
- package/dist/cjs/AssetManager.d.ts +11 -0
- package/dist/cjs/AssetManager.js +40 -0
- package/dist/{CanUseRemotionHooks.d.ts → cjs/CanUseRemotionHooks.d.ts} +0 -0
- package/dist/{CanUseRemotionHooks.js → cjs/CanUseRemotionHooks.js} +0 -0
- package/dist/cjs/Clipper.d.ts +7 -0
- package/dist/cjs/Clipper.js +24 -0
- package/dist/cjs/Composition.d.ts +41 -0
- package/dist/cjs/Composition.js +132 -0
- package/dist/cjs/CompositionManager.d.ts +75 -0
- package/dist/{CompositionManager.js → cjs/CompositionManager.js} +29 -66
- package/dist/cjs/CompositionManagerContext.d.ts +18 -0
- package/dist/cjs/CompositionManagerContext.js +16 -0
- package/dist/cjs/EditorProps.d.ts +15 -0
- package/dist/cjs/EditorProps.js +53 -0
- package/dist/{Folder.d.ts → cjs/Folder.d.ts} +6 -2
- package/dist/{Folder.js → cjs/Folder.js} +10 -6
- package/dist/{IFrame.d.ts → cjs/IFrame.d.ts} +4 -0
- package/dist/{IFrame.js → cjs/IFrame.js} +8 -4
- package/dist/cjs/Img.d.ts +9 -0
- package/dist/cjs/Img.js +100 -0
- package/dist/cjs/NativeLayers.d.ts +13 -0
- package/dist/cjs/NativeLayers.js +29 -0
- package/dist/cjs/Null.d.ts +2 -0
- package/dist/cjs/Null.js +25 -0
- package/dist/{RemotionRoot.d.ts → cjs/RemotionRoot.d.ts} +1 -0
- package/dist/cjs/RemotionRoot.js +72 -0
- package/dist/cjs/ResolveCompositionConfig.d.ts +24 -0
- package/dist/cjs/ResolveCompositionConfig.js +192 -0
- package/dist/cjs/Sequence.d.ts +22 -0
- package/dist/{Sequence.js → cjs/Sequence.js} +27 -29
- package/dist/cjs/SequenceContext.d.ts +9 -0
- package/dist/cjs/SequenceContext.js +5 -0
- package/dist/cjs/SequenceManager.d.ts +11 -0
- package/dist/cjs/SequenceManager.js +57 -0
- package/dist/cjs/Still.d.ts +8 -0
- package/dist/cjs/Still.js +22 -0
- package/dist/{absolute-src.d.ts → cjs/absolute-src.d.ts} +0 -0
- package/dist/{absolute-src.js → cjs/absolute-src.js} +0 -0
- package/dist/{asset-types.d.ts → cjs/asset-types.d.ts} +0 -0
- package/dist/{asset-types.js → cjs/asset-types.js} +0 -0
- package/dist/{audio → cjs/audio}/Audio.d.ts +10 -4
- package/dist/cjs/audio/Audio.js +58 -0
- package/dist/cjs/audio/AudioForDevelopment.d.ts +11 -0
- package/dist/cjs/audio/AudioForDevelopment.js +101 -0
- package/dist/cjs/audio/AudioForRendering.d.ts +10 -0
- package/dist/cjs/audio/AudioForRendering.js +111 -0
- package/dist/cjs/audio/index.d.ts +2 -0
- package/dist/{audio → cjs/audio}/index.js +2 -2
- package/dist/cjs/audio/props.d.ts +12 -0
- package/dist/{audio → cjs/audio}/props.js +0 -0
- package/dist/{audio → cjs/audio}/shared-audio-tags.d.ts +10 -4
- package/dist/{audio → cjs/audio}/shared-audio-tags.js +35 -13
- package/dist/{audio → cjs/audio}/use-audio-frame.d.ts +0 -0
- package/dist/{audio → cjs/audio}/use-audio-frame.js +4 -4
- package/dist/{bezier.d.ts → cjs/bezier.d.ts} +0 -0
- package/dist/{bezier.js → cjs/bezier.js} +0 -0
- package/dist/cjs/cancel-render.d.ts +5 -0
- package/dist/cjs/cancel-render.js +47 -0
- package/dist/{config → cjs/config}/input-props.d.ts +0 -0
- package/dist/{config → cjs/config}/input-props.js +3 -3
- package/dist/{default-css.d.ts → cjs/default-css.d.ts} +0 -0
- package/dist/{default-css.js → cjs/default-css.js} +0 -0
- package/dist/{delay-render.d.ts → cjs/delay-render.d.ts} +4 -4
- package/dist/{delay-render.js → cjs/delay-render.js} +12 -12
- package/dist/{easing.d.ts → cjs/easing.d.ts} +4 -0
- package/dist/{easing.js → cjs/easing.js} +6 -2
- package/dist/cjs/freeze.d.ts +11 -0
- package/dist/{freeze.js → cjs/freeze.js} +8 -4
- package/dist/{get-asset-file-name.d.ts → cjs/get-asset-file-name.d.ts} +0 -0
- package/dist/{get-asset-file-name.js → cjs/get-asset-file-name.js} +0 -0
- package/dist/cjs/get-environment.d.ts +3 -0
- package/dist/{get-environment.js → cjs/get-environment.js} +14 -2
- package/dist/cjs/get-preview-dom-element.d.ts +2 -0
- package/dist/cjs/get-preview-dom-element.js +8 -0
- package/dist/cjs/get-static-files.d.ts +21 -0
- package/dist/cjs/get-static-files.js +35 -0
- package/dist/{get-timeline-clip-name.d.ts → cjs/get-timeline-clip-name.d.ts} +0 -0
- package/dist/{get-timeline-clip-name.js → cjs/get-timeline-clip-name.js} +0 -0
- package/dist/cjs/index.d.ts +102 -0
- package/dist/cjs/index.js +105 -0
- package/dist/cjs/internals.d.ts +131 -0
- package/dist/cjs/internals.js +120 -0
- package/dist/{interpolate-colors.d.ts → cjs/interpolate-colors.d.ts} +5 -0
- package/dist/{interpolate-colors.js → cjs/interpolate-colors.js} +10 -10
- package/dist/{interpolate.d.ts → cjs/interpolate.d.ts} +11 -7
- package/dist/{interpolate.js → cjs/interpolate.js} +0 -0
- package/dist/{is-approximately-the-same.d.ts → cjs/is-approximately-the-same.d.ts} +0 -0
- package/dist/{is-approximately-the-same.js → cjs/is-approximately-the-same.js} +0 -0
- package/dist/cjs/is-player.d.ts +3 -0
- package/dist/cjs/is-player.js +14 -0
- package/dist/{loading-indicator.d.ts → cjs/loading-indicator.d.ts} +0 -0
- package/dist/{loading-indicator.js → cjs/loading-indicator.js} +4 -4
- package/dist/cjs/loop/index.d.ts +13 -0
- package/dist/cjs/loop/index.js +46 -0
- package/dist/{multiple-versions-warning.d.ts → cjs/multiple-versions-warning.d.ts} +0 -0
- package/dist/{multiple-versions-warning.js → cjs/multiple-versions-warning.js} +11 -6
- package/dist/{nonce.d.ts → cjs/nonce.d.ts} +1 -1
- package/dist/{nonce.js → cjs/nonce.js} +6 -0
- package/dist/{play-and-handle-not-allowed-error.d.ts → cjs/play-and-handle-not-allowed-error.d.ts} +0 -0
- package/dist/{play-and-handle-not-allowed-error.js → cjs/play-and-handle-not-allowed-error.js} +4 -0
- package/dist/{portal-node.d.ts → cjs/portal-node.d.ts} +0 -0
- package/dist/{portal-node.js → cjs/portal-node.js} +0 -0
- package/dist/cjs/prefetch-state.d.ts +8 -0
- package/dist/cjs/prefetch-state.js +27 -0
- package/dist/cjs/prefetch.d.ts +13 -0
- package/dist/{prefetch.js → cjs/prefetch.js} +43 -17
- package/dist/cjs/props-if-has-props.d.ts +10 -0
- package/dist/{video-config.js → cjs/props-if-has-props.js} +0 -0
- package/dist/cjs/random.d.ts +6 -0
- package/dist/{random.js → cjs/random.js} +3 -3
- package/dist/{register-root.d.ts → cjs/register-root.d.ts} +4 -0
- package/dist/{register-root.js → cjs/register-root.js} +4 -0
- package/dist/cjs/resolve-video-config.d.ts +8 -0
- package/dist/cjs/resolve-video-config.js +89 -0
- package/dist/cjs/series/flatten-children.d.ts +2 -0
- package/dist/{series → cjs/series}/flatten-children.js +0 -0
- package/dist/cjs/series/index.d.ts +17 -0
- package/dist/{series → cjs/series}/index.js +22 -8
- package/dist/cjs/setup-env-variables.d.ts +1 -0
- package/dist/{setup-env-variables.js → cjs/setup-env-variables.js} +7 -9
- package/dist/{spring → cjs/spring}/index.d.ts +10 -6
- package/dist/cjs/spring/index.js +75 -0
- package/dist/cjs/spring/measure-spring.d.ts +12 -0
- package/dist/{spring → cjs/spring}/measure-spring.js +8 -4
- package/dist/{spring → cjs/spring}/spring-utils.d.ts +2 -2
- package/dist/{spring → cjs/spring}/spring-utils.js +0 -0
- package/dist/cjs/static-file.d.ts +33 -0
- package/dist/cjs/static-file.js +87 -0
- package/dist/{timeline-position-state.d.ts → cjs/timeline-position-state.d.ts} +4 -4
- package/dist/{timeline-position-state.js → cjs/timeline-position-state.js} +9 -1
- package/dist/cjs/truthy.d.ts +3 -0
- package/dist/{truthy.js → cjs/truthy.js} +0 -0
- package/dist/cjs/use-current-frame.d.ts +5 -0
- package/dist/{use-current-frame.js → cjs/use-current-frame.js} +8 -9
- package/dist/cjs/use-lazy-component.d.ts +7 -0
- package/dist/{use-lazy-component.js → cjs/use-lazy-component.js} +0 -0
- package/dist/{use-media-in-timeline.d.ts → cjs/use-media-in-timeline.d.ts} +3 -2
- package/dist/{use-media-in-timeline.js → cjs/use-media-in-timeline.js} +29 -25
- package/dist/{use-media-playback.d.ts → cjs/use-media-playback.d.ts} +3 -1
- package/dist/cjs/use-media-playback.js +86 -0
- package/dist/{use-media-tag-volume.d.ts → cjs/use-media-tag-volume.d.ts} +0 -0
- package/dist/{use-media-tag-volume.js → cjs/use-media-tag-volume.js} +0 -0
- package/dist/{use-sync-volume-with-media-tag.d.ts → cjs/use-sync-volume-with-media-tag.d.ts} +2 -2
- package/dist/{use-sync-volume-with-media-tag.js → cjs/use-sync-volume-with-media-tag.js} +5 -4
- package/dist/{use-unsafe-video-config.d.ts → cjs/use-unsafe-video-config.d.ts} +1 -1
- package/dist/{use-unsafe-video-config.js → cjs/use-unsafe-video-config.js} +4 -4
- package/dist/cjs/use-video-config.d.ts +8 -0
- package/dist/cjs/use-video-config.js +34 -0
- package/dist/cjs/use-video.d.ts +7 -0
- package/dist/cjs/use-video.js +38 -0
- package/dist/cjs/validate-frame.d.ts +5 -0
- package/dist/cjs/validate-frame.js +24 -0
- package/dist/cjs/validate-media-props.d.ts +4 -0
- package/dist/{validate-media-props.js → cjs/validate-media-props.js} +0 -0
- package/dist/{validate-start-from-props.d.ts → cjs/validate-start-from-props.d.ts} +0 -0
- package/dist/{validate-start-from-props.js → cjs/validate-start-from-props.js} +0 -0
- package/dist/{validation → cjs/validation}/validate-composition-id.d.ts +0 -0
- package/dist/{validation → cjs/validation}/validate-composition-id.js +0 -0
- package/dist/cjs/validation/validate-default-props.d.ts +1 -0
- package/dist/cjs/validation/validate-default-props.js +15 -0
- package/dist/{validation → cjs/validation}/validate-dimensions.d.ts +0 -0
- package/dist/{validation → cjs/validation}/validate-dimensions.js +0 -0
- package/dist/cjs/validation/validate-duration-in-frames.d.ts +5 -0
- package/dist/{validation → cjs/validation}/validate-duration-in-frames.js +5 -2
- package/dist/{validation → cjs/validation}/validate-folder-name.d.ts +0 -0
- package/dist/{validation → cjs/validation}/validate-folder-name.js +0 -0
- package/dist/{validation → cjs/validation}/validate-fps.d.ts +0 -0
- package/dist/{validation → cjs/validation}/validate-fps.js +0 -0
- package/dist/{validation → cjs/validation}/validation-spring-duration.d.ts +0 -0
- package/dist/{validation → cjs/validation}/validation-spring-duration.js +0 -0
- package/dist/cjs/version.d.ts +1 -0
- package/dist/{version.js → cjs/version.js} +1 -1
- package/dist/cjs/video/OffthreadVideo.d.ts +7 -0
- package/dist/cjs/video/OffthreadVideo.js +38 -0
- package/dist/{video → cjs/video}/OffthreadVideoForRendering.d.ts +1 -1
- package/dist/cjs/video/OffthreadVideoForRendering.js +103 -0
- package/dist/cjs/video/Video.d.ts +12 -0
- package/dist/cjs/video/Video.js +55 -0
- package/dist/{video → cjs/video}/VideoForDevelopment.d.ts +5 -2
- package/dist/cjs/video/VideoForDevelopment.js +117 -0
- package/dist/cjs/video/VideoForRendering.d.ts +10 -0
- package/dist/cjs/video/VideoForRendering.js +208 -0
- package/dist/cjs/video/duration-state.d.ts +17 -0
- package/dist/cjs/video/duration-state.js +35 -0
- package/dist/{video → cjs/video}/get-current-time.d.ts +0 -0
- package/dist/{video → cjs/video}/get-current-time.js +12 -11
- package/dist/cjs/video/index.d.ts +3 -0
- package/dist/{video → cjs/video}/index.js +4 -4
- package/dist/cjs/video/props.d.ts +32 -0
- package/dist/cjs/video/props.js +2 -0
- package/dist/cjs/video/video-fragment.d.ts +12 -0
- package/dist/cjs/video/video-fragment.js +60 -0
- package/dist/{video-config.d.ts → cjs/video-config.d.ts} +2 -2
- package/dist/{video/props.js → cjs/video-config.js} +0 -0
- package/dist/{volume-position-state.d.ts → cjs/volume-position-state.d.ts} +4 -4
- package/dist/{volume-position-state.js → cjs/volume-position-state.js} +0 -0
- package/dist/{volume-prop.d.ts → cjs/volume-prop.d.ts} +3 -2
- package/dist/{volume-prop.js → cjs/volume-prop.js} +4 -3
- package/dist/{warn-about-non-seekable-media.d.ts → cjs/warn-about-non-seekable-media.d.ts} +0 -0
- package/dist/{warn-about-non-seekable-media.js → cjs/warn-about-non-seekable-media.js} +2 -2
- package/dist/cjs/wrap-remotion-context.d.ts +31 -0
- package/dist/cjs/wrap-remotion-context.js +85 -0
- package/dist/esm/index.mjs +4623 -0
- package/dist/esm/version.mjs +4 -0
- package/package.json +80 -57
- package/version.js +2 -1
- package/.prettierrc.js +0 -14
- package/.turbo/turbo-build.log +0 -5
- package/dist/Composition.d.ts +0 -22
- package/dist/Composition.js +0 -98
- package/dist/CompositionManager.d.ts +0 -79
- package/dist/Img.d.ts +0 -2
- package/dist/Img.js +0 -51
- package/dist/RemotionRoot.js +0 -71
- package/dist/Sequence.d.ts +0 -29
- package/dist/Still.d.ts +0 -3
- package/dist/Still.js +0 -9
- package/dist/audio/Audio.js +0 -32
- package/dist/audio/AudioForDevelopment.d.ts +0 -8
- package/dist/audio/AudioForDevelopment.js +0 -71
- package/dist/audio/AudioForRendering.d.ts +0 -6
- package/dist/audio/AudioForRendering.js +0 -75
- package/dist/audio/index.d.ts +0 -2
- package/dist/audio/props.d.ts +0 -10
- package/dist/config.d.ts +0 -218
- package/dist/config.js +0 -21
- package/dist/freeze.d.ts +0 -7
- package/dist/get-environment.d.ts +0 -2
- package/dist/get-preview-dom-element.d.ts +0 -1
- package/dist/get-preview-dom-element.js +0 -7
- package/dist/index.d.ts +0 -72
- package/dist/index.js +0 -58
- package/dist/internals.d.ts +0 -88
- package/dist/internals.js +0 -93
- package/dist/loop/index.d.ts +0 -9
- package/dist/loop/index.js +0 -28
- package/dist/prefetch-state.d.ts +0 -13
- package/dist/prefetch-state.js +0 -26
- package/dist/prefetch.d.ts +0 -7
- package/dist/random.d.ts +0 -6
- package/dist/series/flatten-children.d.ts +0 -2
- package/dist/series/index.d.ts +0 -13
- package/dist/setup-env-variables.d.ts +0 -2
- package/dist/spring/index.js +0 -51
- package/dist/spring/measure-spring.d.ts +0 -8
- package/dist/static-file.d.ts +0 -1
- package/dist/static-file.js +0 -29
- package/dist/truthy.d.ts +0 -3
- package/dist/use-current-frame.d.ts +0 -6
- package/dist/use-lazy-component.d.ts +0 -7
- package/dist/use-media-playback.js +0 -75
- package/dist/use-video-config.d.ts +0 -7
- package/dist/use-video-config.js +0 -26
- package/dist/use-video.d.ts +0 -13
- package/dist/use-video.js +0 -28
- package/dist/validate-media-props.d.ts +0 -4
- package/dist/validation/validate-duration-in-frames.d.ts +0 -1
- package/dist/validation/validate-offthreadvideo-image-format.d.ts +0 -1
- package/dist/validation/validate-offthreadvideo-image-format.js +0 -15
- package/dist/version.d.ts +0 -1
- package/dist/video/LoopedVideo.d.ts +0 -3
- package/dist/video/LoopedVideo.js +0 -16
- package/dist/video/OffthreadVideo.d.ts +0 -3
- package/dist/video/OffthreadVideo.js +0 -27
- package/dist/video/OffthreadVideoForRendering.js +0 -101
- package/dist/video/Video.d.ts +0 -6
- package/dist/video/Video.js +0 -29
- package/dist/video/VideoForDevelopment.js +0 -69
- package/dist/video/VideoForRendering.d.ts +0 -6
- package/dist/video/VideoForRendering.js +0 -168
- package/dist/video/duration-state.d.ts +0 -8
- package/dist/video/duration-state.js +0 -15
- package/dist/video/index.d.ts +0 -3
- package/dist/video/props.d.ts +0 -21
- package/dist/wrap-remotion-context.d.ts +0 -14
- package/dist/wrap-remotion-context.js +0 -65
- package/ensure-correct-version.js +0 -24
- package/tsconfig.json +0 -12
- package/version.d.ts +0 -1
|
@@ -1,101 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
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
|
-
volume?: import("../volume-prop").VolumeProp | undefined;
|
|
5
|
-
playbackRate?: number | undefined;
|
|
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
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Video = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_1 = require("react");
|
|
6
|
-
const get_environment_1 = require("../get-environment");
|
|
7
|
-
const Sequence_1 = require("../Sequence");
|
|
8
|
-
const validate_media_props_1 = require("../validate-media-props");
|
|
9
|
-
const validate_start_from_props_1 = require("../validate-start-from-props");
|
|
10
|
-
const VideoForDevelopment_1 = require("./VideoForDevelopment");
|
|
11
|
-
const VideoForRendering_1 = require("./VideoForRendering");
|
|
12
|
-
const VideoForwardingFunction = (props, ref) => {
|
|
13
|
-
const { startFrom, endAt, ...otherProps } = props;
|
|
14
|
-
if (typeof ref === 'string') {
|
|
15
|
-
throw new Error('string refs are not supported');
|
|
16
|
-
}
|
|
17
|
-
if (typeof startFrom !== 'undefined' || typeof endAt !== 'undefined') {
|
|
18
|
-
(0, validate_start_from_props_1.validateStartFromProps)(startFrom, endAt);
|
|
19
|
-
const startFromFrameNo = startFrom !== null && startFrom !== void 0 ? startFrom : 0;
|
|
20
|
-
const endAtFrameNo = endAt !== null && endAt !== void 0 ? endAt : Infinity;
|
|
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
|
-
}
|
|
23
|
-
(0, validate_media_props_1.validateMediaProps)(props, 'Video');
|
|
24
|
-
if ((0, get_environment_1.getRemotionEnvironment)() === 'rendering') {
|
|
25
|
-
return (0, jsx_runtime_1.jsx)(VideoForRendering_1.VideoForRendering, { ...otherProps, ref: ref });
|
|
26
|
-
}
|
|
27
|
-
return ((0, jsx_runtime_1.jsx)(VideoForDevelopment_1.VideoForDevelopment, { onlyWarnForMediaSeekingError: false, ...otherProps, ref: ref }));
|
|
28
|
-
};
|
|
29
|
-
exports.Video = (0, react_1.forwardRef)(VideoForwardingFunction);
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.VideoForDevelopment = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_1 = require("react");
|
|
6
|
-
const use_audio_frame_1 = require("../audio/use-audio-frame");
|
|
7
|
-
const prefetch_1 = require("../prefetch");
|
|
8
|
-
const use_media_in_timeline_1 = require("../use-media-in-timeline");
|
|
9
|
-
const use_media_playback_1 = require("../use-media-playback");
|
|
10
|
-
const use_media_tag_volume_1 = require("../use-media-tag-volume");
|
|
11
|
-
const use_sync_volume_with_media_tag_1 = require("../use-sync-volume-with-media-tag");
|
|
12
|
-
const volume_position_state_1 = require("../volume-position-state");
|
|
13
|
-
const VideoForDevelopmentRefForwardingFunction = (props, ref) => {
|
|
14
|
-
var _a;
|
|
15
|
-
const videoRef = (0, react_1.useRef)(null);
|
|
16
|
-
const volumePropFrame = (0, use_audio_frame_1.useFrameForVolumeProp)();
|
|
17
|
-
const { volume, muted, playbackRate, onlyWarnForMediaSeekingError, src, ...nativeProps } = props;
|
|
18
|
-
const actualVolume = (0, use_media_tag_volume_1.useMediaTagVolume)(videoRef);
|
|
19
|
-
const [mediaVolume] = (0, volume_position_state_1.useMediaVolumeState)();
|
|
20
|
-
const [mediaMuted] = (0, volume_position_state_1.useMediaMutedState)();
|
|
21
|
-
(0, use_media_in_timeline_1.useMediaInTimeline)({
|
|
22
|
-
mediaRef: videoRef,
|
|
23
|
-
volume,
|
|
24
|
-
mediaVolume,
|
|
25
|
-
mediaType: 'video',
|
|
26
|
-
src,
|
|
27
|
-
});
|
|
28
|
-
(0, use_sync_volume_with_media_tag_1.useSyncVolumeWithMediaTag)({
|
|
29
|
-
volumePropFrame,
|
|
30
|
-
actualVolume,
|
|
31
|
-
volume,
|
|
32
|
-
mediaVolume,
|
|
33
|
-
mediaRef: videoRef,
|
|
34
|
-
});
|
|
35
|
-
(0, use_media_playback_1.useMediaPlayback)({
|
|
36
|
-
mediaRef: videoRef,
|
|
37
|
-
src,
|
|
38
|
-
mediaType: 'video',
|
|
39
|
-
playbackRate: (_a = props.playbackRate) !== null && _a !== void 0 ? _a : 1,
|
|
40
|
-
onlyWarnForMediaSeekingError,
|
|
41
|
-
});
|
|
42
|
-
const actualSrc = (0, prefetch_1.usePreload)(src);
|
|
43
|
-
(0, react_1.useImperativeHandle)(ref, () => {
|
|
44
|
-
return videoRef.current;
|
|
45
|
-
}, []);
|
|
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 }));
|
|
67
|
-
};
|
|
68
|
-
// Copy types from forwardRef but not necessary to remove ref
|
|
69
|
-
exports.VideoForDevelopment = (0, react_1.forwardRef)(VideoForDevelopmentRefForwardingFunction);
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
2
|
-
import React from 'react';
|
|
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>>;
|
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.VideoForRendering = 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 delay_render_1 = require("../delay-render");
|
|
10
|
-
const is_approximately_the_same_1 = require("../is-approximately-the-same");
|
|
11
|
-
const random_1 = require("../random");
|
|
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");
|
|
15
|
-
const use_unsafe_video_config_1 = require("../use-unsafe-video-config");
|
|
16
|
-
const volume_prop_1 = require("../volume-prop");
|
|
17
|
-
const warn_about_non_seekable_media_1 = require("../warn-about-non-seekable-media");
|
|
18
|
-
const get_current_time_1 = require("./get-current-time");
|
|
19
|
-
const VideoForRenderingForwardFunction = ({ onError, volume: volumeProp, playbackRate, ...props }, ref) => {
|
|
20
|
-
const absoluteFrame = (0, timeline_position_state_1.useTimelinePosition)();
|
|
21
|
-
const frame = (0, use_current_frame_1.useCurrentFrame)();
|
|
22
|
-
const volumePropsFrame = (0, use_audio_frame_1.useFrameForVolumeProp)();
|
|
23
|
-
const videoConfig = (0, use_unsafe_video_config_1.useUnsafeVideoConfig)();
|
|
24
|
-
const videoRef = (0, react_1.useRef)(null);
|
|
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
|
-
// Generate a string that's as unique as possible for this asset
|
|
29
|
-
// but at the same time the same on all threads
|
|
30
|
-
const id = (0, react_1.useMemo)(() => {
|
|
31
|
-
var _a;
|
|
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}`;
|
|
33
|
-
}, [
|
|
34
|
-
props.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 (!props.src) {
|
|
49
|
-
throw new Error('No src passed');
|
|
50
|
-
}
|
|
51
|
-
if (props.muted) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
if (volume <= 0) {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
if (!window.remotion_audioEnabled) {
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
registerAsset({
|
|
61
|
-
type: 'video',
|
|
62
|
-
src: (0, absolute_src_1.getAbsoluteSrc)(props.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
|
-
props.muted,
|
|
72
|
-
props.src,
|
|
73
|
-
registerAsset,
|
|
74
|
-
id,
|
|
75
|
-
unregisterAsset,
|
|
76
|
-
volume,
|
|
77
|
-
frame,
|
|
78
|
-
absoluteFrame,
|
|
79
|
-
playbackRate,
|
|
80
|
-
]);
|
|
81
|
-
(0, react_1.useImperativeHandle)(ref, () => {
|
|
82
|
-
return videoRef.current;
|
|
83
|
-
}, []);
|
|
84
|
-
(0, react_1.useEffect)(() => {
|
|
85
|
-
if (!window.remotion_videoEnabled) {
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
const { current } = videoRef;
|
|
89
|
-
if (!current) {
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
const currentTime = (() => {
|
|
93
|
-
return (0, get_current_time_1.getMediaTime)({
|
|
94
|
-
fps: videoConfig.fps,
|
|
95
|
-
frame,
|
|
96
|
-
src: props.src,
|
|
97
|
-
playbackRate: playbackRate || 1,
|
|
98
|
-
startFrom: -mediaStartsAt,
|
|
99
|
-
mediaType: 'video',
|
|
100
|
-
});
|
|
101
|
-
})();
|
|
102
|
-
const handle = (0, delay_render_1.delayRender)(`Rendering <Video /> with src="${props.src}"`);
|
|
103
|
-
if (process.env.NODE_ENV === 'test') {
|
|
104
|
-
(0, delay_render_1.continueRender)(handle);
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
if ((0, is_approximately_the_same_1.isApproximatelyTheSame)(current.currentTime, currentTime)) {
|
|
108
|
-
if (current.readyState >= 2) {
|
|
109
|
-
(0, delay_render_1.continueRender)(handle);
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
const loadedDataHandler = () => {
|
|
113
|
-
(0, delay_render_1.continueRender)(handle);
|
|
114
|
-
};
|
|
115
|
-
current.addEventListener('loadeddata', loadedDataHandler, { once: true });
|
|
116
|
-
return () => {
|
|
117
|
-
current.removeEventListener('loadeddata', loadedDataHandler);
|
|
118
|
-
};
|
|
119
|
-
}
|
|
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(() => {
|
|
128
|
-
(0, delay_render_1.continueRender)(handle);
|
|
129
|
-
}, 100);
|
|
130
|
-
}
|
|
131
|
-
else {
|
|
132
|
-
(0, delay_render_1.continueRender)(handle);
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
current.addEventListener('seeked', seekedHandler, { once: true });
|
|
136
|
-
const endedHandler = () => {
|
|
137
|
-
(0, delay_render_1.continueRender)(handle);
|
|
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`);
|
|
145
|
-
}
|
|
146
|
-
else {
|
|
147
|
-
throw new Error('The browser threw an error');
|
|
148
|
-
}
|
|
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
|
-
};
|
|
158
|
-
}, [
|
|
159
|
-
volumePropsFrame,
|
|
160
|
-
props.src,
|
|
161
|
-
playbackRate,
|
|
162
|
-
videoConfig.fps,
|
|
163
|
-
frame,
|
|
164
|
-
mediaStartsAt,
|
|
165
|
-
]);
|
|
166
|
-
return (0, jsx_runtime_1.jsx)("video", { ref: videoRef, ...props, onError: onError });
|
|
167
|
-
};
|
|
168
|
-
exports.VideoForRendering = (0, react_1.forwardRef)(VideoForRenderingForwardFunction);
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
declare type DurationState = Record<string, number>;
|
|
2
|
-
declare type DurationAction = {
|
|
3
|
-
type: 'got-duration';
|
|
4
|
-
src: string;
|
|
5
|
-
durationInSeconds: number;
|
|
6
|
-
};
|
|
7
|
-
export declare const durationReducer: (state: DurationState, action: DurationAction) => DurationState;
|
|
8
|
-
export {};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.durationReducer = void 0;
|
|
4
|
-
const durationReducer = (state, action) => {
|
|
5
|
-
switch (action.type) {
|
|
6
|
-
case 'got-duration':
|
|
7
|
-
return {
|
|
8
|
-
...state,
|
|
9
|
-
[action.src]: action.durationInSeconds,
|
|
10
|
-
};
|
|
11
|
-
default:
|
|
12
|
-
return state;
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
exports.durationReducer = durationReducer;
|
package/dist/video/index.d.ts
DELETED
package/dist/video/props.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type React from 'react';
|
|
2
|
-
import type { VolumeProp } from '../volume-prop';
|
|
3
|
-
export declare type RemotionMainVideoProps = {
|
|
4
|
-
startFrom?: number;
|
|
5
|
-
endAt?: number;
|
|
6
|
-
};
|
|
7
|
-
export declare type RemotionVideoProps = Omit<React.DetailedHTMLProps<React.VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>, 'autoPlay' | 'controls' | 'loop' | 'onEnded'> & {
|
|
8
|
-
volume?: VolumeProp;
|
|
9
|
-
playbackRate?: number;
|
|
10
|
-
};
|
|
11
|
-
export declare type OffthreadVideoImageFormat = 'png' | 'jpeg';
|
|
12
|
-
export declare type OffthreadVideoProps = {
|
|
13
|
-
src: string;
|
|
14
|
-
className?: string;
|
|
15
|
-
style?: React.CSSProperties;
|
|
16
|
-
volume?: VolumeProp;
|
|
17
|
-
playbackRate?: number;
|
|
18
|
-
muted?: boolean;
|
|
19
|
-
onError?: React.ReactEventHandler<HTMLVideoElement | HTMLImageElement>;
|
|
20
|
-
imageFormat?: OffthreadVideoImageFormat;
|
|
21
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export declare function useRemotionContexts(): {
|
|
3
|
-
compositionManagerCtx: import("./CompositionManager").CompositionManagerContext;
|
|
4
|
-
timelineContext: import("./timeline-position-state").TimelineContextValue;
|
|
5
|
-
setTimelineContext: import("./timeline-position-state").SetTimelineContextValue;
|
|
6
|
-
sequenceContext: import("./Sequence").SequenceContextType | null;
|
|
7
|
-
nonceContext: import("./nonce").TNonceContext;
|
|
8
|
-
canUseRemotionHooksContext: boolean;
|
|
9
|
-
};
|
|
10
|
-
export interface RemotionContextProviderProps {
|
|
11
|
-
contexts: ReturnType<typeof useRemotionContexts>;
|
|
12
|
-
children: React.ReactNode;
|
|
13
|
-
}
|
|
14
|
-
export declare const RemotionContextProvider: (props: RemotionContextProviderProps) => JSX.Element;
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.RemotionContextProvider = exports.useRemotionContexts = void 0;
|
|
27
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
28
|
-
// This is used for when other reconcilers are being used
|
|
29
|
-
// such as in React Three Fiber. All the contexts need to be passed again
|
|
30
|
-
// for them to be useable
|
|
31
|
-
const react_1 = __importStar(require("react"));
|
|
32
|
-
const CanUseRemotionHooks_1 = require("./CanUseRemotionHooks");
|
|
33
|
-
const CompositionManager_1 = require("./CompositionManager");
|
|
34
|
-
const nonce_1 = require("./nonce");
|
|
35
|
-
const Sequence_1 = require("./Sequence");
|
|
36
|
-
const timeline_position_state_1 = require("./timeline-position-state");
|
|
37
|
-
function useRemotionContexts() {
|
|
38
|
-
const compositionManagerCtx = react_1.default.useContext(CompositionManager_1.CompositionManager);
|
|
39
|
-
const timelineContext = react_1.default.useContext(timeline_position_state_1.TimelineContext);
|
|
40
|
-
const setTimelineContext = react_1.default.useContext(timeline_position_state_1.SetTimelineContext);
|
|
41
|
-
const sequenceContext = react_1.default.useContext(Sequence_1.SequenceContext);
|
|
42
|
-
const nonceContext = react_1.default.useContext(nonce_1.NonceContext);
|
|
43
|
-
const canUseRemotionHooksContext = react_1.default.useContext(CanUseRemotionHooks_1.CanUseRemotionHooks);
|
|
44
|
-
return (0, react_1.useMemo)(() => ({
|
|
45
|
-
compositionManagerCtx,
|
|
46
|
-
timelineContext,
|
|
47
|
-
setTimelineContext,
|
|
48
|
-
sequenceContext,
|
|
49
|
-
nonceContext,
|
|
50
|
-
canUseRemotionHooksContext,
|
|
51
|
-
}), [
|
|
52
|
-
compositionManagerCtx,
|
|
53
|
-
nonceContext,
|
|
54
|
-
sequenceContext,
|
|
55
|
-
setTimelineContext,
|
|
56
|
-
timelineContext,
|
|
57
|
-
canUseRemotionHooksContext,
|
|
58
|
-
]);
|
|
59
|
-
}
|
|
60
|
-
exports.useRemotionContexts = useRemotionContexts;
|
|
61
|
-
const RemotionContextProvider = (props) => {
|
|
62
|
-
const { children, contexts } = props;
|
|
63
|
-
return ((0, jsx_runtime_1.jsx)(CanUseRemotionHooks_1.CanUseRemotionHooks.Provider, { value: contexts.canUseRemotionHooksContext, children: (0, jsx_runtime_1.jsx)(nonce_1.NonceContext.Provider, { value: contexts.nonceContext, children: (0, jsx_runtime_1.jsx)(CompositionManager_1.CompositionManager.Provider, { value: contexts.compositionManagerCtx, children: (0, jsx_runtime_1.jsx)(timeline_position_state_1.TimelineContext.Provider, { value: contexts.timelineContext, children: (0, jsx_runtime_1.jsx)(timeline_position_state_1.SetTimelineContext.Provider, { value: contexts.setTimelineContext, children: (0, jsx_runtime_1.jsx)(Sequence_1.SequenceContext.Provider, { value: contexts.sequenceContext, children: children }) }) }) }) }) }));
|
|
64
|
-
};
|
|
65
|
-
exports.RemotionContextProvider = RemotionContextProvider;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
const path = require('node:path');
|
|
2
|
-
const fs = require('node:fs');
|
|
3
|
-
const cp = require('node:child_process');
|
|
4
|
-
|
|
5
|
-
const packageJson = JSON.parse(fs.readFileSync('package.json'));
|
|
6
|
-
const {version} = packageJson;
|
|
7
|
-
const src =
|
|
8
|
-
`
|
|
9
|
-
// Automatically generated on publish
|
|
10
|
-
export const VERSION = '${version}';
|
|
11
|
-
`.trim() + '\n';
|
|
12
|
-
|
|
13
|
-
fs.writeFileSync(path.resolve(process.cwd(), 'src/version.ts'), src);
|
|
14
|
-
|
|
15
|
-
cp.execSync('pnpm exec tsc');
|
|
16
|
-
|
|
17
|
-
const distFile = fs.readFileSync('dist/version.js', 'utf-8');
|
|
18
|
-
|
|
19
|
-
if (!distFile.includes(version)) {
|
|
20
|
-
console.log('In dist file, did not include version');
|
|
21
|
-
process.exit(1);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
console.log('Updated version to v' + version);
|
package/tsconfig.json
DELETED
package/version.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './dist/version';
|