remotion 4.0.0-webhook.26 → 4.0.0
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 +56 -0
- package/dist/cjs/Composition.js +121 -0
- package/dist/cjs/CompositionManager.d.ts +74 -0
- package/dist/{CompositionManager.js → cjs/CompositionManager.js} +29 -66
- package/dist/cjs/CompositionManagerContext.d.ts +19 -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 +74 -0
- package/dist/cjs/ResolveCompositionConfig.d.ts +24 -0
- package/dist/cjs/ResolveCompositionConfig.js +198 -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} +14 -6
- 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 +132 -0
- package/dist/cjs/internals.js +123 -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 +45 -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 +82 -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 -9
- 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} +9 -7
- package/dist/cjs/timeline-position-state.js +67 -0
- 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} +6 -5
- 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/cjs/validation/validate-dimensions.d.ts +1 -0
- package/dist/{validation → cjs/validation}/validate-dimensions.js +2 -2
- package/dist/cjs/validation/validate-duration-in-frames.d.ts +4 -0
- package/dist/{validation → cjs/validation}/validate-duration-in-frames.js +10 -3
- 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/cjs/validation/validate-fps.d.ts +1 -0
- package/dist/{validation → cjs/validation}/validate-fps.js +2 -2
- 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 +40 -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/cjs/video-config.d.ts +9 -0
- 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 +4643 -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/timeline-position-state.js +0 -41
- 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-dimensions.d.ts +0 -1
- package/dist/validation/validate-duration-in-frames.d.ts +0 -1
- package/dist/validation/validate-fps.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/video-config.d.ts +0 -8
- 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
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useMediaInTimeline = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
5
|
+
const use_audio_frame_js_1 = require("./audio/use-audio-frame.js");
|
|
6
|
+
const get_asset_file_name_js_1 = require("./get-asset-file-name.js");
|
|
7
|
+
const get_environment_js_1 = require("./get-environment.js");
|
|
8
|
+
const nonce_js_1 = require("./nonce.js");
|
|
9
|
+
const play_and_handle_not_allowed_error_js_1 = require("./play-and-handle-not-allowed-error.js");
|
|
10
|
+
const SequenceContext_js_1 = require("./SequenceContext.js");
|
|
11
|
+
const SequenceManager_js_1 = require("./SequenceManager.js");
|
|
12
|
+
const timeline_position_state_js_1 = require("./timeline-position-state.js");
|
|
13
|
+
const use_video_config_js_1 = require("./use-video-config.js");
|
|
14
|
+
const volume_prop_js_1 = require("./volume-prop.js");
|
|
15
15
|
const didWarn = {};
|
|
16
16
|
const warnOnce = (message) => {
|
|
17
17
|
if (didWarn[message]) {
|
|
@@ -20,34 +20,36 @@ const warnOnce = (message) => {
|
|
|
20
20
|
console.warn(message);
|
|
21
21
|
didWarn[message] = true;
|
|
22
22
|
};
|
|
23
|
-
const useMediaInTimeline = ({ volume, mediaVolume, mediaRef, src, mediaType, }) => {
|
|
24
|
-
const videoConfig = (0,
|
|
25
|
-
const { rootId, audioAndVideoTags } = (0, react_1.useContext)(
|
|
26
|
-
const parentSequence = (0, react_1.useContext)(
|
|
23
|
+
const useMediaInTimeline = ({ volume, mediaVolume, mediaRef, src, mediaType, playbackRate, }) => {
|
|
24
|
+
const videoConfig = (0, use_video_config_js_1.useVideoConfig)();
|
|
25
|
+
const { rootId, audioAndVideoTags } = (0, react_1.useContext)(timeline_position_state_js_1.TimelineContext);
|
|
26
|
+
const parentSequence = (0, react_1.useContext)(SequenceContext_js_1.SequenceContext);
|
|
27
27
|
const actualFrom = parentSequence
|
|
28
28
|
? parentSequence.relativeFrom + parentSequence.cumulatedFrom
|
|
29
29
|
: 0;
|
|
30
|
-
const [playing] = (0,
|
|
31
|
-
const startsAt = (0,
|
|
32
|
-
const { registerSequence, unregisterSequence } = (0, react_1.useContext)(
|
|
30
|
+
const [playing] = (0, timeline_position_state_js_1.usePlayingState)();
|
|
31
|
+
const startsAt = (0, use_audio_frame_js_1.useMediaStartsAt)();
|
|
32
|
+
const { registerSequence, unregisterSequence } = (0, react_1.useContext)(SequenceManager_js_1.SequenceManager);
|
|
33
33
|
const [id] = (0, react_1.useState)(() => String(Math.random()));
|
|
34
34
|
const [initialVolume] = (0, react_1.useState)(() => volume);
|
|
35
|
-
const nonce = (0,
|
|
35
|
+
const nonce = (0, nonce_js_1.useNonce)();
|
|
36
36
|
const duration = parentSequence
|
|
37
37
|
? Math.min(parentSequence.durationInFrames, videoConfig.durationInFrames)
|
|
38
38
|
: videoConfig.durationInFrames;
|
|
39
39
|
const doesVolumeChange = typeof volume === 'function';
|
|
40
|
+
const environment = (0, get_environment_js_1.useRemotionEnvironment)();
|
|
40
41
|
const volumes = (0, react_1.useMemo)(() => {
|
|
41
42
|
if (typeof volume === 'number') {
|
|
42
43
|
return volume;
|
|
43
44
|
}
|
|
44
|
-
return new Array(Math.max(0, duration + startsAt))
|
|
45
|
+
return new Array(Math.floor(Math.max(0, duration + startsAt)))
|
|
45
46
|
.fill(true)
|
|
46
47
|
.map((_, i) => {
|
|
47
|
-
return (0,
|
|
48
|
+
return (0, volume_prop_js_1.evaluateVolume)({
|
|
48
49
|
frame: i + startsAt,
|
|
49
50
|
volume,
|
|
50
51
|
mediaVolume,
|
|
52
|
+
allowAmplificationDuringRender: false,
|
|
51
53
|
});
|
|
52
54
|
})
|
|
53
55
|
.join(',');
|
|
@@ -65,8 +67,7 @@ const useMediaInTimeline = ({ volume, mediaVolume, mediaRef, src, mediaType, })
|
|
|
65
67
|
if (!src) {
|
|
66
68
|
throw new Error('No src passed');
|
|
67
69
|
}
|
|
68
|
-
if (
|
|
69
|
-
process.env.NODE_ENV !== 'test') {
|
|
70
|
+
if (environment !== 'preview' && process.env.NODE_ENV !== 'test') {
|
|
70
71
|
return;
|
|
71
72
|
}
|
|
72
73
|
registerSequence({
|
|
@@ -76,14 +77,15 @@ const useMediaInTimeline = ({ volume, mediaVolume, mediaRef, src, mediaType, })
|
|
|
76
77
|
duration,
|
|
77
78
|
from: 0,
|
|
78
79
|
parent: (_a = parentSequence === null || parentSequence === void 0 ? void 0 : parentSequence.id) !== null && _a !== void 0 ? _a : null,
|
|
79
|
-
displayName: (0,
|
|
80
|
+
displayName: (0, get_asset_file_name_js_1.getAssetDisplayName)(src),
|
|
80
81
|
rootId,
|
|
81
82
|
volume: volumes,
|
|
82
83
|
showInTimeline: true,
|
|
83
84
|
nonce,
|
|
84
85
|
startMediaFrom: 0 - startsAt,
|
|
85
86
|
doesVolumeChange,
|
|
86
|
-
|
|
87
|
+
loopDisplay: undefined,
|
|
88
|
+
playbackRate,
|
|
87
89
|
});
|
|
88
90
|
return () => {
|
|
89
91
|
unregisterSequence(id);
|
|
@@ -104,6 +106,8 @@ const useMediaInTimeline = ({ volume, mediaVolume, mediaRef, src, mediaType, })
|
|
|
104
106
|
mediaRef,
|
|
105
107
|
mediaType,
|
|
106
108
|
startsAt,
|
|
109
|
+
playbackRate,
|
|
110
|
+
environment,
|
|
107
111
|
]);
|
|
108
112
|
(0, react_1.useEffect)(() => {
|
|
109
113
|
const tag = {
|
|
@@ -113,7 +117,7 @@ const useMediaInTimeline = ({ volume, mediaVolume, mediaRef, src, mediaType, })
|
|
|
113
117
|
// Don't play if for example in a <Freeze> state.
|
|
114
118
|
return;
|
|
115
119
|
}
|
|
116
|
-
return (0,
|
|
120
|
+
return (0, play_and_handle_not_allowed_error_js_1.playAndHandleNotAllowedError)(mediaRef, mediaType);
|
|
117
121
|
},
|
|
118
122
|
};
|
|
119
123
|
audioAndVideoTags.current.push(tag);
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { RefObject } from 'react';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const DEFAULT_ACCEPTABLE_TIMESHIFT = 0.45;
|
|
3
|
+
export declare const useMediaPlayback: ({ mediaRef, src, mediaType, playbackRate: localPlaybackRate, onlyWarnForMediaSeekingError, acceptableTimeshift, }: {
|
|
3
4
|
mediaRef: RefObject<HTMLVideoElement | HTMLAudioElement>;
|
|
4
5
|
src: string | undefined;
|
|
5
6
|
mediaType: 'audio' | 'video';
|
|
6
7
|
playbackRate: number;
|
|
7
8
|
onlyWarnForMediaSeekingError: boolean;
|
|
9
|
+
acceptableTimeshift: number;
|
|
8
10
|
}) => void;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useMediaPlayback = exports.DEFAULT_ACCEPTABLE_TIMESHIFT = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const use_audio_frame_js_1 = require("./audio/use-audio-frame.js");
|
|
6
|
+
const play_and_handle_not_allowed_error_js_1 = require("./play-and-handle-not-allowed-error.js");
|
|
7
|
+
const timeline_position_state_js_1 = require("./timeline-position-state.js");
|
|
8
|
+
const use_current_frame_js_1 = require("./use-current-frame.js");
|
|
9
|
+
const use_video_config_js_1 = require("./use-video-config.js");
|
|
10
|
+
const get_current_time_js_1 = require("./video/get-current-time.js");
|
|
11
|
+
const warn_about_non_seekable_media_js_1 = require("./warn-about-non-seekable-media.js");
|
|
12
|
+
exports.DEFAULT_ACCEPTABLE_TIMESHIFT = 0.45;
|
|
13
|
+
const useMediaPlayback = ({ mediaRef, src, mediaType, playbackRate: localPlaybackRate, onlyWarnForMediaSeekingError, acceptableTimeshift, }) => {
|
|
14
|
+
const { playbackRate: globalPlaybackRate } = (0, react_1.useContext)(timeline_position_state_js_1.TimelineContext);
|
|
15
|
+
const frame = (0, use_current_frame_js_1.useCurrentFrame)();
|
|
16
|
+
const absoluteFrame = (0, timeline_position_state_js_1.useTimelinePosition)();
|
|
17
|
+
const [playing] = (0, timeline_position_state_js_1.usePlayingState)();
|
|
18
|
+
const { fps } = (0, use_video_config_js_1.useVideoConfig)();
|
|
19
|
+
const mediaStartsAt = (0, use_audio_frame_js_1.useMediaStartsAt)();
|
|
20
|
+
const playbackRate = localPlaybackRate * globalPlaybackRate;
|
|
21
|
+
(0, react_1.useEffect)(() => {
|
|
22
|
+
var _a;
|
|
23
|
+
if (!playing) {
|
|
24
|
+
(_a = mediaRef.current) === null || _a === void 0 ? void 0 : _a.pause();
|
|
25
|
+
}
|
|
26
|
+
}, [mediaRef, mediaType, playing]);
|
|
27
|
+
(0, react_1.useEffect)(() => {
|
|
28
|
+
const tagName = mediaType === 'audio' ? '<Audio>' : '<Video>';
|
|
29
|
+
if (!mediaRef.current) {
|
|
30
|
+
throw new Error(`No ${mediaType} ref found`);
|
|
31
|
+
}
|
|
32
|
+
if (!src) {
|
|
33
|
+
throw new Error(`No 'src' attribute was passed to the ${tagName} element.`);
|
|
34
|
+
}
|
|
35
|
+
mediaRef.current.playbackRate = Math.max(0, playbackRate);
|
|
36
|
+
const shouldBeTime = (0, get_current_time_js_1.getMediaTime)({
|
|
37
|
+
fps,
|
|
38
|
+
frame,
|
|
39
|
+
src,
|
|
40
|
+
playbackRate: localPlaybackRate,
|
|
41
|
+
startFrom: -mediaStartsAt,
|
|
42
|
+
mediaType,
|
|
43
|
+
});
|
|
44
|
+
const isTime = mediaRef.current.currentTime;
|
|
45
|
+
const timeShift = Math.abs(shouldBeTime - isTime);
|
|
46
|
+
if (timeShift > acceptableTimeshift && !mediaRef.current.ended) {
|
|
47
|
+
// If scrubbing around, adjust timing
|
|
48
|
+
// or if time shift is bigger than 0.2sec
|
|
49
|
+
mediaRef.current.currentTime = shouldBeTime;
|
|
50
|
+
if (!onlyWarnForMediaSeekingError) {
|
|
51
|
+
(0, warn_about_non_seekable_media_js_1.warnAboutNonSeekableMedia)(mediaRef.current, onlyWarnForMediaSeekingError ? 'console-warning' : 'console-error');
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
// Only perform a seek if the time is not already the same.
|
|
55
|
+
// Chrome rounds to 6 digits, so 0.033333333 -> 0.033333,
|
|
56
|
+
// therefore a threshold is allowed.
|
|
57
|
+
// Refer to the https://github.com/remotion-dev/video-buffering-example
|
|
58
|
+
// which is fixed by only seeking conditionally.
|
|
59
|
+
const makesSenseToSeek = Math.abs(mediaRef.current.currentTime - shouldBeTime) > 0.00001;
|
|
60
|
+
if (!playing || absoluteFrame === 0) {
|
|
61
|
+
if (makesSenseToSeek) {
|
|
62
|
+
mediaRef.current.currentTime = shouldBeTime;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
if (mediaRef.current.paused && !mediaRef.current.ended && playing) {
|
|
66
|
+
if (makesSenseToSeek) {
|
|
67
|
+
mediaRef.current.currentTime = shouldBeTime;
|
|
68
|
+
}
|
|
69
|
+
(0, play_and_handle_not_allowed_error_js_1.playAndHandleNotAllowedError)(mediaRef, mediaType);
|
|
70
|
+
}
|
|
71
|
+
}, [
|
|
72
|
+
absoluteFrame,
|
|
73
|
+
fps,
|
|
74
|
+
playbackRate,
|
|
75
|
+
frame,
|
|
76
|
+
mediaRef,
|
|
77
|
+
mediaType,
|
|
78
|
+
playing,
|
|
79
|
+
src,
|
|
80
|
+
mediaStartsAt,
|
|
81
|
+
localPlaybackRate,
|
|
82
|
+
onlyWarnForMediaSeekingError,
|
|
83
|
+
acceptableTimeshift,
|
|
84
|
+
]);
|
|
85
|
+
};
|
|
86
|
+
exports.useMediaPlayback = useMediaPlayback;
|
|
File without changes
|
|
File without changes
|
package/dist/{use-sync-volume-with-media-tag.d.ts → cjs/use-sync-volume-with-media-tag.d.ts}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { RefObject } from 'react';
|
|
2
|
-
import type { VolumeProp } from './volume-prop';
|
|
3
|
-
export
|
|
2
|
+
import type { VolumeProp } from './volume-prop.js';
|
|
3
|
+
export type UseSyncVolumeWithMediaTagOptions = {
|
|
4
4
|
volumePropFrame: number;
|
|
5
5
|
actualVolume: number;
|
|
6
6
|
volume?: VolumeProp;
|
|
@@ -2,16 +2,17 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useSyncVolumeWithMediaTag = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
5
|
+
const is_approximately_the_same_js_1 = require("./is-approximately-the-same.js");
|
|
6
|
+
const volume_prop_js_1 = require("./volume-prop.js");
|
|
7
7
|
const useSyncVolumeWithMediaTag = ({ volumePropFrame, actualVolume, volume, mediaVolume, mediaRef, }) => {
|
|
8
8
|
(0, react_1.useEffect)(() => {
|
|
9
|
-
const userPreferredVolume = (0,
|
|
9
|
+
const userPreferredVolume = (0, volume_prop_js_1.evaluateVolume)({
|
|
10
10
|
frame: volumePropFrame,
|
|
11
11
|
volume,
|
|
12
12
|
mediaVolume,
|
|
13
|
+
allowAmplificationDuringRender: false,
|
|
13
14
|
});
|
|
14
|
-
if (!(0,
|
|
15
|
+
if (!(0, is_approximately_the_same_js_1.isApproximatelyTheSame)(userPreferredVolume, actualVolume) &&
|
|
15
16
|
mediaRef.current) {
|
|
16
17
|
mediaRef.current.volume = userPreferredVolume;
|
|
17
18
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { VideoConfig } from './video-config';
|
|
1
|
+
import type { VideoConfig } from './video-config.js';
|
|
2
2
|
export declare const useUnsafeVideoConfig: () => VideoConfig | null;
|
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useUnsafeVideoConfig = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
5
|
+
const SequenceContext_js_1 = require("./SequenceContext.js");
|
|
6
|
+
const use_video_js_1 = require("./use-video.js");
|
|
7
7
|
const useUnsafeVideoConfig = () => {
|
|
8
8
|
var _a;
|
|
9
|
-
const context = (0, react_1.useContext)(
|
|
9
|
+
const context = (0, react_1.useContext)(SequenceContext_js_1.SequenceContext);
|
|
10
10
|
const ctxDuration = (_a = context === null || context === void 0 ? void 0 : context.durationInFrames) !== null && _a !== void 0 ? _a : null;
|
|
11
|
-
const video = (0,
|
|
11
|
+
const video = (0, use_video_js_1.useVideo)();
|
|
12
12
|
return (0, react_1.useMemo)(() => {
|
|
13
13
|
if (!video) {
|
|
14
14
|
return null;
|
|
15
15
|
}
|
|
16
|
-
const { id, durationInFrames, fps, height, width, defaultProps } = video;
|
|
16
|
+
const { id, durationInFrames, fps, height, width, defaultProps, props } = video;
|
|
17
17
|
return {
|
|
18
18
|
id,
|
|
19
19
|
width,
|
|
@@ -21,6 +21,7 @@ const useUnsafeVideoConfig = () => {
|
|
|
21
21
|
fps,
|
|
22
22
|
durationInFrames: ctxDuration !== null && ctxDuration !== void 0 ? ctxDuration : durationInFrames,
|
|
23
23
|
defaultProps,
|
|
24
|
+
props,
|
|
24
25
|
};
|
|
25
26
|
}, [ctxDuration, video]);
|
|
26
27
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { VideoConfig } from './video-config.js';
|
|
2
|
+
/**
|
|
3
|
+
* /**
|
|
4
|
+
* @description Get some info about the context of the video that you are making.
|
|
5
|
+
* @see [Documentation](https://www.remotion.dev/docs/use-video-config)
|
|
6
|
+
* @returns Returns an object containing `fps`, `width`, `height` and `durationInFrames`, all of type `number`.
|
|
7
|
+
*/
|
|
8
|
+
export declare const useVideoConfig: () => VideoConfig;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useVideoConfig = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const CanUseRemotionHooks_js_1 = require("./CanUseRemotionHooks.js");
|
|
6
|
+
const is_player_js_1 = require("./is-player.js");
|
|
7
|
+
const use_unsafe_video_config_js_1 = require("./use-unsafe-video-config.js");
|
|
8
|
+
/**
|
|
9
|
+
* /**
|
|
10
|
+
* @description Get some info about the context of the video that you are making.
|
|
11
|
+
* @see [Documentation](https://www.remotion.dev/docs/use-video-config)
|
|
12
|
+
* @returns Returns an object containing `fps`, `width`, `height` and `durationInFrames`, all of type `number`.
|
|
13
|
+
*/
|
|
14
|
+
const useVideoConfig = () => {
|
|
15
|
+
const videoConfig = (0, use_unsafe_video_config_js_1.useUnsafeVideoConfig)();
|
|
16
|
+
const context = (0, react_1.useContext)(CanUseRemotionHooks_js_1.CanUseRemotionHooks);
|
|
17
|
+
const isPlayer = (0, is_player_js_1.useIsPlayer)();
|
|
18
|
+
if (!videoConfig) {
|
|
19
|
+
if ((typeof window !== 'undefined' && window.remotion_isPlayer) ||
|
|
20
|
+
isPlayer) {
|
|
21
|
+
throw new Error([
|
|
22
|
+
'No video config found. Likely reasons:',
|
|
23
|
+
'- You are probably calling useVideoConfig() from outside the component passed to <Player />. See https://www.remotion.dev/docs/player/examples for how to set up the Player correctly.',
|
|
24
|
+
'- You have multiple versions of Remotion installed which causes the React context to get lost.',
|
|
25
|
+
].join('-'));
|
|
26
|
+
}
|
|
27
|
+
throw new Error('No video config found. You are probably calling useVideoConfig() from a component which has not been registered as a <Composition />. See https://www.remotion.dev/docs/the-fundamentals#defining-compositions for more information.');
|
|
28
|
+
}
|
|
29
|
+
if (!context) {
|
|
30
|
+
throw new Error('Called useVideoConfig() outside a Remotion composition.');
|
|
31
|
+
}
|
|
32
|
+
return videoConfig;
|
|
33
|
+
};
|
|
34
|
+
exports.useVideoConfig = useVideoConfig;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ComponentType, LazyExoticComponent } from 'react';
|
|
2
|
+
import type { VideoConfig } from './video-config.js';
|
|
3
|
+
type ReturnType = (VideoConfig & {
|
|
4
|
+
component: LazyExoticComponent<ComponentType<Record<string, unknown>>>;
|
|
5
|
+
}) | null;
|
|
6
|
+
export declare const useVideo: () => ReturnType;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useVideo = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const CompositionManagerContext_js_1 = require("./CompositionManagerContext.js");
|
|
6
|
+
const ResolveCompositionConfig_js_1 = require("./ResolveCompositionConfig.js");
|
|
7
|
+
const useVideo = () => {
|
|
8
|
+
const context = (0, react_1.useContext)(CompositionManagerContext_js_1.CompositionManager);
|
|
9
|
+
const selected = context.compositions.find((c) => {
|
|
10
|
+
return c.id === context.currentComposition;
|
|
11
|
+
});
|
|
12
|
+
const resolved = (0, ResolveCompositionConfig_js_1.useResolvedVideoConfig)(context.currentComposition);
|
|
13
|
+
return (0, react_1.useMemo)(() => {
|
|
14
|
+
var _a, _b;
|
|
15
|
+
if (!resolved) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
if (resolved.type === 'error') {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
if (resolved.type === 'loading') {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
if (!selected) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
...resolved.result,
|
|
29
|
+
defaultProps: (_a = selected.defaultProps) !== null && _a !== void 0 ? _a : {},
|
|
30
|
+
id: selected.id,
|
|
31
|
+
// We override the selected metadata with the metadata that was passed to renderMedia(),
|
|
32
|
+
// and don't allow it to be changed during render anymore
|
|
33
|
+
...((_b = context.currentCompositionMetadata) !== null && _b !== void 0 ? _b : {}),
|
|
34
|
+
component: selected.component,
|
|
35
|
+
};
|
|
36
|
+
}, [context.currentCompositionMetadata, resolved, selected]);
|
|
37
|
+
};
|
|
38
|
+
exports.useVideo = useVideo;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateFrame = void 0;
|
|
4
|
+
const validateFrame = ({ allowFloats, durationInFrames, frame, }) => {
|
|
5
|
+
if (typeof frame === 'undefined') {
|
|
6
|
+
throw new TypeError(`Argument missing for parameter "frame"`);
|
|
7
|
+
}
|
|
8
|
+
if (typeof frame !== 'number') {
|
|
9
|
+
throw new TypeError(`Argument passed for "frame" is not a number: ${frame}`);
|
|
10
|
+
}
|
|
11
|
+
if (!Number.isFinite(frame)) {
|
|
12
|
+
throw new RangeError(`Frame ${frame} is not finite`);
|
|
13
|
+
}
|
|
14
|
+
if (frame % 1 !== 0 && !allowFloats) {
|
|
15
|
+
throw new RangeError(`Argument for frame must be an integer, but got ${frame}`);
|
|
16
|
+
}
|
|
17
|
+
if (frame < 0 && frame < -durationInFrames) {
|
|
18
|
+
throw new RangeError(`Cannot use frame ${frame}: Duration of composition is ${durationInFrames}, therefore the lowest frame that can be rendered is ${-durationInFrames}`);
|
|
19
|
+
}
|
|
20
|
+
if (frame > durationInFrames - 1) {
|
|
21
|
+
throw new RangeError(`Cannot use frame ${frame}: Duration of composition is ${durationInFrames}, therefore the highest frame that can be rendered is ${durationInFrames - 1}`);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
exports.validateFrame = validateFrame;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { RemotionAudioProps } from './audio/index.js';
|
|
2
|
+
import type { RemotionVideoProps } from './video/index.js';
|
|
3
|
+
import type { OffthreadVideoProps } from './video/props.js';
|
|
4
|
+
export declare const validateMediaProps: (props: RemotionVideoProps | RemotionAudioProps | OffthreadVideoProps, component: 'Video' | 'Audio') => void;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const validateDefaultAndInputProps: (defaultProps: unknown, name: 'defaultProps' | 'inputProps', compositionId: string | null) => void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateDefaultAndInputProps = void 0;
|
|
4
|
+
const validateDefaultAndInputProps = (defaultProps, name, compositionId) => {
|
|
5
|
+
if (!defaultProps) {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
if (typeof defaultProps !== 'object') {
|
|
9
|
+
throw new Error(`"${name}" must be an object, but you passed a value of type ${typeof defaultProps}`);
|
|
10
|
+
}
|
|
11
|
+
if (Array.isArray(defaultProps)) {
|
|
12
|
+
throw new Error(`"${name}" must be an object, an array was passed ${compositionId ? `for composition "${compositionId}"` : ''}`);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
exports.validateDefaultAndInputProps = validateDefaultAndInputProps;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function validateDimension(amount: unknown, nameOfProp: string, location: string): asserts amount is number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.validateDimension = void 0;
|
|
4
|
-
|
|
4
|
+
function validateDimension(amount, nameOfProp, location) {
|
|
5
5
|
if (typeof amount !== 'number') {
|
|
6
6
|
throw new Error(`The "${nameOfProp}" prop ${location} must be a number, but you passed a value of type ${typeof amount}`);
|
|
7
7
|
}
|
|
@@ -17,5 +17,5 @@ const validateDimension = (amount, nameOfProp, location) => {
|
|
|
17
17
|
if (amount <= 0) {
|
|
18
18
|
throw new TypeError(`The "${nameOfProp}" prop ${location} must be positive, but got ${amount}.`);
|
|
19
19
|
}
|
|
20
|
-
}
|
|
20
|
+
}
|
|
21
21
|
exports.validateDimension = validateDimension;
|
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.validateDurationInFrames = void 0;
|
|
4
|
-
|
|
4
|
+
function validateDurationInFrames(durationInFrames, options) {
|
|
5
|
+
const { allowFloats, component } = options;
|
|
6
|
+
if (typeof durationInFrames === 'undefined') {
|
|
7
|
+
throw new Error(`The "durationInFrames" prop ${component} is missing.`);
|
|
8
|
+
}
|
|
5
9
|
if (typeof durationInFrames !== 'number') {
|
|
6
10
|
throw new Error(`The "durationInFrames" prop ${component} must be a number, but you passed a value of type ${typeof durationInFrames}`);
|
|
7
11
|
}
|
|
8
12
|
if (durationInFrames <= 0) {
|
|
9
13
|
throw new TypeError(`The "durationInFrames" prop ${component} must be positive, but got ${durationInFrames}.`);
|
|
10
14
|
}
|
|
11
|
-
if (durationInFrames % 1 !== 0) {
|
|
15
|
+
if (!allowFloats && durationInFrames % 1 !== 0) {
|
|
12
16
|
throw new TypeError(`The "durationInFrames" prop ${component} must be an integer, but got ${durationInFrames}.`);
|
|
13
17
|
}
|
|
14
|
-
|
|
18
|
+
if (!Number.isFinite(durationInFrames)) {
|
|
19
|
+
throw new TypeError(`The "durationInFrames" prop ${component} must be finite, but got ${durationInFrames}.`);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
15
22
|
exports.validateDurationInFrames = validateDurationInFrames;
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function validateFps(fps: unknown, location: string, isGif: boolean): asserts fps is number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.validateFps = void 0;
|
|
4
|
-
|
|
4
|
+
function validateFps(fps, location, isGif) {
|
|
5
5
|
if (typeof fps !== 'number') {
|
|
6
6
|
throw new Error(`"fps" must be a number, but you passed a value of type ${typeof fps} ${location}`);
|
|
7
7
|
}
|
|
@@ -17,5 +17,5 @@ const validateFps = (fps, location, isGif) => {
|
|
|
17
17
|
if (isGif && fps > 50) {
|
|
18
18
|
throw new TypeError(`The FPS for a GIF cannot be higher than 50. Use the --every-nth-frame option to lower the FPS: https://remotion.dev/docs/render-as-gif`);
|
|
19
19
|
}
|
|
20
|
-
}
|
|
20
|
+
}
|
|
21
21
|
exports.validateFps = validateFps;
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const VERSION = "4.0.0";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { OffthreadVideoProps, RemotionMainVideoProps } from './props.js';
|
|
3
|
+
/**
|
|
4
|
+
* @description This method imports and displays a video, similar to <Video />. During rendering, it extracts the exact frame from the video and displays it in an <img> tag
|
|
5
|
+
* @see [Documentation](https://www.remotion.dev/docs/offthreadvideo)
|
|
6
|
+
*/
|
|
7
|
+
export declare const OffthreadVideo: React.FC<Omit<OffthreadVideoProps & RemotionMainVideoProps, 'loop'>>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OffthreadVideo = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const get_environment_js_1 = require("../get-environment.js");
|
|
7
|
+
const Sequence_js_1 = require("../Sequence.js");
|
|
8
|
+
const validate_media_props_js_1 = require("../validate-media-props.js");
|
|
9
|
+
const validate_start_from_props_js_1 = require("../validate-start-from-props.js");
|
|
10
|
+
const OffthreadVideoForRendering_js_1 = require("./OffthreadVideoForRendering.js");
|
|
11
|
+
const VideoForDevelopment_js_1 = require("./VideoForDevelopment.js");
|
|
12
|
+
/**
|
|
13
|
+
* @description This method imports and displays a video, similar to <Video />. During rendering, it extracts the exact frame from the video and displays it in an <img> tag
|
|
14
|
+
* @see [Documentation](https://www.remotion.dev/docs/offthreadvideo)
|
|
15
|
+
*/
|
|
16
|
+
const OffthreadVideo = (props) => {
|
|
17
|
+
// Should only destruct `startFrom` and `endAt` from props,
|
|
18
|
+
// rest gets drilled down
|
|
19
|
+
const { startFrom, endAt, ...otherProps } = props;
|
|
20
|
+
const environment = (0, get_environment_js_1.useRemotionEnvironment)();
|
|
21
|
+
const onDuration = (0, react_1.useCallback)(() => undefined, []);
|
|
22
|
+
if (typeof props.src !== 'string') {
|
|
23
|
+
throw new TypeError(`The \`<OffthreadVideo>\` tag requires a string for \`src\`, but got ${JSON.stringify(props.src)} instead.`);
|
|
24
|
+
}
|
|
25
|
+
if (props.imageFormat) {
|
|
26
|
+
throw new TypeError(`The \`<OffthreadVideo>\` tag does no longer accept \`imageFormat\`. Use the \`transparent\` prop if you want to render a transparent video.`);
|
|
27
|
+
}
|
|
28
|
+
if (typeof startFrom !== 'undefined' || typeof endAt !== 'undefined') {
|
|
29
|
+
(0, validate_start_from_props_js_1.validateStartFromProps)(startFrom, endAt);
|
|
30
|
+
const startFromFrameNo = startFrom !== null && startFrom !== void 0 ? startFrom : 0;
|
|
31
|
+
const endAtFrameNo = endAt !== null && endAt !== void 0 ? endAt : Infinity;
|
|
32
|
+
return ((0, jsx_runtime_1.jsx)(Sequence_js_1.Sequence, { layout: "none", from: 0 - startFromFrameNo, showInTimeline: false, durationInFrames: endAtFrameNo, children: (0, jsx_runtime_1.jsx)(exports.OffthreadVideo, { ...otherProps }) }));
|
|
33
|
+
}
|
|
34
|
+
(0, validate_media_props_js_1.validateMediaProps)(props, 'Video');
|
|
35
|
+
if (environment === 'rendering') {
|
|
36
|
+
return (0, jsx_runtime_1.jsx)(OffthreadVideoForRendering_js_1.OffthreadVideoForRendering, { ...otherProps });
|
|
37
|
+
}
|
|
38
|
+
return ((0, jsx_runtime_1.jsx)(VideoForDevelopment_js_1.VideoForDevelopment, { onDuration: onDuration, onlyWarnForMediaSeekingError: true, ...otherProps }));
|
|
39
|
+
};
|
|
40
|
+
exports.OffthreadVideo = OffthreadVideo;
|