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
|
@@ -0,0 +1,208 @@
|
|
|
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_js_1 = require("../absolute-src.js");
|
|
7
|
+
const AssetManager_js_1 = require("../AssetManager.js");
|
|
8
|
+
const use_audio_frame_js_1 = require("../audio/use-audio-frame.js");
|
|
9
|
+
const delay_render_js_1 = require("../delay-render.js");
|
|
10
|
+
const get_environment_js_1 = require("../get-environment.js");
|
|
11
|
+
const is_approximately_the_same_js_1 = require("../is-approximately-the-same.js");
|
|
12
|
+
const random_js_1 = require("../random.js");
|
|
13
|
+
const SequenceContext_js_1 = require("../SequenceContext.js");
|
|
14
|
+
const timeline_position_state_js_1 = require("../timeline-position-state.js");
|
|
15
|
+
const use_current_frame_js_1 = require("../use-current-frame.js");
|
|
16
|
+
const use_unsafe_video_config_js_1 = require("../use-unsafe-video-config.js");
|
|
17
|
+
const volume_prop_js_1 = require("../volume-prop.js");
|
|
18
|
+
const warn_about_non_seekable_media_js_1 = require("../warn-about-non-seekable-media.js");
|
|
19
|
+
const get_current_time_js_1 = require("./get-current-time.js");
|
|
20
|
+
const VideoForRenderingForwardFunction = ({ onError, volume: volumeProp, allowAmplificationDuringRender, playbackRate, onDuration, ...props }, ref) => {
|
|
21
|
+
const absoluteFrame = (0, timeline_position_state_js_1.useTimelinePosition)();
|
|
22
|
+
const frame = (0, use_current_frame_js_1.useCurrentFrame)();
|
|
23
|
+
const volumePropsFrame = (0, use_audio_frame_js_1.useFrameForVolumeProp)();
|
|
24
|
+
const videoConfig = (0, use_unsafe_video_config_js_1.useUnsafeVideoConfig)();
|
|
25
|
+
const videoRef = (0, react_1.useRef)(null);
|
|
26
|
+
const sequenceContext = (0, react_1.useContext)(SequenceContext_js_1.SequenceContext);
|
|
27
|
+
const mediaStartsAt = (0, use_audio_frame_js_1.useMediaStartsAt)();
|
|
28
|
+
const environment = (0, get_environment_js_1.useRemotionEnvironment)();
|
|
29
|
+
const { registerAsset, unregisterAsset } = (0, react_1.useContext)(AssetManager_js_1.AssetManager);
|
|
30
|
+
// Generate a string that's as unique as possible for this asset
|
|
31
|
+
// but at the same time the same on all threads
|
|
32
|
+
const id = (0, react_1.useMemo)(() => {
|
|
33
|
+
var _a;
|
|
34
|
+
return `video-${(0, random_js_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}`;
|
|
35
|
+
}, [
|
|
36
|
+
props.src,
|
|
37
|
+
sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.cumulatedFrom,
|
|
38
|
+
sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.relativeFrom,
|
|
39
|
+
sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.durationInFrames,
|
|
40
|
+
]);
|
|
41
|
+
if (!videoConfig) {
|
|
42
|
+
throw new Error('No video config found');
|
|
43
|
+
}
|
|
44
|
+
const volume = (0, volume_prop_js_1.evaluateVolume)({
|
|
45
|
+
volume: volumeProp,
|
|
46
|
+
frame: volumePropsFrame,
|
|
47
|
+
mediaVolume: 1,
|
|
48
|
+
allowAmplificationDuringRender: allowAmplificationDuringRender !== null && allowAmplificationDuringRender !== void 0 ? allowAmplificationDuringRender : false,
|
|
49
|
+
});
|
|
50
|
+
(0, react_1.useEffect)(() => {
|
|
51
|
+
if (!props.src) {
|
|
52
|
+
throw new Error('No src passed');
|
|
53
|
+
}
|
|
54
|
+
if (props.muted) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (volume <= 0) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if (!window.remotion_audioEnabled) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
registerAsset({
|
|
64
|
+
type: 'video',
|
|
65
|
+
src: (0, absolute_src_js_1.getAbsoluteSrc)(props.src),
|
|
66
|
+
id,
|
|
67
|
+
frame: absoluteFrame,
|
|
68
|
+
volume,
|
|
69
|
+
mediaFrame: frame,
|
|
70
|
+
playbackRate: playbackRate !== null && playbackRate !== void 0 ? playbackRate : 1,
|
|
71
|
+
allowAmplificationDuringRender: allowAmplificationDuringRender !== null && allowAmplificationDuringRender !== void 0 ? allowAmplificationDuringRender : false,
|
|
72
|
+
});
|
|
73
|
+
return () => unregisterAsset(id);
|
|
74
|
+
}, [
|
|
75
|
+
props.muted,
|
|
76
|
+
props.src,
|
|
77
|
+
registerAsset,
|
|
78
|
+
id,
|
|
79
|
+
unregisterAsset,
|
|
80
|
+
volume,
|
|
81
|
+
frame,
|
|
82
|
+
absoluteFrame,
|
|
83
|
+
playbackRate,
|
|
84
|
+
allowAmplificationDuringRender,
|
|
85
|
+
]);
|
|
86
|
+
(0, react_1.useImperativeHandle)(ref, () => {
|
|
87
|
+
return videoRef.current;
|
|
88
|
+
}, []);
|
|
89
|
+
(0, react_1.useEffect)(() => {
|
|
90
|
+
if (!window.remotion_videoEnabled) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const { current } = videoRef;
|
|
94
|
+
if (!current) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
const currentTime = (() => {
|
|
98
|
+
return (0, get_current_time_js_1.getMediaTime)({
|
|
99
|
+
fps: videoConfig.fps,
|
|
100
|
+
frame,
|
|
101
|
+
src: props.src,
|
|
102
|
+
playbackRate: playbackRate || 1,
|
|
103
|
+
startFrom: -mediaStartsAt,
|
|
104
|
+
mediaType: 'video',
|
|
105
|
+
});
|
|
106
|
+
})();
|
|
107
|
+
const handle = (0, delay_render_js_1.delayRender)(`Rendering <Video /> with src="${props.src}"`);
|
|
108
|
+
if (process.env.NODE_ENV === 'test') {
|
|
109
|
+
(0, delay_render_js_1.continueRender)(handle);
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
if ((0, is_approximately_the_same_js_1.isApproximatelyTheSame)(current.currentTime, currentTime)) {
|
|
113
|
+
if (current.readyState >= 2) {
|
|
114
|
+
(0, delay_render_js_1.continueRender)(handle);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
const loadedDataHandler = () => {
|
|
118
|
+
(0, delay_render_js_1.continueRender)(handle);
|
|
119
|
+
};
|
|
120
|
+
current.addEventListener('loadeddata', loadedDataHandler, { once: true });
|
|
121
|
+
return () => {
|
|
122
|
+
current.removeEventListener('loadeddata', loadedDataHandler);
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
current.currentTime = currentTime;
|
|
126
|
+
const seekedHandler = () => {
|
|
127
|
+
(0, warn_about_non_seekable_media_js_1.warnAboutNonSeekableMedia)(current, 'exception');
|
|
128
|
+
if (window.navigator.platform.startsWith('Mac')) {
|
|
129
|
+
// Improve me: This is ensures frame perfectness but slows down render.
|
|
130
|
+
// Please see this issue for context: https://github.com/remotion-dev/remotion/issues/200
|
|
131
|
+
// Only affects macOS since it uses VideoToolbox decoding.
|
|
132
|
+
setTimeout(() => {
|
|
133
|
+
(0, delay_render_js_1.continueRender)(handle);
|
|
134
|
+
}, 100);
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
(0, delay_render_js_1.continueRender)(handle);
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
current.addEventListener('seeked', seekedHandler, { once: true });
|
|
141
|
+
const endedHandler = () => {
|
|
142
|
+
(0, delay_render_js_1.continueRender)(handle);
|
|
143
|
+
};
|
|
144
|
+
current.addEventListener('ended', endedHandler, { once: true });
|
|
145
|
+
const errorHandler = () => {
|
|
146
|
+
var _a;
|
|
147
|
+
if (current === null || current === void 0 ? void 0 : current.error) {
|
|
148
|
+
console.error('Error occurred in video', current === null || current === void 0 ? void 0 : current.error);
|
|
149
|
+
// If user is handling the error, we don't cause an unhandled exception
|
|
150
|
+
if (onError) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
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. Pass an onError() prop to handle the error.`);
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
throw new Error('The browser threw an error');
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
current.addEventListener('error', errorHandler, { once: true });
|
|
160
|
+
// If video skips to another frame or unmounts, we clear the created handle
|
|
161
|
+
return () => {
|
|
162
|
+
current.removeEventListener('ended', endedHandler);
|
|
163
|
+
current.removeEventListener('error', errorHandler);
|
|
164
|
+
current.removeEventListener('seeked', seekedHandler);
|
|
165
|
+
(0, delay_render_js_1.continueRender)(handle);
|
|
166
|
+
};
|
|
167
|
+
}, [
|
|
168
|
+
volumePropsFrame,
|
|
169
|
+
props.src,
|
|
170
|
+
playbackRate,
|
|
171
|
+
videoConfig.fps,
|
|
172
|
+
frame,
|
|
173
|
+
mediaStartsAt,
|
|
174
|
+
onError,
|
|
175
|
+
]);
|
|
176
|
+
const { src } = props;
|
|
177
|
+
// If video source switches, make new handle
|
|
178
|
+
if (environment === 'rendering') {
|
|
179
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
180
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
181
|
+
if (process.env.NODE_ENV === 'test') {
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
const newHandle = (0, delay_render_js_1.delayRender)('Loading <Video> duration with src=' + src);
|
|
185
|
+
const { current } = videoRef;
|
|
186
|
+
const didLoad = () => {
|
|
187
|
+
if (current === null || current === void 0 ? void 0 : current.duration) {
|
|
188
|
+
onDuration(src, current.duration);
|
|
189
|
+
}
|
|
190
|
+
(0, delay_render_js_1.continueRender)(newHandle);
|
|
191
|
+
};
|
|
192
|
+
if (current === null || current === void 0 ? void 0 : current.duration) {
|
|
193
|
+
onDuration(src, current.duration);
|
|
194
|
+
(0, delay_render_js_1.continueRender)(newHandle);
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
current === null || current === void 0 ? void 0 : current.addEventListener('loadedmetadata', didLoad, { once: true });
|
|
198
|
+
}
|
|
199
|
+
// If tag gets unmounted, clear pending handles because video metadata is not going to load
|
|
200
|
+
return () => {
|
|
201
|
+
current === null || current === void 0 ? void 0 : current.removeEventListener('loadedmetadata', didLoad);
|
|
202
|
+
(0, delay_render_js_1.continueRender)(newHandle);
|
|
203
|
+
};
|
|
204
|
+
}, [src, onDuration]);
|
|
205
|
+
}
|
|
206
|
+
return (0, jsx_runtime_1.jsx)("video", { ref: videoRef, ...props, onError: onError });
|
|
207
|
+
};
|
|
208
|
+
exports.VideoForRendering = (0, react_1.forwardRef)(VideoForRenderingForwardFunction);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type DurationState = Record<string, number>;
|
|
3
|
+
type DurationAction = {
|
|
4
|
+
type: 'got-duration';
|
|
5
|
+
src: string;
|
|
6
|
+
durationInSeconds: number;
|
|
7
|
+
};
|
|
8
|
+
export declare const durationReducer: (state: DurationState, action: DurationAction) => DurationState;
|
|
9
|
+
type TDurationsContext = {
|
|
10
|
+
durations: DurationState;
|
|
11
|
+
setDurations: React.Dispatch<DurationAction>;
|
|
12
|
+
};
|
|
13
|
+
export declare const DurationsContext: React.Context<TDurationsContext>;
|
|
14
|
+
export declare const DurationsContextProvider: React.FC<{
|
|
15
|
+
children: React.ReactNode;
|
|
16
|
+
}>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DurationsContextProvider = exports.DurationsContext = exports.durationReducer = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const absolute_src_js_1 = require("../absolute-src.js");
|
|
7
|
+
const durationReducer = (state, action) => {
|
|
8
|
+
switch (action.type) {
|
|
9
|
+
case 'got-duration':
|
|
10
|
+
return {
|
|
11
|
+
...state,
|
|
12
|
+
[(0, absolute_src_js_1.getAbsoluteSrc)(action.src)]: action.durationInSeconds,
|
|
13
|
+
};
|
|
14
|
+
default:
|
|
15
|
+
return state;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
exports.durationReducer = durationReducer;
|
|
19
|
+
exports.DurationsContext = (0, react_1.createContext)({
|
|
20
|
+
durations: {},
|
|
21
|
+
setDurations: () => {
|
|
22
|
+
throw new Error('context missing');
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
const DurationsContextProvider = ({ children }) => {
|
|
26
|
+
const [durations, setDurations] = (0, react_1.useReducer)(exports.durationReducer, {});
|
|
27
|
+
const value = (0, react_1.useMemo)(() => {
|
|
28
|
+
return {
|
|
29
|
+
durations,
|
|
30
|
+
setDurations,
|
|
31
|
+
};
|
|
32
|
+
}, [durations]);
|
|
33
|
+
return ((0, jsx_runtime_1.jsx)(exports.DurationsContext.Provider, { value: value, children: children }));
|
|
34
|
+
};
|
|
35
|
+
exports.DurationsContextProvider = DurationsContextProvider;
|
|
File without changes
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
// Calculate the `.currentTime` of a video or audio element
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.getMediaTime = exports.getExpectedMediaFrameUncorrected = void 0;
|
|
5
|
-
const
|
|
5
|
+
const interpolate_js_1 = require("../interpolate.js");
|
|
6
6
|
const getExpectedMediaFrameUncorrected = ({ frame, playbackRate, startFrom, }) => {
|
|
7
|
-
return (0,
|
|
7
|
+
return (0, interpolate_js_1.interpolate)(frame, [-1, startFrom, startFrom + 1], [-1, startFrom, startFrom + playbackRate]);
|
|
8
8
|
};
|
|
9
9
|
exports.getExpectedMediaFrameUncorrected = getExpectedMediaFrameUncorrected;
|
|
10
10
|
const getMediaTime = ({ fps, frame, src, playbackRate, startFrom, mediaType, }) => {
|
|
@@ -13,19 +13,20 @@ const getMediaTime = ({ fps, frame, src, playbackRate, startFrom, mediaType, })
|
|
|
13
13
|
playbackRate,
|
|
14
14
|
startFrom,
|
|
15
15
|
});
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
if (mediaType === 'video') {
|
|
16
|
+
const isChrome = typeof window !== 'undefined' &&
|
|
17
|
+
window.navigator.userAgent.match(/Chrome\/([0-9]+)/);
|
|
18
|
+
if (isChrome &&
|
|
19
|
+
Number(isChrome[1]) < 112 &&
|
|
20
|
+
mediaType === 'video' &&
|
|
21
|
+
src.endsWith('.mp4')) {
|
|
23
22
|
// In Chrome, for MP4s, if 30fps, the first frame is still displayed at 0.033333
|
|
24
23
|
// even though after that it increases by 0.033333333 each.
|
|
25
24
|
// So frame = 0 in Remotion is like frame = 1 for the browser
|
|
26
25
|
return (expectedFrame + 1) / fps;
|
|
27
26
|
}
|
|
28
|
-
// For
|
|
29
|
-
|
|
27
|
+
// For WebM videos, we need to add a little bit of shift to get the right frame.
|
|
28
|
+
const msPerFrame = 1000 / fps;
|
|
29
|
+
const msShift = msPerFrame / 2;
|
|
30
|
+
return (expectedFrame * msPerFrame + msShift) / 1000;
|
|
30
31
|
};
|
|
31
32
|
exports.getMediaTime = getMediaTime;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Video = exports.OffthreadVideo = void 0;
|
|
4
|
-
var
|
|
5
|
-
Object.defineProperty(exports, "OffthreadVideo", { enumerable: true, get: function () { return
|
|
6
|
-
var
|
|
7
|
-
Object.defineProperty(exports, "Video", { enumerable: true, get: function () { return
|
|
4
|
+
var OffthreadVideo_js_1 = require("./OffthreadVideo.js");
|
|
5
|
+
Object.defineProperty(exports, "OffthreadVideo", { enumerable: true, get: function () { return OffthreadVideo_js_1.OffthreadVideo; } });
|
|
6
|
+
var Video_js_1 = require("./Video.js");
|
|
7
|
+
Object.defineProperty(exports, "Video", { enumerable: true, get: function () { return Video_js_1.Video; } });
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { VolumeProp } from '../volume-prop.js';
|
|
3
|
+
export type RemotionMainVideoProps = {
|
|
4
|
+
startFrom?: number;
|
|
5
|
+
endAt?: number;
|
|
6
|
+
};
|
|
7
|
+
export type RemotionVideoProps = Omit<React.DetailedHTMLProps<React.VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>, 'autoPlay' | 'controls' | 'onEnded' | 'nonce'> & {
|
|
8
|
+
volume?: VolumeProp;
|
|
9
|
+
playbackRate?: number;
|
|
10
|
+
acceptableTimeShiftInSeconds?: number;
|
|
11
|
+
allowAmplificationDuringRender?: boolean;
|
|
12
|
+
};
|
|
13
|
+
type DeprecatedOffthreadVideoProps = {
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated Use the `transparent` prop instead
|
|
16
|
+
*/
|
|
17
|
+
imageFormat?: never;
|
|
18
|
+
};
|
|
19
|
+
export type OffthreadVideoProps = {
|
|
20
|
+
src: string;
|
|
21
|
+
className?: string;
|
|
22
|
+
id?: string;
|
|
23
|
+
style?: React.CSSProperties;
|
|
24
|
+
volume?: VolumeProp;
|
|
25
|
+
playbackRate?: number;
|
|
26
|
+
muted?: boolean;
|
|
27
|
+
onError?: React.ReactEventHandler<HTMLVideoElement | HTMLImageElement>;
|
|
28
|
+
acceptableTimeShiftInSeconds?: number;
|
|
29
|
+
allowAmplificationDuringRender?: boolean;
|
|
30
|
+
transparent?: boolean;
|
|
31
|
+
} & DeprecatedOffthreadVideoProps;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const useAppendVideoFragment: ({ actualSrc: initialActualSrc, actualFrom: initialActualFrom, duration: initialDuration, fps, }: {
|
|
2
|
+
actualSrc: string;
|
|
3
|
+
actualFrom: number;
|
|
4
|
+
duration: number;
|
|
5
|
+
fps: number;
|
|
6
|
+
}) => string;
|
|
7
|
+
export declare const appendVideoFragment: ({ actualSrc, actualFrom, duration, fps, }: {
|
|
8
|
+
actualSrc: string;
|
|
9
|
+
actualFrom: number;
|
|
10
|
+
duration: number;
|
|
11
|
+
fps: number;
|
|
12
|
+
}) => string;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.appendVideoFragment = exports.useAppendVideoFragment = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const toSeconds = (time, fps) => {
|
|
6
|
+
return Math.round((time / fps) * 100) / 100;
|
|
7
|
+
};
|
|
8
|
+
const isSubsetOfDuration = (prevStartFrom, newStartFrom, prevDuration, newDuration) => {
|
|
9
|
+
return (prevStartFrom <= newStartFrom &&
|
|
10
|
+
prevStartFrom + prevDuration >= newStartFrom + newDuration);
|
|
11
|
+
};
|
|
12
|
+
const useAppendVideoFragment = ({ actualSrc: initialActualSrc, actualFrom: initialActualFrom, duration: initialDuration, fps, }) => {
|
|
13
|
+
const actualFromRef = (0, react_1.useRef)(initialActualFrom);
|
|
14
|
+
const actualDuration = (0, react_1.useRef)(initialDuration);
|
|
15
|
+
const actualSrc = (0, react_1.useRef)(initialActualSrc);
|
|
16
|
+
if (!isSubsetOfDuration || initialActualSrc !== actualSrc.current) {
|
|
17
|
+
actualFromRef.current = initialActualFrom;
|
|
18
|
+
actualDuration.current = initialDuration;
|
|
19
|
+
actualSrc.current = initialActualSrc;
|
|
20
|
+
}
|
|
21
|
+
const appended = (0, exports.appendVideoFragment)({
|
|
22
|
+
actualSrc: actualSrc.current,
|
|
23
|
+
actualFrom: actualFromRef.current,
|
|
24
|
+
duration: actualDuration.current,
|
|
25
|
+
fps,
|
|
26
|
+
});
|
|
27
|
+
return appended;
|
|
28
|
+
};
|
|
29
|
+
exports.useAppendVideoFragment = useAppendVideoFragment;
|
|
30
|
+
// https://github.com/remotion-dev/remotion/issues/1655
|
|
31
|
+
const isIOSSafariCase = (actualSrc) => {
|
|
32
|
+
return typeof window === 'undefined'
|
|
33
|
+
? false
|
|
34
|
+
: /iP(ad|od|hone)/i.test(window.navigator.userAgent) &&
|
|
35
|
+
Boolean(navigator.userAgent.match(/Version\/[\d.]+.*Safari/)) &&
|
|
36
|
+
actualSrc.startsWith('blob:');
|
|
37
|
+
};
|
|
38
|
+
const appendVideoFragment = ({ actualSrc, actualFrom, duration, fps, }) => {
|
|
39
|
+
var _a;
|
|
40
|
+
if (isIOSSafariCase(actualSrc)) {
|
|
41
|
+
return actualSrc;
|
|
42
|
+
}
|
|
43
|
+
if (actualSrc.startsWith('data:')) {
|
|
44
|
+
return actualSrc;
|
|
45
|
+
}
|
|
46
|
+
const existingHash = Boolean(new URL(actualSrc, (_a = (typeof window === 'undefined' ? null : window.location.href)) !== null && _a !== void 0 ? _a : 'http://localhost:3000').hash);
|
|
47
|
+
if (existingHash) {
|
|
48
|
+
return actualSrc;
|
|
49
|
+
}
|
|
50
|
+
if (!Number.isFinite(actualFrom)) {
|
|
51
|
+
return actualSrc;
|
|
52
|
+
}
|
|
53
|
+
actualSrc += `#t=${toSeconds(-actualFrom, fps)}`;
|
|
54
|
+
if (!Number.isFinite(duration)) {
|
|
55
|
+
return actualSrc;
|
|
56
|
+
}
|
|
57
|
+
actualSrc += `,${toSeconds(duration, fps)}`;
|
|
58
|
+
return actualSrc;
|
|
59
|
+
};
|
|
60
|
+
exports.appendVideoFragment = appendVideoFragment;
|
|
File without changes
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export
|
|
2
|
+
export type MediaVolumeContextValue = {
|
|
3
3
|
mediaMuted: boolean;
|
|
4
4
|
mediaVolume: number;
|
|
5
5
|
};
|
|
6
|
-
export
|
|
6
|
+
export type SetMediaVolumeContextValue = {
|
|
7
7
|
setMediaMuted: (u: React.SetStateAction<boolean>) => void;
|
|
8
8
|
setMediaVolume: (u: number) => void;
|
|
9
9
|
};
|
|
10
10
|
export declare const MediaVolumeContext: import("react").Context<MediaVolumeContextValue>;
|
|
11
11
|
export declare const SetMediaVolumeContext: import("react").Context<SetMediaVolumeContextValue>;
|
|
12
|
-
|
|
12
|
+
type MediaVolumeReturnType = readonly [number, (u: number) => void];
|
|
13
13
|
export declare const useMediaVolumeState: () => MediaVolumeReturnType;
|
|
14
|
-
|
|
14
|
+
type MediaMutedReturnType = readonly [
|
|
15
15
|
boolean,
|
|
16
16
|
(u: React.SetStateAction<boolean>) => void
|
|
17
17
|
];
|
|
File without changes
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export
|
|
2
|
-
export declare const evaluateVolume: ({ frame, volume, mediaVolume, }: {
|
|
1
|
+
export type VolumeProp = number | ((frame: number) => number);
|
|
2
|
+
export declare const evaluateVolume: ({ frame, volume, mediaVolume, allowAmplificationDuringRender, }: {
|
|
3
3
|
frame: number;
|
|
4
4
|
volume: VolumeProp | undefined;
|
|
5
5
|
mediaVolume: number;
|
|
6
|
+
allowAmplificationDuringRender: boolean;
|
|
6
7
|
}) => number;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.evaluateVolume = void 0;
|
|
4
|
-
const evaluateVolume = ({ frame, volume, mediaVolume = 1, }) => {
|
|
4
|
+
const evaluateVolume = ({ frame, volume, mediaVolume = 1, allowAmplificationDuringRender, }) => {
|
|
5
|
+
const maxVolume = allowAmplificationDuringRender ? Infinity : 1;
|
|
5
6
|
if (typeof volume === 'number') {
|
|
6
|
-
return Math.min(
|
|
7
|
+
return Math.min(maxVolume, volume * mediaVolume);
|
|
7
8
|
}
|
|
8
9
|
if (typeof volume === 'undefined') {
|
|
9
10
|
return Number(mediaVolume);
|
|
@@ -18,6 +19,6 @@ const evaluateVolume = ({ frame, volume, mediaVolume = 1, }) => {
|
|
|
18
19
|
if (!Number.isFinite(evaluated)) {
|
|
19
20
|
throw new TypeError(`You passed in a function to the volume prop but it returned a non-finite number for frame ${frame}.`);
|
|
20
21
|
}
|
|
21
|
-
return Math.max(0, Math.min(
|
|
22
|
+
return Math.max(0, Math.min(maxVolume, evaluated));
|
|
22
23
|
};
|
|
23
24
|
exports.evaluateVolume = evaluateVolume;
|
|
File without changes
|
|
@@ -18,12 +18,12 @@ const warnAboutNonSeekableMedia = (ref, type) => {
|
|
|
18
18
|
}
|
|
19
19
|
const range = { start: ref.seekable.start(0), end: ref.seekable.end(0) };
|
|
20
20
|
if (range.start === 0 && range.end === 0) {
|
|
21
|
-
const msg = `The media
|
|
21
|
+
const msg = `The media ${ref.src} cannot be seeked. This could be one of two reasons: 1) The media resource was replaced while the video is playing but it was not loaded yet. 2) The media does not support seeking. Please see https://remotion.dev/docs/non-seekable-media for assistance.`;
|
|
22
22
|
if (type === 'console-error') {
|
|
23
23
|
console.error(msg);
|
|
24
24
|
}
|
|
25
25
|
else if (type === 'console-warning') {
|
|
26
|
-
console.warn(`The media ${ref.src} does not support seeking. The video will render fine, but may not play correctly in
|
|
26
|
+
console.warn(`The media ${ref.src} does not support seeking. The video will render fine, but may not play correctly in the Remotion Studio and in the <Player>. See https://remotion.dev/docs/non-seekable-media for an explanation.`);
|
|
27
27
|
}
|
|
28
28
|
else {
|
|
29
29
|
throw new Error(msg);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare function useRemotionContexts(): {
|
|
3
|
+
compositionManagerCtx: import("./CompositionManagerContext.js").CompositionManagerContext;
|
|
4
|
+
timelineContext: import("./timeline-position-state.js").TimelineContextValue;
|
|
5
|
+
setTimelineContext: import("./timeline-position-state.js").SetTimelineContextValue;
|
|
6
|
+
sequenceContext: import("./SequenceContext.js").SequenceContextType | null;
|
|
7
|
+
nonceContext: import("./nonce.js").TNonceContext;
|
|
8
|
+
canUseRemotionHooksContext: boolean;
|
|
9
|
+
nativeLayersContext: import("./NativeLayers.js").TNativeLayersContext;
|
|
10
|
+
preloadContext: {
|
|
11
|
+
[x: string]: string;
|
|
12
|
+
};
|
|
13
|
+
resolveCompositionContext: {
|
|
14
|
+
[x: string]: ({
|
|
15
|
+
type: "loading";
|
|
16
|
+
} | {
|
|
17
|
+
type: "success";
|
|
18
|
+
result: import("./video-config.js").VideoConfig;
|
|
19
|
+
} | {
|
|
20
|
+
type: "error";
|
|
21
|
+
error: Error;
|
|
22
|
+
}) | undefined;
|
|
23
|
+
} | null;
|
|
24
|
+
assetManagerContext: import("./AssetManager.js").AssetManagerContext;
|
|
25
|
+
sequenceManagerContext: import("./SequenceManager.js").SequenceManagerContext;
|
|
26
|
+
};
|
|
27
|
+
export interface RemotionContextProviderProps {
|
|
28
|
+
contexts: ReturnType<typeof useRemotionContexts>;
|
|
29
|
+
children: React.ReactNode;
|
|
30
|
+
}
|
|
31
|
+
export declare const RemotionContextProvider: (props: RemotionContextProviderProps) => JSX.Element;
|
|
@@ -0,0 +1,85 @@
|
|
|
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 AssetManager_js_1 = require("./AssetManager.js");
|
|
33
|
+
const CanUseRemotionHooks_js_1 = require("./CanUseRemotionHooks.js");
|
|
34
|
+
const CompositionManagerContext_js_1 = require("./CompositionManagerContext.js");
|
|
35
|
+
const NativeLayers_js_1 = require("./NativeLayers.js");
|
|
36
|
+
const nonce_js_1 = require("./nonce.js");
|
|
37
|
+
const prefetch_state_js_1 = require("./prefetch-state.js");
|
|
38
|
+
const ResolveCompositionConfig_js_1 = require("./ResolveCompositionConfig.js");
|
|
39
|
+
const SequenceContext_js_1 = require("./SequenceContext.js");
|
|
40
|
+
const SequenceManager_js_1 = require("./SequenceManager.js");
|
|
41
|
+
const timeline_position_state_js_1 = require("./timeline-position-state.js");
|
|
42
|
+
function useRemotionContexts() {
|
|
43
|
+
const compositionManagerCtx = react_1.default.useContext(CompositionManagerContext_js_1.CompositionManager);
|
|
44
|
+
const timelineContext = react_1.default.useContext(timeline_position_state_js_1.TimelineContext);
|
|
45
|
+
const setTimelineContext = react_1.default.useContext(timeline_position_state_js_1.SetTimelineContext);
|
|
46
|
+
const sequenceContext = react_1.default.useContext(SequenceContext_js_1.SequenceContext);
|
|
47
|
+
const nonceContext = react_1.default.useContext(nonce_js_1.NonceContext);
|
|
48
|
+
const canUseRemotionHooksContext = react_1.default.useContext(CanUseRemotionHooks_js_1.CanUseRemotionHooks);
|
|
49
|
+
const nativeLayersContext = react_1.default.useContext(NativeLayers_js_1.NativeLayersContext);
|
|
50
|
+
const preloadContext = react_1.default.useContext(prefetch_state_js_1.PreloadContext);
|
|
51
|
+
const resolveCompositionContext = react_1.default.useContext(ResolveCompositionConfig_js_1.ResolveCompositionContext);
|
|
52
|
+
const assetManagerContext = react_1.default.useContext(AssetManager_js_1.AssetManager);
|
|
53
|
+
const sequenceManagerContext = react_1.default.useContext(SequenceManager_js_1.SequenceManager);
|
|
54
|
+
return (0, react_1.useMemo)(() => ({
|
|
55
|
+
compositionManagerCtx,
|
|
56
|
+
timelineContext,
|
|
57
|
+
setTimelineContext,
|
|
58
|
+
sequenceContext,
|
|
59
|
+
nonceContext,
|
|
60
|
+
canUseRemotionHooksContext,
|
|
61
|
+
nativeLayersContext,
|
|
62
|
+
preloadContext,
|
|
63
|
+
resolveCompositionContext,
|
|
64
|
+
assetManagerContext,
|
|
65
|
+
sequenceManagerContext,
|
|
66
|
+
}), [
|
|
67
|
+
compositionManagerCtx,
|
|
68
|
+
nonceContext,
|
|
69
|
+
sequenceContext,
|
|
70
|
+
setTimelineContext,
|
|
71
|
+
timelineContext,
|
|
72
|
+
canUseRemotionHooksContext,
|
|
73
|
+
nativeLayersContext,
|
|
74
|
+
preloadContext,
|
|
75
|
+
resolveCompositionContext,
|
|
76
|
+
assetManagerContext,
|
|
77
|
+
sequenceManagerContext,
|
|
78
|
+
]);
|
|
79
|
+
}
|
|
80
|
+
exports.useRemotionContexts = useRemotionContexts;
|
|
81
|
+
const RemotionContextProvider = (props) => {
|
|
82
|
+
const { children, contexts } = props;
|
|
83
|
+
return ((0, jsx_runtime_1.jsx)(CanUseRemotionHooks_js_1.CanUseRemotionHooks.Provider, { value: contexts.canUseRemotionHooksContext, children: (0, jsx_runtime_1.jsx)(nonce_js_1.NonceContext.Provider, { value: contexts.nonceContext, children: (0, jsx_runtime_1.jsx)(NativeLayers_js_1.NativeLayersContext.Provider, { value: contexts.nativeLayersContext, children: (0, jsx_runtime_1.jsx)(prefetch_state_js_1.PreloadContext.Provider, { value: contexts.preloadContext, children: (0, jsx_runtime_1.jsx)(CompositionManagerContext_js_1.CompositionManager.Provider, { value: contexts.compositionManagerCtx, children: (0, jsx_runtime_1.jsx)(SequenceManager_js_1.SequenceManager.Provider, { value: contexts.sequenceManagerContext, children: (0, jsx_runtime_1.jsx)(AssetManager_js_1.AssetManager.Provider, { value: contexts.assetManagerContext, children: (0, jsx_runtime_1.jsx)(ResolveCompositionConfig_js_1.ResolveCompositionContext.Provider, { value: contexts.resolveCompositionContext, children: (0, jsx_runtime_1.jsx)(timeline_position_state_js_1.TimelineContext.Provider, { value: contexts.timelineContext, children: (0, jsx_runtime_1.jsx)(timeline_position_state_js_1.SetTimelineContext.Provider, { value: contexts.setTimelineContext, children: (0, jsx_runtime_1.jsx)(SequenceContext_js_1.SequenceContext.Provider, { value: contexts.sequenceContext, children: children }) }) }) }) }) }) }) }) }) }) }));
|
|
84
|
+
};
|
|
85
|
+
exports.RemotionContextProvider = RemotionContextProvider;
|