remotion 3.3.45 → 3.3.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Sequence.js +1 -1
- package/dist/Still.d.ts +0 -1
- package/dist/audio/Audio.d.ts +2 -2
- package/dist/audio/AudioForDevelopment.d.ts +1 -1
- package/dist/audio/AudioForRendering.d.ts +1 -1
- package/dist/cjs/AbsoluteFill.d.ts +6 -0
- package/dist/cjs/AbsoluteFill.js +28 -0
- package/dist/cjs/CanUseRemotionHooks.d.ts +5 -0
- package/dist/cjs/CanUseRemotionHooks.js +10 -0
- package/dist/cjs/Clipper.d.ts +7 -0
- package/dist/cjs/Clipper.js +24 -0
- package/dist/cjs/Composition.d.ts +23 -0
- package/dist/cjs/Composition.js +113 -0
- package/dist/cjs/CompositionManager.d.ts +82 -0
- package/dist/cjs/CompositionManager.js +164 -0
- package/dist/cjs/Folder.d.ts +15 -0
- package/dist/cjs/Folder.js +33 -0
- package/dist/cjs/IFrame.d.ts +2 -0
- package/dist/cjs/IFrame.js +24 -0
- package/dist/cjs/Img.d.ts +2 -0
- package/dist/cjs/Img.js +52 -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/cjs/RemotionRoot.d.ts +5 -0
- package/dist/cjs/RemotionRoot.js +73 -0
- package/dist/cjs/Sequence.d.ts +29 -0
- package/dist/cjs/Sequence.js +131 -0
- package/dist/cjs/Still.d.ts +3 -0
- package/dist/cjs/Still.js +9 -0
- package/dist/cjs/absolute-src.d.ts +1 -0
- package/dist/cjs/absolute-src.js +7 -0
- package/dist/cjs/asset-types.d.ts +50 -0
- package/dist/cjs/asset-types.js +1 -0
- package/dist/cjs/audio/Audio.d.ts +8 -0
- package/dist/cjs/audio/Audio.js +52 -0
- package/dist/cjs/audio/AudioForDevelopment.d.ts +11 -0
- package/dist/cjs/audio/AudioForDevelopment.js +94 -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/cjs/audio/index.js +18 -0
- package/dist/cjs/audio/props.d.ts +12 -0
- package/dist/cjs/audio/props.js +2 -0
- package/dist/cjs/audio/shared-audio-tags.d.ts +37 -0
- package/dist/cjs/audio/shared-audio-tags.js +222 -0
- package/dist/cjs/audio/use-audio-frame.d.ts +6 -0
- package/dist/cjs/audio/use-audio-frame.js +23 -0
- package/dist/cjs/bezier.d.ts +1 -0
- package/dist/cjs/bezier.js +114 -0
- package/dist/cjs/cancel-render.d.ts +1 -0
- package/dist/cjs/cancel-render.js +43 -0
- package/dist/cjs/config/input-props.d.ts +1 -0
- package/dist/cjs/config/input-props.js +31 -0
- package/dist/cjs/config.d.ts +285 -0
- package/dist/cjs/config.js +21 -0
- package/dist/cjs/default-css.d.ts +3 -0
- package/dist/cjs/default-css.js +49 -0
- package/dist/cjs/delay-render.d.ts +14 -0
- package/dist/cjs/delay-render.js +77 -0
- package/dist/cjs/easing.d.ts +19 -0
- package/dist/cjs/easing.js +77 -0
- package/dist/cjs/freeze.d.ts +7 -0
- package/dist/cjs/freeze.js +34 -0
- package/dist/cjs/get-asset-file-name.d.ts +1 -0
- package/dist/cjs/get-asset-file-name.js +14 -0
- package/dist/cjs/get-environment.d.ts +3 -0
- package/dist/cjs/get-environment.js +34 -0
- package/dist/cjs/get-preview-dom-element.d.ts +1 -0
- package/dist/cjs/get-preview-dom-element.js +7 -0
- package/dist/cjs/get-static-files.d.ts +17 -0
- package/dist/cjs/get-static-files.js +31 -0
- package/dist/cjs/get-timeline-clip-name.d.ts +1 -0
- package/dist/cjs/get-timeline-clip-name.js +25 -0
- package/dist/cjs/index.d.ts +92 -0
- package/dist/cjs/index.js +73 -0
- package/dist/cjs/internals.d.ts +99 -0
- package/dist/cjs/internals.js +101 -0
- package/dist/cjs/interpolate-colors.d.ts +5 -0
- package/dist/cjs/interpolate-colors.js +401 -0
- package/dist/cjs/interpolate.d.ts +18 -0
- package/dist/cjs/interpolate.js +123 -0
- package/dist/cjs/is-approximately-the-same.d.ts +1 -0
- package/dist/cjs/is-approximately-the-same.js +8 -0
- package/dist/cjs/is-player.d.ts +3 -0
- package/dist/cjs/is-player.js +14 -0
- package/dist/cjs/loading-indicator.d.ts +2 -0
- package/dist/cjs/loading-indicator.js +35 -0
- package/dist/cjs/loop/index.d.ts +9 -0
- package/dist/cjs/loop/index.js +29 -0
- package/dist/cjs/multiple-versions-warning.d.ts +1 -0
- package/dist/cjs/multiple-versions-warning.js +32 -0
- package/dist/cjs/nonce.d.ts +7 -0
- package/dist/cjs/nonce.js +17 -0
- package/dist/cjs/play-and-handle-not-allowed-error.d.ts +2 -0
- package/dist/cjs/play-and-handle-not-allowed-error.js +44 -0
- package/dist/cjs/portal-node.d.ts +1 -0
- package/dist/cjs/portal-node.js +23 -0
- package/dist/cjs/prefetch-state.d.ts +8 -0
- package/dist/cjs/prefetch-state.js +27 -0
- package/dist/cjs/prefetch.d.ts +9 -0
- package/dist/cjs/prefetch.js +108 -0
- package/dist/cjs/random.d.ts +7 -0
- package/dist/cjs/random.js +42 -0
- package/dist/cjs/register-root.d.ts +4 -0
- package/dist/cjs/register-root.js +33 -0
- package/dist/cjs/series/flatten-children.d.ts +2 -0
- package/dist/cjs/series/flatten-children.js +19 -0
- package/dist/cjs/series/index.d.ts +13 -0
- package/dist/cjs/series/index.js +60 -0
- package/dist/cjs/setup-env-variables.d.ts +2 -0
- package/dist/cjs/setup-env-variables.js +36 -0
- package/dist/cjs/spring/index.d.ts +27 -0
- package/dist/cjs/spring/index.js +55 -0
- package/dist/cjs/spring/measure-spring.d.ts +8 -0
- package/dist/cjs/spring/measure-spring.js +64 -0
- package/dist/cjs/spring/spring-utils.d.ts +21 -0
- package/dist/cjs/spring/spring-utils.js +103 -0
- package/dist/cjs/static-file.d.ts +5 -0
- package/dist/cjs/static-file.js +33 -0
- package/dist/cjs/test/Img.test.d.ts +1 -0
- package/dist/cjs/test/Img.test.js +25 -0
- package/dist/cjs/test/absolute-src.test.d.ts +1 -0
- package/dist/cjs/test/absolute-src.test.js +18 -0
- package/dist/cjs/test/audio-for-rendering.test.d.ts +1 -0
- package/dist/cjs/test/audio-for-rendering.test.js +88 -0
- package/dist/cjs/test/audio.test.d.ts +1 -0
- package/dist/cjs/test/audio.test.js +76 -0
- package/dist/cjs/test/bezier.test.d.ts +1 -0
- package/dist/cjs/test/bezier.test.js +52 -0
- package/dist/cjs/test/composition-rules.test.d.ts +1 -0
- package/dist/cjs/test/composition-rules.test.js +30 -0
- package/dist/cjs/test/composition-validation.test.d.ts +1 -0
- package/dist/cjs/test/composition-validation.test.js +99 -0
- package/dist/cjs/test/easing.test.d.ts +1 -0
- package/dist/cjs/test/easing.test.js +191 -0
- package/dist/cjs/test/expect-to-throw.d.ts +1 -0
- package/dist/cjs/test/expect-to-throw.js +15 -0
- package/dist/cjs/test/freeze.test.d.ts +1 -0
- package/dist/cjs/test/freeze.test.js +65 -0
- package/dist/cjs/test/get-asset-file-name.test.d.ts +1 -0
- package/dist/cjs/test/get-asset-file-name.test.js +14 -0
- package/dist/cjs/test/get-current-time.test.d.ts +1 -0
- package/dist/cjs/test/get-current-time.test.js +74 -0
- package/dist/cjs/test/input-props.test.d.ts +1 -0
- package/dist/cjs/test/input-props.test.js +31 -0
- package/dist/cjs/test/interpolate.test.d.ts +1 -0
- package/dist/cjs/test/interpolate.test.js +138 -0
- package/dist/cjs/test/interpolateColors.test.d.ts +1 -0
- package/dist/cjs/test/interpolateColors.test.js +63 -0
- package/dist/cjs/test/loop-validation.test.d.ts +1 -0
- package/dist/cjs/test/loop-validation.test.js +93 -0
- package/dist/cjs/test/measure-spring.test.d.ts +1 -0
- package/dist/cjs/test/measure-spring.test.js +45 -0
- package/dist/cjs/test/media-validation.test.d.ts +1 -0
- package/dist/cjs/test/media-validation.test.js +47 -0
- package/dist/cjs/test/nested-sequences.test.d.ts +1 -0
- package/dist/cjs/test/nested-sequences.test.js +132 -0
- package/dist/cjs/test/not-all-props-in-media-tags.test.d.ts +1 -0
- package/dist/cjs/test/not-all-props-in-media-tags.test.js +33 -0
- package/dist/cjs/test/random.test.d.ts +1 -0
- package/dist/cjs/test/random.test.js +60 -0
- package/dist/cjs/test/ready-manager.test.d.ts +1 -0
- package/dist/cjs/test/ready-manager.test.js +29 -0
- package/dist/cjs/test/render-hook.d.ts +23 -0
- package/dist/cjs/test/render-hook.js +27 -0
- package/dist/cjs/test/sequence-from-initial-offset.test.d.ts +4 -0
- package/dist/cjs/test/sequence-from-initial-offset.test.js +35 -0
- package/dist/cjs/test/sequence-validation.test.d.ts +1 -0
- package/dist/cjs/test/sequence-validation.test.js +47 -0
- package/dist/cjs/test/series.test.d.ts +1 -0
- package/dist/cjs/test/series.test.js +115 -0
- package/dist/cjs/test/spring.test.d.ts +1 -0
- package/dist/cjs/test/spring.test.js +38 -0
- package/dist/cjs/test/truthy.test.d.ts +1 -0
- package/dist/cjs/test/truthy.test.js +24 -0
- package/dist/cjs/test/use-audio-frame.test.d.ts +1 -0
- package/dist/cjs/test/use-audio-frame.test.js +78 -0
- package/dist/cjs/test/use-media-in-timeline.test.d.ts +1 -0
- package/dist/cjs/test/use-media-in-timeline.test.js +74 -0
- package/dist/cjs/test/use-media-tag-volume.test.d.ts +1 -0
- package/dist/cjs/test/use-media-tag-volume.test.js +49 -0
- package/dist/cjs/test/use-sync-volume-with-media-tag.test.d.ts +1 -0
- package/dist/cjs/test/use-sync-volume-with-media-tag.test.js +55 -0
- package/dist/cjs/test/validate-start-from-props.test.d.ts +1 -0
- package/dist/cjs/test/validate-start-from-props.test.js +39 -0
- package/dist/cjs/test/video.test.d.ts +1 -0
- package/dist/cjs/test/video.test.js +80 -0
- package/dist/cjs/test/volume-prop.test.d.ts +1 -0
- package/dist/cjs/test/volume-prop.test.js +95 -0
- package/dist/cjs/test/wrap-sequence-context.d.ts +6 -0
- package/dist/cjs/test/wrap-sequence-context.js +41 -0
- package/dist/cjs/timeline-position-state.d.ts +29 -0
- package/dist/cjs/timeline-position-state.js +41 -0
- package/dist/cjs/truthy.d.ts +3 -0
- package/dist/cjs/truthy.js +7 -0
- package/dist/cjs/use-current-frame.d.ts +6 -0
- package/dist/cjs/use-current-frame.js +28 -0
- package/dist/cjs/use-lazy-component.d.ts +7 -0
- package/dist/cjs/use-lazy-component.js +49 -0
- package/dist/cjs/use-media-in-timeline.d.ts +10 -0
- package/dist/cjs/use-media-in-timeline.js +129 -0
- package/dist/cjs/use-media-playback.d.ts +10 -0
- package/dist/cjs/use-media-playback.js +77 -0
- package/dist/cjs/use-media-tag-volume.d.ts +2 -0
- package/dist/cjs/use-media-tag-volume.js +31 -0
- package/dist/cjs/use-sync-volume-with-media-tag.d.ts +10 -0
- package/dist/cjs/use-sync-volume-with-media-tag.js +21 -0
- package/dist/cjs/use-unsafe-video-config.d.ts +2 -0
- package/dist/cjs/use-unsafe-video-config.js +27 -0
- package/dist/cjs/use-video-config.d.ts +7 -0
- package/dist/cjs/use-video-config.js +29 -0
- package/dist/cjs/use-video.d.ts +13 -0
- package/dist/cjs/use-video.js +28 -0
- package/dist/cjs/validate-frame.d.ts +1 -0
- package/dist/cjs/validate-frame.js +24 -0
- package/dist/cjs/validate-media-props.d.ts +4 -0
- package/dist/cjs/validate-media-props.js +24 -0
- package/dist/cjs/validate-start-from-props.d.ts +1 -0
- package/dist/cjs/validate-start-from-props.js +31 -0
- package/dist/cjs/validation/validate-composition-id.d.ts +3 -0
- package/dist/cjs/validation/validate-composition-id.js +13 -0
- package/dist/cjs/validation/validate-dimensions.d.ts +1 -0
- package/dist/cjs/validation/validate-dimensions.js +21 -0
- package/dist/cjs/validation/validate-duration-in-frames.d.ts +1 -0
- package/dist/cjs/validation/validate-duration-in-frames.js +15 -0
- package/dist/cjs/validation/validate-folder-name.d.ts +3 -0
- package/dist/cjs/validation/validate-folder-name.js +19 -0
- package/dist/cjs/validation/validate-fps.d.ts +1 -0
- package/dist/cjs/validation/validate-fps.js +21 -0
- package/dist/cjs/validation/validate-offthreadvideo-image-format.d.ts +1 -0
- package/dist/cjs/validation/validate-offthreadvideo-image-format.js +15 -0
- package/dist/cjs/validation/validation-spring-duration.d.ts +1 -0
- package/dist/cjs/validation/validation-spring-duration.js +21 -0
- package/dist/cjs/version.d.ts +1 -0
- package/dist/cjs/version.js +5 -0
- package/dist/cjs/video/OffthreadVideo.d.ts +3 -0
- package/dist/cjs/video/OffthreadVideo.js +33 -0
- package/dist/cjs/video/OffthreadVideoForRendering.d.ts +3 -0
- package/dist/cjs/video/OffthreadVideoForRendering.js +104 -0
- package/dist/cjs/video/Video.d.ts +8 -0
- package/dist/cjs/video/Video.js +50 -0
- package/dist/cjs/video/VideoForDevelopment.d.ts +11 -0
- package/dist/cjs/video/VideoForDevelopment.js +113 -0
- package/dist/cjs/video/VideoForRendering.d.ts +10 -0
- package/dist/cjs/video/VideoForRendering.js +203 -0
- package/dist/cjs/video/duration-state.d.ts +17 -0
- package/dist/cjs/video/duration-state.js +34 -0
- package/dist/cjs/video/get-current-time.d.ts +13 -0
- package/dist/cjs/video/get-current-time.js +31 -0
- package/dist/cjs/video/index.d.ts +3 -0
- package/dist/cjs/video/index.js +7 -0
- package/dist/cjs/video/props.d.ts +25 -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 +8 -0
- package/dist/cjs/video-config.js +2 -0
- package/dist/cjs/volume-position-state.d.ts +19 -0
- package/dist/cjs/volume-position-state.js +32 -0
- package/dist/cjs/volume-prop.d.ts +7 -0
- package/dist/cjs/volume-prop.js +24 -0
- package/dist/cjs/warn-about-non-seekable-media.d.ts +1 -0
- package/dist/cjs/warn-about-non-seekable-media.js +34 -0
- package/dist/cjs/wrap-remotion-context.d.ts +18 -0
- package/dist/cjs/wrap-remotion-context.js +73 -0
- package/dist/esm/AbsoluteFill.d.ts +6 -0
- package/dist/esm/AbsoluteFill.js +25 -0
- package/dist/esm/CanUseRemotionHooks.d.ts +5 -0
- package/dist/esm/CanUseRemotionHooks.js +6 -0
- package/dist/esm/Clipper.d.ts +7 -0
- package/dist/esm/Clipper.js +20 -0
- package/dist/esm/Composition.d.ts +23 -0
- package/dist/esm/Composition.js +108 -0
- package/dist/esm/CompositionManager.d.ts +82 -0
- package/dist/esm/CompositionManager.js +137 -0
- package/dist/esm/Folder.d.ts +15 -0
- package/dist/esm/Folder.js +29 -0
- package/dist/esm/IFrame.d.ts +2 -0
- package/dist/esm/IFrame.js +21 -0
- package/dist/esm/Img.d.ts +2 -0
- package/dist/esm/Img.js +49 -0
- package/dist/esm/NativeLayers.d.ts +13 -0
- package/dist/esm/NativeLayers.js +25 -0
- package/dist/esm/Null.d.ts +2 -0
- package/dist/esm/Null.js +21 -0
- package/dist/esm/RemotionRoot.d.ts +5 -0
- package/dist/esm/RemotionRoot.js +69 -0
- package/dist/esm/Sequence.d.ts +29 -0
- package/dist/esm/Sequence.js +128 -0
- package/dist/esm/Still.d.ts +3 -0
- package/dist/esm/Still.js +5 -0
- package/dist/esm/absolute-src.d.ts +1 -0
- package/dist/esm/absolute-src.js +3 -0
- package/dist/esm/asset-types.d.ts +50 -0
- package/dist/esm/asset-types.js +1 -0
- package/dist/esm/audio/Audio.d.ts +8 -0
- package/dist/esm/audio/Audio.js +49 -0
- package/dist/esm/audio/AudioForDevelopment.d.ts +11 -0
- package/dist/esm/audio/AudioForDevelopment.js +91 -0
- package/dist/esm/audio/AudioForRendering.d.ts +10 -0
- package/dist/esm/audio/AudioForRendering.js +108 -0
- package/dist/esm/audio/index.d.ts +2 -0
- package/dist/esm/audio/index.js +2 -0
- package/dist/esm/audio/props.d.ts +12 -0
- package/dist/esm/audio/props.js +1 -0
- package/dist/esm/audio/shared-audio-tags.d.ts +37 -0
- package/dist/esm/audio/shared-audio-tags.js +194 -0
- package/dist/esm/audio/use-audio-frame.d.ts +6 -0
- package/dist/esm/audio/use-audio-frame.js +18 -0
- package/dist/esm/bezier.d.ts +1 -0
- package/dist/esm/bezier.js +110 -0
- package/dist/esm/cancel-render.d.ts +1 -0
- package/dist/esm/cancel-render.js +39 -0
- package/dist/esm/config/input-props.d.ts +1 -0
- package/dist/esm/config/input-props.js +27 -0
- package/dist/esm/config.d.ts +285 -0
- package/dist/esm/config.js +17 -0
- package/dist/esm/default-css.d.ts +3 -0
- package/dist/esm/default-css.js +44 -0
- package/dist/esm/delay-render.d.ts +14 -0
- package/dist/esm/delay-render.js +72 -0
- package/dist/esm/easing.d.ts +19 -0
- package/dist/esm/easing.js +73 -0
- package/dist/esm/freeze.d.ts +7 -0
- package/dist/esm/freeze.js +30 -0
- package/dist/esm/get-asset-file-name.d.ts +1 -0
- package/dist/esm/get-asset-file-name.js +10 -0
- package/dist/esm/get-environment.d.ts +3 -0
- package/dist/esm/get-environment.js +29 -0
- package/dist/esm/get-preview-dom-element.d.ts +1 -0
- package/dist/esm/get-preview-dom-element.js +3 -0
- package/dist/esm/get-static-files.d.ts +17 -0
- package/dist/esm/get-static-files.js +27 -0
- package/dist/esm/get-timeline-clip-name.d.ts +1 -0
- package/dist/esm/get-timeline-clip-name.js +21 -0
- package/dist/esm/index.d.ts +92 -0
- package/dist/esm/index.js +41 -0
- package/dist/esm/internals.d.ts +99 -0
- package/dist/esm/internals.js +75 -0
- package/dist/esm/interpolate-colors.d.ts +5 -0
- package/dist/esm/interpolate-colors.js +397 -0
- package/dist/esm/interpolate.d.ts +18 -0
- package/dist/esm/interpolate.js +119 -0
- package/dist/esm/is-approximately-the-same.d.ts +1 -0
- package/dist/esm/is-approximately-the-same.js +4 -0
- package/dist/esm/is-player.d.ts +3 -0
- package/dist/esm/is-player.js +9 -0
- package/dist/esm/loading-indicator.d.ts +2 -0
- package/dist/esm/loading-indicator.js +31 -0
- package/dist/esm/loop/index.d.ts +9 -0
- package/dist/esm/loop/index.js +25 -0
- package/dist/esm/multiple-versions-warning.d.ts +1 -0
- package/dist/esm/multiple-versions-warning.js +28 -0
- package/dist/esm/nonce.d.ts +7 -0
- package/dist/esm/nonce.js +13 -0
- package/dist/esm/play-and-handle-not-allowed-error.d.ts +2 -0
- package/dist/esm/play-and-handle-not-allowed-error.js +40 -0
- package/dist/esm/portal-node.d.ts +1 -0
- package/dist/esm/portal-node.js +19 -0
- package/dist/esm/prefetch-state.d.ts +8 -0
- package/dist/esm/prefetch-state.js +22 -0
- package/dist/esm/prefetch.d.ts +9 -0
- package/dist/esm/prefetch.js +103 -0
- package/dist/esm/random.d.ts +7 -0
- package/dist/esm/random.js +38 -0
- package/dist/esm/register-root.d.ts +4 -0
- package/dist/esm/register-root.js +27 -0
- package/dist/esm/series/flatten-children.d.ts +2 -0
- package/dist/esm/series/flatten-children.js +12 -0
- package/dist/esm/series/index.d.ts +13 -0
- package/dist/esm/series/index.js +57 -0
- package/dist/esm/setup-env-variables.d.ts +2 -0
- package/dist/esm/setup-env-variables.js +32 -0
- package/dist/esm/spring/index.d.ts +27 -0
- package/dist/esm/spring/index.js +50 -0
- package/dist/esm/spring/measure-spring.d.ts +8 -0
- package/dist/esm/spring/measure-spring.js +60 -0
- package/dist/esm/spring/spring-utils.d.ts +21 -0
- package/dist/esm/spring/spring-utils.js +99 -0
- package/dist/esm/static-file.d.ts +5 -0
- package/dist/esm/static-file.js +29 -0
- package/dist/esm/test/Img.test.d.ts +1 -0
- package/dist/esm/test/Img.test.js +20 -0
- package/dist/esm/test/absolute-src.test.d.ts +1 -0
- package/dist/esm/test/absolute-src.test.js +16 -0
- package/dist/esm/test/audio-for-rendering.test.d.ts +1 -0
- package/dist/esm/test/audio-for-rendering.test.js +83 -0
- package/dist/esm/test/audio.test.d.ts +1 -0
- package/dist/esm/test/audio.test.js +51 -0
- package/dist/esm/test/bezier.test.d.ts +1 -0
- package/dist/esm/test/bezier.test.js +50 -0
- package/dist/esm/test/composition-rules.test.d.ts +1 -0
- package/dist/esm/test/composition-rules.test.js +28 -0
- package/dist/esm/test/composition-validation.test.d.ts +1 -0
- package/dist/esm/test/composition-validation.test.js +97 -0
- package/dist/esm/test/easing.test.d.ts +1 -0
- package/dist/esm/test/easing.test.js +189 -0
- package/dist/esm/test/expect-to-throw.d.ts +1 -0
- package/dist/esm/test/expect-to-throw.js +11 -0
- package/dist/esm/test/freeze.test.d.ts +1 -0
- package/dist/esm/test/freeze.test.js +63 -0
- package/dist/esm/test/get-asset-file-name.test.d.ts +1 -0
- package/dist/esm/test/get-asset-file-name.test.js +12 -0
- package/dist/esm/test/get-current-time.test.d.ts +1 -0
- package/dist/esm/test/get-current-time.test.js +72 -0
- package/dist/esm/test/input-props.test.d.ts +1 -0
- package/dist/esm/test/input-props.test.js +29 -0
- package/dist/esm/test/interpolate.test.d.ts +1 -0
- package/dist/esm/test/interpolate.test.js +136 -0
- package/dist/esm/test/interpolateColors.test.d.ts +1 -0
- package/dist/esm/test/interpolateColors.test.js +61 -0
- package/dist/esm/test/loop-validation.test.d.ts +1 -0
- package/dist/esm/test/loop-validation.test.js +68 -0
- package/dist/esm/test/measure-spring.test.d.ts +1 -0
- package/dist/esm/test/measure-spring.test.js +43 -0
- package/dist/esm/test/media-validation.test.d.ts +1 -0
- package/dist/esm/test/media-validation.test.js +45 -0
- package/dist/esm/test/nested-sequences.test.d.ts +1 -0
- package/dist/esm/test/nested-sequences.test.js +130 -0
- package/dist/esm/test/not-all-props-in-media-tags.test.d.ts +1 -0
- package/dist/esm/test/not-all-props-in-media-tags.test.js +28 -0
- package/dist/esm/test/random.test.d.ts +1 -0
- package/dist/esm/test/random.test.js +58 -0
- package/dist/esm/test/ready-manager.test.d.ts +1 -0
- package/dist/esm/test/ready-manager.test.js +27 -0
- package/dist/esm/test/render-hook.d.ts +23 -0
- package/dist/esm/test/render-hook.js +20 -0
- package/dist/esm/test/sequence-from-initial-offset.test.d.ts +4 -0
- package/dist/esm/test/sequence-from-initial-offset.test.js +33 -0
- package/dist/esm/test/sequence-validation.test.d.ts +1 -0
- package/dist/esm/test/sequence-validation.test.js +45 -0
- package/dist/esm/test/series.test.d.ts +1 -0
- package/dist/esm/test/series.test.js +113 -0
- package/dist/esm/test/spring.test.d.ts +1 -0
- package/dist/esm/test/spring.test.js +36 -0
- package/dist/esm/test/truthy.test.d.ts +1 -0
- package/dist/esm/test/truthy.test.js +22 -0
- package/dist/esm/test/use-audio-frame.test.d.ts +1 -0
- package/dist/esm/test/use-audio-frame.test.js +53 -0
- package/dist/esm/test/use-media-in-timeline.test.d.ts +1 -0
- package/dist/esm/test/use-media-in-timeline.test.js +49 -0
- package/dist/esm/test/use-media-tag-volume.test.d.ts +1 -0
- package/dist/esm/test/use-media-tag-volume.test.js +44 -0
- package/dist/esm/test/use-sync-volume-with-media-tag.test.d.ts +1 -0
- package/dist/esm/test/use-sync-volume-with-media-tag.test.js +53 -0
- package/dist/esm/test/validate-start-from-props.test.d.ts +1 -0
- package/dist/esm/test/validate-start-from-props.test.js +37 -0
- package/dist/esm/test/video.test.d.ts +1 -0
- package/dist/esm/test/video.test.js +55 -0
- package/dist/esm/test/volume-prop.test.d.ts +1 -0
- package/dist/esm/test/volume-prop.test.js +93 -0
- package/dist/esm/test/wrap-sequence-context.d.ts +6 -0
- package/dist/esm/test/wrap-sequence-context.js +37 -0
- package/dist/esm/timeline-position-state.d.ts +29 -0
- package/dist/esm/timeline-position-state.js +35 -0
- package/dist/esm/truthy.d.ts +3 -0
- package/dist/esm/truthy.js +3 -0
- package/dist/esm/use-current-frame.d.ts +6 -0
- package/dist/esm/use-current-frame.js +24 -0
- package/dist/esm/use-lazy-component.d.ts +7 -0
- package/dist/esm/use-lazy-component.js +22 -0
- package/dist/esm/use-media-in-timeline.d.ts +10 -0
- package/dist/esm/use-media-in-timeline.js +125 -0
- package/dist/esm/use-media-playback.d.ts +10 -0
- package/dist/esm/use-media-playback.js +73 -0
- package/dist/esm/use-media-tag-volume.d.ts +2 -0
- package/dist/esm/use-media-tag-volume.js +27 -0
- package/dist/esm/use-sync-volume-with-media-tag.d.ts +10 -0
- package/dist/esm/use-sync-volume-with-media-tag.js +17 -0
- package/dist/esm/use-unsafe-video-config.d.ts +2 -0
- package/dist/esm/use-unsafe-video-config.js +23 -0
- package/dist/esm/use-video-config.d.ts +7 -0
- package/dist/esm/use-video-config.js +25 -0
- package/dist/esm/use-video.d.ts +13 -0
- package/dist/esm/use-video.js +24 -0
- package/dist/esm/validate-frame.d.ts +1 -0
- package/dist/esm/validate-frame.js +20 -0
- package/dist/esm/validate-media-props.d.ts +4 -0
- package/dist/esm/validate-media-props.js +20 -0
- package/dist/esm/validate-start-from-props.d.ts +1 -0
- package/dist/esm/validate-start-from-props.js +27 -0
- package/dist/esm/validation/validate-composition-id.d.ts +3 -0
- package/dist/esm/validation/validate-composition-id.js +8 -0
- package/dist/esm/validation/validate-dimensions.d.ts +1 -0
- package/dist/esm/validation/validate-dimensions.js +17 -0
- package/dist/esm/validation/validate-duration-in-frames.d.ts +1 -0
- package/dist/esm/validation/validate-duration-in-frames.js +11 -0
- package/dist/esm/validation/validate-folder-name.d.ts +3 -0
- package/dist/esm/validation/validate-folder-name.js +14 -0
- package/dist/esm/validation/validate-fps.d.ts +1 -0
- package/dist/esm/validation/validate-fps.js +17 -0
- package/dist/esm/validation/validate-offthreadvideo-image-format.d.ts +1 -0
- package/dist/esm/validation/validate-offthreadvideo-image-format.js +11 -0
- package/dist/esm/validation/validation-spring-duration.d.ts +1 -0
- package/dist/esm/validation/validation-spring-duration.js +17 -0
- package/dist/esm/version.d.ts +1 -0
- package/dist/esm/version.js +2 -0
- package/dist/esm/video/OffthreadVideo.d.ts +3 -0
- package/dist/esm/video/OffthreadVideo.js +29 -0
- package/dist/esm/video/OffthreadVideoForRendering.d.ts +3 -0
- package/dist/esm/video/OffthreadVideoForRendering.js +100 -0
- package/dist/esm/video/Video.d.ts +8 -0
- package/dist/esm/video/Video.js +47 -0
- package/dist/esm/video/VideoForDevelopment.d.ts +11 -0
- package/dist/esm/video/VideoForDevelopment.js +110 -0
- package/dist/esm/video/VideoForRendering.d.ts +10 -0
- package/dist/esm/video/VideoForRendering.js +200 -0
- package/dist/esm/video/duration-state.d.ts +17 -0
- package/dist/esm/video/duration-state.js +29 -0
- package/dist/esm/video/get-current-time.d.ts +13 -0
- package/dist/esm/video/get-current-time.js +26 -0
- package/dist/esm/video/index.d.ts +3 -0
- package/dist/esm/video/index.js +2 -0
- package/dist/esm/video/props.d.ts +25 -0
- package/dist/esm/video/props.js +1 -0
- package/dist/esm/video/video-fragment.d.ts +12 -0
- package/dist/esm/video/video-fragment.js +55 -0
- package/dist/esm/video-config.d.ts +8 -0
- package/dist/esm/video-config.js +1 -0
- package/dist/esm/volume-position-state.d.ts +19 -0
- package/dist/esm/volume-position-state.js +27 -0
- package/dist/esm/volume-prop.d.ts +7 -0
- package/dist/esm/volume-prop.js +20 -0
- package/dist/esm/warn-about-non-seekable-media.d.ts +1 -0
- package/dist/esm/warn-about-non-seekable-media.js +30 -0
- package/dist/esm/wrap-remotion-context.d.ts +18 -0
- package/dist/esm/wrap-remotion-context.js +45 -0
- package/dist/internals.d.ts +0 -1
- package/dist/series/index.js +5 -2
- package/dist/tsconfig-cjs.tsbuildinfo +1 -0
- package/dist/use-video.d.ts +0 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/video/Video.d.ts +1 -1
- package/dist/video/VideoForDevelopment.d.ts +1 -1
- package/dist/video/VideoForRendering.d.ts +1 -1
- package/package.json +23 -12
- package/tsconfig-cjs.json +11 -0
- package/tsconfig.json +3 -3
- package/dist/LayerMaster.d.ts +0 -8
- package/dist/LayerMaster.js +0 -39
- package/dist/Satori.d.ts +0 -5
- package/dist/Satori.js +0 -92
- package/dist/get-compositions-from-markup.d.ts +0 -3
- package/dist/get-compositions-from-markup.js +0 -19
- package/dist/layers.d.ts +0 -24
- package/dist/layers.js +0 -149
- package/dist/video/NativeVideo.d.ts +0 -5
- package/dist/video/NativeVideo.js +0 -33
- package/dist/video/NativeVideoForRendering.d.ts +0 -8
- package/dist/video/NativeVideoForRendering.js +0 -14
|
@@ -0,0 +1,113 @@
|
|
|
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_js_1 = require("../audio/use-audio-frame.js");
|
|
7
|
+
const prefetch_js_1 = require("../prefetch.js");
|
|
8
|
+
const Sequence_js_1 = require("../Sequence.js");
|
|
9
|
+
const use_media_in_timeline_js_1 = require("../use-media-in-timeline.js");
|
|
10
|
+
const use_media_playback_js_1 = require("../use-media-playback.js");
|
|
11
|
+
const use_media_tag_volume_js_1 = require("../use-media-tag-volume.js");
|
|
12
|
+
const use_sync_volume_with_media_tag_js_1 = require("../use-sync-volume-with-media-tag.js");
|
|
13
|
+
const use_video_config_js_1 = require("../use-video-config.js");
|
|
14
|
+
const volume_position_state_js_1 = require("../volume-position-state.js");
|
|
15
|
+
const video_fragment_js_1 = require("./video-fragment.js");
|
|
16
|
+
const VideoForDevelopmentRefForwardingFunction = (props, ref) => {
|
|
17
|
+
var _a, _b;
|
|
18
|
+
const videoRef = (0, react_1.useRef)(null);
|
|
19
|
+
const volumePropFrame = (0, use_audio_frame_js_1.useFrameForVolumeProp)();
|
|
20
|
+
const { fps, durationInFrames } = (0, use_video_config_js_1.useVideoConfig)();
|
|
21
|
+
const parentSequence = (0, react_1.useContext)(Sequence_js_1.SequenceContext);
|
|
22
|
+
const { volume, muted, playbackRate, onlyWarnForMediaSeekingError, src, onDuration,
|
|
23
|
+
// @ts-expect-error
|
|
24
|
+
acceptableTimeShift, acceptableTimeShiftInSeconds, ...nativeProps } = props;
|
|
25
|
+
if (typeof acceptableTimeShift !== 'undefined') {
|
|
26
|
+
throw new Error('acceptableTimeShift has been removed. Use acceptableTimeShiftInSeconds instead.');
|
|
27
|
+
}
|
|
28
|
+
const actualVolume = (0, use_media_tag_volume_js_1.useMediaTagVolume)(videoRef);
|
|
29
|
+
const [mediaVolume] = (0, volume_position_state_js_1.useMediaVolumeState)();
|
|
30
|
+
const [mediaMuted] = (0, volume_position_state_js_1.useMediaMutedState)();
|
|
31
|
+
(0, use_media_in_timeline_js_1.useMediaInTimeline)({
|
|
32
|
+
mediaRef: videoRef,
|
|
33
|
+
volume,
|
|
34
|
+
mediaVolume,
|
|
35
|
+
mediaType: 'video',
|
|
36
|
+
src,
|
|
37
|
+
playbackRate: (_a = props.playbackRate) !== null && _a !== void 0 ? _a : 1,
|
|
38
|
+
});
|
|
39
|
+
(0, use_sync_volume_with_media_tag_js_1.useSyncVolumeWithMediaTag)({
|
|
40
|
+
volumePropFrame,
|
|
41
|
+
actualVolume,
|
|
42
|
+
volume,
|
|
43
|
+
mediaVolume,
|
|
44
|
+
mediaRef: videoRef,
|
|
45
|
+
});
|
|
46
|
+
(0, use_media_playback_js_1.useMediaPlayback)({
|
|
47
|
+
mediaRef: videoRef,
|
|
48
|
+
src,
|
|
49
|
+
mediaType: 'video',
|
|
50
|
+
playbackRate: (_b = props.playbackRate) !== null && _b !== void 0 ? _b : 1,
|
|
51
|
+
onlyWarnForMediaSeekingError,
|
|
52
|
+
acceptableTimeshift: acceptableTimeShiftInSeconds !== null && acceptableTimeShiftInSeconds !== void 0 ? acceptableTimeShiftInSeconds : use_media_playback_js_1.DEFAULT_ACCEPTABLE_TIMESHIFT,
|
|
53
|
+
});
|
|
54
|
+
const actualFrom = parentSequence
|
|
55
|
+
? parentSequence.relativeFrom + parentSequence.cumulatedFrom
|
|
56
|
+
: 0;
|
|
57
|
+
const duration = parentSequence
|
|
58
|
+
? Math.min(parentSequence.durationInFrames, durationInFrames)
|
|
59
|
+
: durationInFrames;
|
|
60
|
+
const actualSrc = (0, video_fragment_js_1.useAppendVideoFragment)({
|
|
61
|
+
actualSrc: (0, prefetch_js_1.usePreload)(src),
|
|
62
|
+
actualFrom,
|
|
63
|
+
duration,
|
|
64
|
+
fps,
|
|
65
|
+
});
|
|
66
|
+
(0, react_1.useImperativeHandle)(ref, () => {
|
|
67
|
+
return videoRef.current;
|
|
68
|
+
}, []);
|
|
69
|
+
(0, react_1.useEffect)(() => {
|
|
70
|
+
const { current } = videoRef;
|
|
71
|
+
if (!current) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
const errorHandler = () => {
|
|
75
|
+
var _a;
|
|
76
|
+
if (current === null || current === void 0 ? void 0 : current.error) {
|
|
77
|
+
console.error('Error occurred in video', current === null || current === void 0 ? void 0 : current.error);
|
|
78
|
+
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`);
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
throw new Error('The browser threw an error');
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
current.addEventListener('error', errorHandler, { once: true });
|
|
85
|
+
return () => {
|
|
86
|
+
current.removeEventListener('error', errorHandler);
|
|
87
|
+
};
|
|
88
|
+
}, [src]);
|
|
89
|
+
const currentOnDurationCallback = (0, react_1.useRef)();
|
|
90
|
+
currentOnDurationCallback.current = onDuration;
|
|
91
|
+
(0, react_1.useEffect)(() => {
|
|
92
|
+
var _a;
|
|
93
|
+
const { current } = videoRef;
|
|
94
|
+
if (!current) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
if (current.duration) {
|
|
98
|
+
(_a = currentOnDurationCallback.current) === null || _a === void 0 ? void 0 : _a.call(currentOnDurationCallback, src, current.duration);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
const onLoadedMetadata = () => {
|
|
102
|
+
var _a;
|
|
103
|
+
(_a = currentOnDurationCallback.current) === null || _a === void 0 ? void 0 : _a.call(currentOnDurationCallback, src, current.duration);
|
|
104
|
+
};
|
|
105
|
+
current.addEventListener('loadedmetadata', onLoadedMetadata);
|
|
106
|
+
return () => {
|
|
107
|
+
current.removeEventListener('loadedmetadata', onLoadedMetadata);
|
|
108
|
+
};
|
|
109
|
+
}, [src]);
|
|
110
|
+
return ((0, jsx_runtime_1.jsx)("video", { ref: videoRef, muted: muted || mediaMuted, playsInline: true, src: actualSrc, ...nativeProps }));
|
|
111
|
+
};
|
|
112
|
+
// Copy types from forwardRef but not necessary to remove ref
|
|
113
|
+
exports.VideoForDevelopment = (0, react_1.forwardRef)(VideoForDevelopmentRefForwardingFunction);
|
|
@@ -0,0 +1,10 @@
|
|
|
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>, "nonce" | "onEnded" | "autoPlay" | "controls"> & {
|
|
4
|
+
volume?: import("../volume-prop.js").VolumeProp | undefined;
|
|
5
|
+
playbackRate?: number | undefined;
|
|
6
|
+
acceptableTimeShiftInSeconds?: number | undefined;
|
|
7
|
+
allowAmplificationDuringRender?: boolean | undefined;
|
|
8
|
+
} & {
|
|
9
|
+
onDuration: (src: string, durationInSeconds: number) => void;
|
|
10
|
+
} & RefAttributes<HTMLVideoElement>>;
|
|
@@ -0,0 +1,203 @@
|
|
|
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 use_audio_frame_js_1 = require("../audio/use-audio-frame.js");
|
|
8
|
+
const CompositionManager_js_1 = require("../CompositionManager.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 Sequence_js_1 = require("../Sequence.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)(Sequence_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)(CompositionManager_js_1.CompositionManager);
|
|
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
|
+
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`);
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
throw new Error('The browser threw an error');
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
current.addEventListener('error', errorHandler, { once: true });
|
|
156
|
+
// If video skips to another frame or unmounts, we clear the created handle
|
|
157
|
+
return () => {
|
|
158
|
+
current.removeEventListener('ended', endedHandler);
|
|
159
|
+
current.removeEventListener('error', errorHandler);
|
|
160
|
+
current.removeEventListener('seeked', seekedHandler);
|
|
161
|
+
(0, delay_render_js_1.continueRender)(handle);
|
|
162
|
+
};
|
|
163
|
+
}, [
|
|
164
|
+
volumePropsFrame,
|
|
165
|
+
props.src,
|
|
166
|
+
playbackRate,
|
|
167
|
+
videoConfig.fps,
|
|
168
|
+
frame,
|
|
169
|
+
mediaStartsAt,
|
|
170
|
+
]);
|
|
171
|
+
const { src } = props;
|
|
172
|
+
// If video source switches, make new handle
|
|
173
|
+
if (environment === 'rendering') {
|
|
174
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
175
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
176
|
+
if (process.env.NODE_ENV === 'test') {
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
const newHandle = (0, delay_render_js_1.delayRender)('Loading <Video> duration with src=' + src);
|
|
180
|
+
const { current } = videoRef;
|
|
181
|
+
const didLoad = () => {
|
|
182
|
+
if (current === null || current === void 0 ? void 0 : current.duration) {
|
|
183
|
+
onDuration(src, current.duration);
|
|
184
|
+
}
|
|
185
|
+
(0, delay_render_js_1.continueRender)(newHandle);
|
|
186
|
+
};
|
|
187
|
+
if (current === null || current === void 0 ? void 0 : current.duration) {
|
|
188
|
+
onDuration(src, current.duration);
|
|
189
|
+
(0, delay_render_js_1.continueRender)(newHandle);
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
current === null || current === void 0 ? void 0 : current.addEventListener('loadedmetadata', didLoad, { once: true });
|
|
193
|
+
}
|
|
194
|
+
// If tag gets unmounted, clear pending handles because video metadata is not going to load
|
|
195
|
+
return () => {
|
|
196
|
+
current === null || current === void 0 ? void 0 : current.removeEventListener('loadedmetadata', didLoad);
|
|
197
|
+
(0, delay_render_js_1.continueRender)(newHandle);
|
|
198
|
+
};
|
|
199
|
+
}, [src, onDuration]);
|
|
200
|
+
}
|
|
201
|
+
return (0, jsx_runtime_1.jsx)("video", { ref: videoRef, ...props, onError: onError });
|
|
202
|
+
};
|
|
203
|
+
exports.VideoForRendering = (0, react_1.forwardRef)(VideoForRenderingForwardFunction);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare type DurationState = Record<string, number>;
|
|
3
|
+
declare type DurationAction = {
|
|
4
|
+
type: 'got-duration';
|
|
5
|
+
src: string;
|
|
6
|
+
durationInSeconds: number;
|
|
7
|
+
};
|
|
8
|
+
export declare const durationReducer: (state: DurationState, action: DurationAction) => DurationState;
|
|
9
|
+
declare 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,34 @@
|
|
|
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 durationReducer = (state, action) => {
|
|
7
|
+
switch (action.type) {
|
|
8
|
+
case 'got-duration':
|
|
9
|
+
return {
|
|
10
|
+
...state,
|
|
11
|
+
[action.src]: action.durationInSeconds,
|
|
12
|
+
};
|
|
13
|
+
default:
|
|
14
|
+
return state;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
exports.durationReducer = durationReducer;
|
|
18
|
+
exports.DurationsContext = (0, react_1.createContext)({
|
|
19
|
+
durations: {},
|
|
20
|
+
setDurations: () => {
|
|
21
|
+
throw new Error('context missing');
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
const DurationsContextProvider = ({ children }) => {
|
|
25
|
+
const [durations, setDurations] = (0, react_1.useReducer)(exports.durationReducer, {});
|
|
26
|
+
const value = (0, react_1.useMemo)(() => {
|
|
27
|
+
return {
|
|
28
|
+
durations,
|
|
29
|
+
setDurations,
|
|
30
|
+
};
|
|
31
|
+
}, [durations]);
|
|
32
|
+
return ((0, jsx_runtime_1.jsx)(exports.DurationsContext.Provider, { value: value, children: children }));
|
|
33
|
+
};
|
|
34
|
+
exports.DurationsContextProvider = DurationsContextProvider;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const getExpectedMediaFrameUncorrected: ({ frame, playbackRate, startFrom, }: {
|
|
2
|
+
frame: number;
|
|
3
|
+
playbackRate: number;
|
|
4
|
+
startFrom: number;
|
|
5
|
+
}) => number;
|
|
6
|
+
export declare const getMediaTime: ({ fps, frame, src, playbackRate, startFrom, mediaType, }: {
|
|
7
|
+
fps: number;
|
|
8
|
+
frame: number;
|
|
9
|
+
src: string;
|
|
10
|
+
playbackRate: number;
|
|
11
|
+
startFrom: number;
|
|
12
|
+
mediaType: 'video' | 'audio';
|
|
13
|
+
}) => number;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Calculate the `.currentTime` of a video or audio element
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.getMediaTime = exports.getExpectedMediaFrameUncorrected = void 0;
|
|
5
|
+
const interpolate_js_1 = require("../interpolate.js");
|
|
6
|
+
const getExpectedMediaFrameUncorrected = ({ frame, playbackRate, startFrom, }) => {
|
|
7
|
+
return (0, interpolate_js_1.interpolate)(frame, [-1, startFrom, startFrom + 1], [-1, startFrom, startFrom + playbackRate]);
|
|
8
|
+
};
|
|
9
|
+
exports.getExpectedMediaFrameUncorrected = getExpectedMediaFrameUncorrected;
|
|
10
|
+
const getMediaTime = ({ fps, frame, src, playbackRate, startFrom, mediaType, }) => {
|
|
11
|
+
const expectedFrame = (0, exports.getExpectedMediaFrameUncorrected)({
|
|
12
|
+
frame,
|
|
13
|
+
playbackRate,
|
|
14
|
+
startFrom,
|
|
15
|
+
});
|
|
16
|
+
if (src.endsWith('webm')) {
|
|
17
|
+
// For WebM videos, we need to add a little bit of shift to get the right frame.
|
|
18
|
+
const msPerFrame = 1000 / fps;
|
|
19
|
+
const msShift = msPerFrame / 2;
|
|
20
|
+
return (expectedFrame * msPerFrame + msShift) / 1000;
|
|
21
|
+
}
|
|
22
|
+
if (mediaType === 'video') {
|
|
23
|
+
// In Chrome, for MP4s, if 30fps, the first frame is still displayed at 0.033333
|
|
24
|
+
// even though after that it increases by 0.033333333 each.
|
|
25
|
+
// So frame = 0 in Remotion is like frame = 1 for the browser
|
|
26
|
+
return (expectedFrame + 1) / fps;
|
|
27
|
+
}
|
|
28
|
+
// For audio, we don't do any shift correction
|
|
29
|
+
return expectedFrame / fps;
|
|
30
|
+
};
|
|
31
|
+
exports.getMediaTime = getMediaTime;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Video = exports.OffthreadVideo = void 0;
|
|
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,25 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { VolumeProp } from '../volume-prop.js';
|
|
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' | 'onEnded' | 'nonce'> & {
|
|
8
|
+
volume?: VolumeProp;
|
|
9
|
+
playbackRate?: number;
|
|
10
|
+
acceptableTimeShiftInSeconds?: number;
|
|
11
|
+
allowAmplificationDuringRender?: boolean;
|
|
12
|
+
};
|
|
13
|
+
export declare type OffthreadVideoImageFormat = 'png' | 'jpeg';
|
|
14
|
+
export declare type OffthreadVideoProps = {
|
|
15
|
+
src: string;
|
|
16
|
+
className?: string;
|
|
17
|
+
style?: React.CSSProperties;
|
|
18
|
+
volume?: VolumeProp;
|
|
19
|
+
playbackRate?: number;
|
|
20
|
+
muted?: boolean;
|
|
21
|
+
onError?: React.ReactEventHandler<HTMLVideoElement | HTMLImageElement>;
|
|
22
|
+
imageFormat?: OffthreadVideoImageFormat;
|
|
23
|
+
acceptableTimeShiftInSeconds?: number;
|
|
24
|
+
allowAmplificationDuringRender?: boolean;
|
|
25
|
+
};
|
|
@@ -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;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare type MediaVolumeContextValue = {
|
|
3
|
+
mediaMuted: boolean;
|
|
4
|
+
mediaVolume: number;
|
|
5
|
+
};
|
|
6
|
+
export declare type SetMediaVolumeContextValue = {
|
|
7
|
+
setMediaMuted: (u: React.SetStateAction<boolean>) => void;
|
|
8
|
+
setMediaVolume: (u: number) => void;
|
|
9
|
+
};
|
|
10
|
+
export declare const MediaVolumeContext: import("react").Context<MediaVolumeContextValue>;
|
|
11
|
+
export declare const SetMediaVolumeContext: import("react").Context<SetMediaVolumeContextValue>;
|
|
12
|
+
declare type MediaVolumeReturnType = readonly [number, (u: number) => void];
|
|
13
|
+
export declare const useMediaVolumeState: () => MediaVolumeReturnType;
|
|
14
|
+
declare type MediaMutedReturnType = readonly [
|
|
15
|
+
boolean,
|
|
16
|
+
(u: React.SetStateAction<boolean>) => void
|
|
17
|
+
];
|
|
18
|
+
export declare const useMediaMutedState: () => MediaMutedReturnType;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useMediaMutedState = exports.useMediaVolumeState = exports.SetMediaVolumeContext = exports.MediaVolumeContext = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
exports.MediaVolumeContext = (0, react_1.createContext)({
|
|
6
|
+
mediaMuted: false,
|
|
7
|
+
mediaVolume: 1,
|
|
8
|
+
});
|
|
9
|
+
exports.SetMediaVolumeContext = (0, react_1.createContext)({
|
|
10
|
+
setMediaMuted: () => {
|
|
11
|
+
throw new Error('default');
|
|
12
|
+
},
|
|
13
|
+
setMediaVolume: () => {
|
|
14
|
+
throw new Error('default');
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
const useMediaVolumeState = () => {
|
|
18
|
+
const { mediaVolume } = (0, react_1.useContext)(exports.MediaVolumeContext);
|
|
19
|
+
const { setMediaVolume } = (0, react_1.useContext)(exports.SetMediaVolumeContext);
|
|
20
|
+
return (0, react_1.useMemo)(() => {
|
|
21
|
+
return [mediaVolume, setMediaVolume];
|
|
22
|
+
}, [mediaVolume, setMediaVolume]);
|
|
23
|
+
};
|
|
24
|
+
exports.useMediaVolumeState = useMediaVolumeState;
|
|
25
|
+
const useMediaMutedState = () => {
|
|
26
|
+
const { mediaMuted } = (0, react_1.useContext)(exports.MediaVolumeContext);
|
|
27
|
+
const { setMediaMuted } = (0, react_1.useContext)(exports.SetMediaVolumeContext);
|
|
28
|
+
return (0, react_1.useMemo)(() => {
|
|
29
|
+
return [mediaMuted, setMediaMuted];
|
|
30
|
+
}, [mediaMuted, setMediaMuted]);
|
|
31
|
+
};
|
|
32
|
+
exports.useMediaMutedState = useMediaMutedState;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare type VolumeProp = number | ((frame: number) => number);
|
|
2
|
+
export declare const evaluateVolume: ({ frame, volume, mediaVolume, allowAmplificationDuringRender, }: {
|
|
3
|
+
frame: number;
|
|
4
|
+
volume: VolumeProp | undefined;
|
|
5
|
+
mediaVolume: number;
|
|
6
|
+
allowAmplificationDuringRender: boolean;
|
|
7
|
+
}) => number;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.evaluateVolume = void 0;
|
|
4
|
+
const evaluateVolume = ({ frame, volume, mediaVolume = 1, allowAmplificationDuringRender, }) => {
|
|
5
|
+
const maxVolume = allowAmplificationDuringRender ? Infinity : 1;
|
|
6
|
+
if (typeof volume === 'number') {
|
|
7
|
+
return Math.min(maxVolume, volume * mediaVolume);
|
|
8
|
+
}
|
|
9
|
+
if (typeof volume === 'undefined') {
|
|
10
|
+
return Number(mediaVolume);
|
|
11
|
+
}
|
|
12
|
+
const evaluated = volume(frame) * mediaVolume;
|
|
13
|
+
if (typeof evaluated !== 'number') {
|
|
14
|
+
throw new TypeError(`You passed in a a function to the volume prop but it did not return a number but a value of type ${typeof evaluated} for frame ${frame}`);
|
|
15
|
+
}
|
|
16
|
+
if (Number.isNaN(evaluated)) {
|
|
17
|
+
throw new TypeError(`You passed in a function to the volume prop but it returned NaN for frame ${frame}.`);
|
|
18
|
+
}
|
|
19
|
+
if (!Number.isFinite(evaluated)) {
|
|
20
|
+
throw new TypeError(`You passed in a function to the volume prop but it returned a non-finite number for frame ${frame}.`);
|
|
21
|
+
}
|
|
22
|
+
return Math.max(0, Math.min(maxVolume, evaluated));
|
|
23
|
+
};
|
|
24
|
+
exports.evaluateVolume = evaluateVolume;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const warnAboutNonSeekableMedia: (ref: HTMLMediaElement | null, type: 'console-warning' | 'console-error' | 'exception') => void;
|