remotion 4.0.0-offthread.9 → 4.0.0-prefetch.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +5 -5
- package/README.md +30 -19
- package/dist/AbsoluteFill.d.ts +6 -2
- package/dist/AbsoluteFill.js +7 -3
- package/dist/CanUseRemotionHooks.d.ts +5 -0
- package/dist/CanUseRemotionHooks.js +10 -0
- package/dist/Composition.d.ts +3 -6
- package/dist/Composition.js +40 -28
- package/dist/CompositionManager.d.ts +6 -11
- package/dist/CompositionManager.js +9 -3
- package/dist/Folder.d.ts +15 -0
- package/dist/Folder.js +33 -0
- package/dist/Img.js +9 -4
- package/dist/{sequencing/index.d.ts → Sequence.d.ts} +13 -3
- package/dist/{sequencing/index.js → Sequence.js} +40 -34
- package/dist/Still.d.ts +1 -1
- package/dist/asset-types.d.ts +1 -4
- package/dist/audio/Audio.d.ts +3 -3
- package/dist/audio/Audio.js +3 -3
- package/dist/audio/AudioForDevelopment.d.ts +3 -2
- package/dist/audio/AudioForDevelopment.js +18 -5
- package/dist/audio/AudioForRendering.d.ts +5 -2
- package/dist/audio/AudioForRendering.js +14 -7
- package/dist/audio/props.d.ts +1 -1
- package/dist/audio/shared-audio-tags.d.ts +4 -3
- package/dist/audio/shared-audio-tags.js +109 -40
- package/dist/audio/use-audio-frame.js +4 -4
- package/dist/config/bundle-out-dir.d.ts +2 -0
- package/dist/config/bundle-out-dir.js +12 -0
- package/dist/config/input-props.js +12 -14
- package/dist/config/public-path.d.ts +2 -0
- package/dist/config/public-path.js +12 -0
- package/dist/{config/index.d.ts → config.d.ts} +68 -20
- package/dist/config.js +21 -0
- package/dist/default-css.d.ts +1 -0
- package/dist/default-css.js +9 -2
- package/dist/delay-render.js +4 -4
- package/dist/freeze.d.ts +2 -2
- package/dist/freeze.js +2 -2
- package/dist/get-timeline-clip-name.js +2 -1
- package/dist/index.d.ts +22 -8
- package/dist/index.js +13 -8
- package/dist/internals.d.ts +36 -100
- package/dist/internals.js +13 -92
- package/dist/{interpolateColors.d.ts → interpolate-colors.d.ts} +0 -0
- package/dist/{interpolateColors.js → interpolate-colors.js} +0 -0
- package/dist/loading-indicator.d.ts +2 -0
- package/dist/loading-indicator.js +35 -0
- package/dist/loop/index.js +4 -3
- package/dist/multiple-versions-warning.js +18 -4
- package/dist/play-and-handle-not-allowed-error.d.ts +1 -1
- package/dist/portal-node.d.ts +1 -0
- package/dist/portal-node.js +23 -0
- package/dist/preload.d.ts +7 -0
- package/dist/preload.js +83 -0
- package/dist/register-root.d.ts +2 -1
- package/dist/register-root.js +20 -5
- package/dist/series/index.d.ts +2 -2
- package/dist/series/index.js +2 -2
- package/dist/spring/index.d.ts +8 -4
- package/dist/spring/index.js +21 -6
- package/dist/spring/measure-spring.d.ts +1 -1
- package/dist/spring/measure-spring.js +1 -1
- package/dist/static-file.js +6 -0
- package/dist/timeline-position-state.d.ts +1 -1
- package/dist/{use-frame.d.ts → use-current-frame.d.ts} +0 -1
- package/dist/use-current-frame.js +28 -0
- package/dist/use-lazy-component.d.ts +3 -3
- package/dist/use-media-in-timeline.d.ts +2 -2
- package/dist/use-media-in-timeline.js +10 -7
- package/dist/use-media-playback.d.ts +3 -2
- package/dist/use-media-playback.js +9 -6
- package/dist/use-media-tag-volume.d.ts +1 -1
- package/dist/use-sync-volume-with-media-tag.d.ts +2 -2
- package/dist/use-unsafe-video-config.d.ts +1 -1
- package/dist/use-unsafe-video-config.js +2 -2
- package/dist/use-video-config.d.ts +1 -1
- package/dist/use-video-config.js +6 -0
- package/dist/use-video.d.ts +13 -1
- package/dist/use-video.js +16 -3
- package/dist/validate-media-props.d.ts +3 -3
- package/dist/validation/validate-fps.d.ts +1 -1
- package/dist/validation/validate-fps.js +4 -1
- package/dist/validation/validate-offthreadvideo-image-format.d.ts +1 -0
- package/dist/validation/validate-offthreadvideo-image-format.js +15 -0
- package/dist/validation/validation-spring-duration.d.ts +1 -0
- package/dist/validation/validation-spring-duration.js +21 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +5 -0
- package/dist/video/OffthreadVideo.d.ts +1 -1
- package/dist/video/OffthreadVideo.js +5 -3
- package/dist/video/OffthreadVideoForRendering.d.ts +1 -1
- package/dist/video/OffthreadVideoForRendering.js +25 -11
- package/dist/video/Video.d.ts +3 -3
- package/dist/video/Video.js +3 -3
- package/dist/video/VideoForDevelopment.d.ts +7 -2
- package/dist/video/VideoForDevelopment.js +28 -4
- package/dist/video/VideoForRendering.d.ts +5 -2
- package/dist/video/VideoForRendering.js +47 -25
- package/dist/video/get-current-time.d.ts +2 -1
- package/dist/video/get-current-time.js +7 -7
- package/dist/video/index.d.ts +1 -1
- package/dist/video/props.d.ts +4 -2
- package/dist/volume-prop.js +1 -1
- package/dist/warn-about-non-seekable-media.d.ts +1 -1
- package/dist/warn-about-non-seekable-media.js +14 -2
- package/dist/wrap-remotion-context.d.ts +2 -1
- package/dist/wrap-remotion-context.js +7 -3
- package/ensure-correct-version.js +24 -0
- package/package.json +9 -10
- package/version.d.ts +1 -0
- package/version.js +1 -0
- package/.turbo/turbo-lint.log +0 -11
- package/.turbo/turbo-test.log +0 -78
- package/dist/AbsoluteFill.d.ts.map +0 -1
- package/dist/AbsoluteFill.js.map +0 -1
- package/dist/Composition.d.ts.map +0 -1
- package/dist/Composition.js.map +0 -1
- package/dist/CompositionManager.d.ts.map +0 -1
- package/dist/CompositionManager.js.map +0 -1
- package/dist/IFrame.d.ts.map +0 -1
- package/dist/IFrame.js.map +0 -1
- package/dist/Img.d.ts.map +0 -1
- package/dist/Img.js.map +0 -1
- package/dist/RemotionRoot.d.ts.map +0 -1
- package/dist/RemotionRoot.js.map +0 -1
- package/dist/Still.d.ts.map +0 -1
- package/dist/Still.js.map +0 -1
- package/dist/absolute-src.d.ts.map +0 -1
- package/dist/absolute-src.js.map +0 -1
- package/dist/asset-types.d.ts.map +0 -1
- package/dist/asset-types.js.map +0 -1
- package/dist/audio/Audio.d.ts.map +0 -1
- package/dist/audio/Audio.js.map +0 -1
- package/dist/audio/AudioForDevelopment.d.ts.map +0 -1
- package/dist/audio/AudioForDevelopment.js.map +0 -1
- package/dist/audio/AudioForRendering.d.ts.map +0 -1
- package/dist/audio/AudioForRendering.js.map +0 -1
- package/dist/audio/index.d.ts.map +0 -1
- package/dist/audio/index.js.map +0 -1
- package/dist/audio/props.d.ts.map +0 -1
- package/dist/audio/props.js.map +0 -1
- package/dist/audio/shared-audio-tags.d.ts.map +0 -1
- package/dist/audio/shared-audio-tags.js.map +0 -1
- package/dist/audio/use-audio-frame.d.ts.map +0 -1
- package/dist/audio/use-audio-frame.js.map +0 -1
- package/dist/bezier.d.ts.map +0 -1
- package/dist/bezier.js.map +0 -1
- package/dist/compress-assets.d.ts +0 -7
- package/dist/compress-assets.d.ts.map +0 -1
- package/dist/compress-assets.js +0 -25
- package/dist/compress-assets.js.map +0 -1
- package/dist/config/browser-executable.d.ts +0 -3
- package/dist/config/browser-executable.d.ts.map +0 -1
- package/dist/config/browser-executable.js +0 -12
- package/dist/config/browser-executable.js.map +0 -1
- package/dist/config/browser.d.ts +0 -4
- package/dist/config/browser.d.ts.map +0 -1
- package/dist/config/browser.js +0 -19
- package/dist/config/browser.js.map +0 -1
- package/dist/config/chromium-flags.d.ts +0 -10
- package/dist/config/chromium-flags.d.ts.map +0 -1
- package/dist/config/chromium-flags.js +0 -34
- package/dist/config/chromium-flags.js.map +0 -1
- package/dist/config/codec.d.ts +0 -17
- package/dist/config/codec.d.ts.map +0 -1
- package/dist/config/codec.js +0 -103
- package/dist/config/codec.js.map +0 -1
- package/dist/config/concurrency.d.ts +0 -3
- package/dist/config/concurrency.d.ts.map +0 -1
- package/dist/config/concurrency.js +0 -15
- package/dist/config/concurrency.js.map +0 -1
- package/dist/config/crf.d.ts +0 -9
- package/dist/config/crf.d.ts.map +0 -1
- package/dist/config/crf.js +0 -83
- package/dist/config/crf.js.map +0 -1
- package/dist/config/env-file.d.ts +0 -2
- package/dist/config/env-file.d.ts.map +0 -1
- package/dist/config/env-file.js +0 -10
- package/dist/config/env-file.js.map +0 -1
- package/dist/config/ffmpeg-executable.d.ts +0 -3
- package/dist/config/ffmpeg-executable.d.ts.map +0 -1
- package/dist/config/ffmpeg-executable.js +0 -12
- package/dist/config/ffmpeg-executable.js.map +0 -1
- package/dist/config/frame-range.d.ts +0 -5
- package/dist/config/frame-range.d.ts.map +0 -1
- package/dist/config/frame-range.js +0 -80
- package/dist/config/frame-range.js.map +0 -1
- package/dist/config/image-format.d.ts +0 -8
- package/dist/config/image-format.d.ts.map +0 -1
- package/dist/config/image-format.js +0 -37
- package/dist/config/image-format.js.map +0 -1
- package/dist/config/image-sequence.d.ts +0 -3
- package/dist/config/image-sequence.d.ts.map +0 -1
- package/dist/config/image-sequence.js +0 -15
- package/dist/config/image-sequence.js.map +0 -1
- package/dist/config/index.d.ts.map +0 -1
- package/dist/config/index.js +0 -175
- package/dist/config/index.js.map +0 -1
- package/dist/config/input-props.d.ts.map +0 -1
- package/dist/config/input-props.js.map +0 -1
- package/dist/config/log.d.ts +0 -7
- package/dist/config/log.d.ts.map +0 -1
- package/dist/config/log.js +0 -25
- package/dist/config/log.js.map +0 -1
- package/dist/config/max-timeline-tracks.d.ts +0 -2
- package/dist/config/max-timeline-tracks.d.ts.map +0 -1
- package/dist/config/max-timeline-tracks.js +0 -24
- package/dist/config/max-timeline-tracks.js.map +0 -1
- package/dist/config/override-webpack.d.ts +0 -12
- package/dist/config/override-webpack.d.ts.map +0 -1
- package/dist/config/override-webpack.js +0 -14
- package/dist/config/override-webpack.js.map +0 -1
- package/dist/config/overwrite.d.ts +0 -3
- package/dist/config/overwrite.d.ts.map +0 -1
- package/dist/config/overwrite.js +0 -14
- package/dist/config/overwrite.js.map +0 -1
- package/dist/config/pixel-format.d.ts +0 -8
- package/dist/config/pixel-format.d.ts.map +0 -1
- package/dist/config/pixel-format.js +0 -38
- package/dist/config/pixel-format.js.map +0 -1
- package/dist/config/preview-server.d.ts +0 -2
- package/dist/config/preview-server.d.ts.map +0 -1
- package/dist/config/preview-server.js +0 -20
- package/dist/config/preview-server.js.map +0 -1
- package/dist/config/prores-profile.d.ts +0 -7
- package/dist/config/prores-profile.d.ts.map +0 -1
- package/dist/config/prores-profile.js +0 -32
- package/dist/config/prores-profile.js.map +0 -1
- package/dist/config/quality.d.ts +0 -2
- package/dist/config/quality.d.ts.map +0 -1
- package/dist/config/quality.js +0 -17
- package/dist/config/quality.js.map +0 -1
- package/dist/config/scale.d.ts +0 -3
- package/dist/config/scale.d.ts.map +0 -1
- package/dist/config/scale.js +0 -15
- package/dist/config/scale.js.map +0 -1
- package/dist/config/still-frame.d.ts +0 -2
- package/dist/config/still-frame.d.ts.map +0 -1
- package/dist/config/still-frame.js +0 -12
- package/dist/config/still-frame.js.map +0 -1
- package/dist/config/timeout.d.ts +0 -2
- package/dist/config/timeout.d.ts.map +0 -1
- package/dist/config/timeout.js +0 -17
- package/dist/config/timeout.js.map +0 -1
- package/dist/config/webpack-caching.d.ts +0 -3
- package/dist/config/webpack-caching.d.ts.map +0 -1
- package/dist/config/webpack-caching.js +0 -16
- package/dist/config/webpack-caching.js.map +0 -1
- package/dist/default-css.d.ts.map +0 -1
- package/dist/default-css.js.map +0 -1
- package/dist/delay-render.d.ts.map +0 -1
- package/dist/delay-render.js.map +0 -1
- package/dist/easing.d.ts.map +0 -1
- package/dist/easing.js.map +0 -1
- package/dist/feature-flags.d.ts +0 -1
- package/dist/feature-flags.d.ts.map +0 -1
- package/dist/feature-flags.js +0 -7
- package/dist/feature-flags.js.map +0 -1
- package/dist/freeze.d.ts.map +0 -1
- package/dist/freeze.js.map +0 -1
- package/dist/get-asset-file-name.d.ts.map +0 -1
- package/dist/get-asset-file-name.js.map +0 -1
- package/dist/get-environment.d.ts.map +0 -1
- package/dist/get-environment.js.map +0 -1
- package/dist/get-preview-dom-element.d.ts.map +0 -1
- package/dist/get-preview-dom-element.js.map +0 -1
- package/dist/get-timeline-clip-name.d.ts.map +0 -1
- package/dist/get-timeline-clip-name.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/initial-frame.d.ts +0 -2
- package/dist/initial-frame.d.ts.map +0 -1
- package/dist/initial-frame.js +0 -12
- package/dist/initial-frame.js.map +0 -1
- package/dist/internals.d.ts.map +0 -1
- package/dist/internals.js.map +0 -1
- package/dist/interpolate.d.ts.map +0 -1
- package/dist/interpolate.js.map +0 -1
- package/dist/interpolateColors.d.ts.map +0 -1
- package/dist/interpolateColors.js.map +0 -1
- package/dist/is-approximately-the-same.d.ts.map +0 -1
- package/dist/is-approximately-the-same.js.map +0 -1
- package/dist/is-audio-codec.d.ts +0 -2
- package/dist/is-audio-codec.d.ts.map +0 -1
- package/dist/is-audio-codec.js +0 -7
- package/dist/is-audio-codec.js.map +0 -1
- package/dist/loop/index.d.ts.map +0 -1
- package/dist/loop/index.js.map +0 -1
- package/dist/multiple-versions-warning.d.ts.map +0 -1
- package/dist/multiple-versions-warning.js.map +0 -1
- package/dist/nonce.d.ts.map +0 -1
- package/dist/nonce.js.map +0 -1
- package/dist/perf/index.d.ts +0 -5
- package/dist/perf/index.d.ts.map +0 -1
- package/dist/perf/index.js +0 -35
- package/dist/perf/index.js.map +0 -1
- package/dist/play-and-handle-not-allowed-error.d.ts.map +0 -1
- package/dist/play-and-handle-not-allowed-error.js.map +0 -1
- package/dist/random.d.ts.map +0 -1
- package/dist/random.js.map +0 -1
- package/dist/register-root.d.ts.map +0 -1
- package/dist/register-root.js.map +0 -1
- package/dist/sequencing/index.d.ts.map +0 -1
- package/dist/sequencing/index.js.map +0 -1
- package/dist/series/flatten-children.d.ts.map +0 -1
- package/dist/series/flatten-children.js.map +0 -1
- package/dist/series/index.d.ts.map +0 -1
- package/dist/series/index.js.map +0 -1
- package/dist/setup-env-variables.d.ts.map +0 -1
- package/dist/setup-env-variables.js.map +0 -1
- package/dist/spring/index.d.ts.map +0 -1
- package/dist/spring/index.js.map +0 -1
- package/dist/spring/measure-spring.d.ts.map +0 -1
- package/dist/spring/measure-spring.js.map +0 -1
- package/dist/spring/spring-utils.d.ts.map +0 -1
- package/dist/spring/spring-utils.js.map +0 -1
- package/dist/static-file.d.ts.map +0 -1
- package/dist/static-file.js.map +0 -1
- package/dist/timeline-inout-position-state.d.ts +0 -12
- package/dist/timeline-inout-position-state.d.ts.map +0 -1
- package/dist/timeline-inout-position-state.js +0 -23
- package/dist/timeline-inout-position-state.js.map +0 -1
- package/dist/timeline-position-state.d.ts.map +0 -1
- package/dist/timeline-position-state.js.map +0 -1
- package/dist/timeout.d.ts +0 -2
- package/dist/timeout.d.ts.map +0 -1
- package/dist/timeout.js +0 -12
- package/dist/timeout.js.map +0 -1
- package/dist/truthy.d.ts.map +0 -1
- package/dist/truthy.js.map +0 -1
- package/dist/use-frame.d.ts.map +0 -1
- package/dist/use-frame.js +0 -25
- package/dist/use-frame.js.map +0 -1
- package/dist/use-lazy-component.d.ts.map +0 -1
- package/dist/use-lazy-component.js.map +0 -1
- package/dist/use-media-in-timeline.d.ts.map +0 -1
- package/dist/use-media-in-timeline.js.map +0 -1
- package/dist/use-media-playback.d.ts.map +0 -1
- package/dist/use-media-playback.js.map +0 -1
- package/dist/use-media-tag-volume.d.ts.map +0 -1
- package/dist/use-media-tag-volume.js.map +0 -1
- package/dist/use-sync-volume-with-media-tag.d.ts.map +0 -1
- package/dist/use-sync-volume-with-media-tag.js.map +0 -1
- package/dist/use-unsafe-video-config.d.ts.map +0 -1
- package/dist/use-unsafe-video-config.js.map +0 -1
- package/dist/use-video-config.d.ts.map +0 -1
- package/dist/use-video-config.js.map +0 -1
- package/dist/use-video.d.ts.map +0 -1
- package/dist/use-video.js.map +0 -1
- package/dist/validate-media-props.d.ts.map +0 -1
- package/dist/validate-media-props.js.map +0 -1
- package/dist/validate-start-from-props.d.ts.map +0 -1
- package/dist/validate-start-from-props.js.map +0 -1
- package/dist/validation/validate-composition-id.d.ts.map +0 -1
- package/dist/validation/validate-composition-id.js.map +0 -1
- package/dist/validation/validate-dimensions.d.ts.map +0 -1
- package/dist/validation/validate-dimensions.js.map +0 -1
- package/dist/validation/validate-duration-in-frames.d.ts.map +0 -1
- package/dist/validation/validate-duration-in-frames.js.map +0 -1
- package/dist/validation/validate-folder-name.d.ts.map +0 -1
- package/dist/validation/validate-folder-name.js.map +0 -1
- package/dist/validation/validate-fps.d.ts.map +0 -1
- package/dist/validation/validate-fps.js.map +0 -1
- package/dist/validation/validate-frame.d.ts +0 -1
- package/dist/validation/validate-frame.d.ts.map +0 -1
- package/dist/validation/validate-frame.js +0 -24
- package/dist/validation/validate-frame.js.map +0 -1
- package/dist/validation/validate-image-format.d.ts +0 -2
- package/dist/validation/validate-image-format.d.ts.map +0 -1
- package/dist/validation/validate-image-format.js +0 -9
- package/dist/validation/validate-image-format.js.map +0 -1
- package/dist/validation/validate-opengl-renderer.d.ts +0 -4
- package/dist/validation/validate-opengl-renderer.d.ts.map +0 -1
- package/dist/validation/validate-opengl-renderer.js +0 -14
- package/dist/validation/validate-opengl-renderer.js.map +0 -1
- package/dist/validation/validate-quality.d.ts +0 -1
- package/dist/validation/validate-quality.d.ts.map +0 -1
- package/dist/validation/validate-quality.js +0 -21
- package/dist/validation/validate-quality.js.map +0 -1
- package/dist/video/Video.d.ts.map +0 -1
- package/dist/video/Video.js.map +0 -1
- package/dist/video/VideoForDevelopment.d.ts.map +0 -1
- package/dist/video/VideoForDevelopment.js.map +0 -1
- package/dist/video/VideoForRendering.d.ts.map +0 -1
- package/dist/video/VideoForRendering.js.map +0 -1
- package/dist/video/get-current-time.d.ts.map +0 -1
- package/dist/video/get-current-time.js.map +0 -1
- package/dist/video/index.d.ts.map +0 -1
- package/dist/video/index.js.map +0 -1
- package/dist/video/props.d.ts.map +0 -1
- package/dist/video/props.js.map +0 -1
- package/dist/video-config.d.ts.map +0 -1
- package/dist/video-config.js.map +0 -1
- package/dist/volume-position-state.d.ts.map +0 -1
- package/dist/volume-position-state.js.map +0 -1
- package/dist/volume-prop.d.ts.map +0 -1
- package/dist/volume-prop.js.map +0 -1
- package/dist/warn-about-non-seekable-media.d.ts.map +0 -1
- package/dist/warn-about-non-seekable-media.js.map +0 -1
- package/dist/wrap-remotion-context.d.ts.map +0 -1
- package/dist/wrap-remotion-context.js.map +0 -1
package/dist/audio/Audio.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { RemotionMainAudioProps } from './props';
|
|
3
|
-
export declare const Audio: React.ForwardRefExoticComponent<Pick<Omit<React.DetailedHTMLProps<React.AudioHTMLAttributes<HTMLAudioElement>, HTMLAudioElement>, "
|
|
2
|
+
import type { RemotionMainAudioProps } from './props';
|
|
3
|
+
export declare const Audio: React.ForwardRefExoticComponent<Pick<Omit<React.DetailedHTMLProps<React.AudioHTMLAttributes<HTMLAudioElement>, HTMLAudioElement>, "onEnded" | "autoPlay" | "controls" | "loop"> & {
|
|
4
4
|
volume?: import("../volume-prop").VolumeProp | undefined;
|
|
5
5
|
playbackRate?: number | undefined;
|
|
6
|
-
} & RemotionMainAudioProps, "id" | "
|
|
6
|
+
} & RemotionMainAudioProps, "id" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "lang" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "src" | "volume" | "playbackRate" | "controlsList" | "crossOrigin" | "mediaGroup" | "muted" | "playsInline" | "preload" | keyof RemotionMainAudioProps> & React.RefAttributes<HTMLAudioElement>>;
|
package/dist/audio/Audio.js
CHANGED
|
@@ -4,7 +4,7 @@ exports.Audio = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const get_environment_1 = require("../get-environment");
|
|
7
|
-
const
|
|
7
|
+
const Sequence_1 = require("../Sequence");
|
|
8
8
|
const validate_media_props_1 = require("../validate-media-props");
|
|
9
9
|
const validate_start_from_props_1 = require("../validate-start-from-props");
|
|
10
10
|
const AudioForDevelopment_1 = require("./AudioForDevelopment");
|
|
@@ -15,13 +15,13 @@ const AudioRefForwardingFunction = (props, ref) => {
|
|
|
15
15
|
const { startFrom, endAt, ...otherProps } = props;
|
|
16
16
|
const onError = (0, react_1.useCallback)((e) => {
|
|
17
17
|
console.log(e.currentTarget.error);
|
|
18
|
-
throw new Error(`Could not play audio with src ${otherProps.src}: ${e.currentTarget.error}
|
|
18
|
+
throw new Error(`Could not play audio with src ${otherProps.src}: ${e.currentTarget.error}. See https://remotion.dev/docs/media-playback-error for help.`);
|
|
19
19
|
}, [otherProps.src]);
|
|
20
20
|
if (typeof startFrom !== 'undefined' || typeof endAt !== 'undefined') {
|
|
21
21
|
(0, validate_start_from_props_1.validateStartFromProps)(startFrom, endAt);
|
|
22
22
|
const startFromFrameNo = startFrom !== null && startFrom !== void 0 ? startFrom : 0;
|
|
23
23
|
const endAtFrameNo = endAt !== null && endAt !== void 0 ? endAt : Infinity;
|
|
24
|
-
return ((0, jsx_runtime_1.jsx)(
|
|
24
|
+
return ((0, jsx_runtime_1.jsx)(Sequence_1.Sequence, { layout: "none", from: 0 - startFromFrameNo, showInTimeline: false, durationInFrames: endAtFrameNo, children: (0, jsx_runtime_1.jsx)(exports.Audio, { ...otherProps, ref: ref }) }));
|
|
25
25
|
}
|
|
26
26
|
(0, validate_media_props_1.validateMediaProps)(props, 'Audio');
|
|
27
27
|
if ((0, get_environment_1.getRemotionEnvironment)() === 'rendering') {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import type { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
1
2
|
import React from 'react';
|
|
2
|
-
export declare const AudioForDevelopment:
|
|
3
|
+
export declare const AudioForDevelopment: ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.AudioHTMLAttributes<HTMLAudioElement>, HTMLAudioElement>, "onEnded" | "autoPlay" | "controls" | "loop"> & {
|
|
3
4
|
volume?: import("../volume-prop").VolumeProp | undefined;
|
|
4
5
|
playbackRate?: number | undefined;
|
|
5
6
|
} & {
|
|
6
7
|
shouldPreMountAudioTags: boolean;
|
|
7
|
-
}
|
|
8
|
+
} & RefAttributes<HTMLAudioElement>>;
|
|
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.AudioForDevelopment = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
+
const preload_1 = require("../preload");
|
|
7
|
+
const random_1 = require("../random");
|
|
8
|
+
const Sequence_1 = require("../Sequence");
|
|
6
9
|
const use_media_in_timeline_1 = require("../use-media-in-timeline");
|
|
7
10
|
const use_media_playback_1 = require("../use-media-playback");
|
|
8
11
|
const use_media_tag_volume_1 = require("../use-media-tag-volume");
|
|
@@ -18,14 +21,23 @@ const AudioForDevelopmentForwardRefFunction = (props, ref) => {
|
|
|
18
21
|
const [mediaVolume] = (0, volume_position_state_1.useMediaVolumeState)();
|
|
19
22
|
const [mediaMuted] = (0, volume_position_state_1.useMediaMutedState)();
|
|
20
23
|
const volumePropFrame = (0, use_audio_frame_1.useFrameForVolumeProp)();
|
|
21
|
-
const { volume, muted, playbackRate, shouldPreMountAudioTags, ...nativeProps } = props;
|
|
24
|
+
const { volume, muted, playbackRate, shouldPreMountAudioTags, src, ...nativeProps } = props;
|
|
25
|
+
if (!src) {
|
|
26
|
+
throw new TypeError("No 'src' was passed to <Audio>.");
|
|
27
|
+
}
|
|
28
|
+
const preloadedSrc = (0, preload_1.usePreload)(src);
|
|
22
29
|
const propsToPass = (0, react_1.useMemo)(() => {
|
|
23
30
|
return {
|
|
24
31
|
muted: muted || mediaMuted,
|
|
32
|
+
src: preloadedSrc,
|
|
25
33
|
...nativeProps,
|
|
26
34
|
};
|
|
27
|
-
}, [mediaMuted, muted, nativeProps]);
|
|
28
|
-
const
|
|
35
|
+
}, [mediaMuted, muted, nativeProps, preloadedSrc]);
|
|
36
|
+
const sequenceContext = (0, react_1.useContext)(Sequence_1.SequenceContext);
|
|
37
|
+
// Generate a string that's as unique as possible for this asset
|
|
38
|
+
// but at the same time deterministic. We use it to combat strict mode issues.
|
|
39
|
+
const id = (0, react_1.useMemo)(() => `audio-${(0, random_1.random)(src !== null && src !== void 0 ? src : '')}-${sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.relativeFrom}-${sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.cumulatedFrom}-${sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.durationInFrames}-muted:${props.muted}`, [props.muted, src, sequenceContext]);
|
|
40
|
+
const audioRef = (0, shared_audio_tags_1.useSharedAudio)(propsToPass, id).el;
|
|
29
41
|
const actualVolume = (0, use_media_tag_volume_1.useMediaTagVolume)(audioRef);
|
|
30
42
|
(0, use_sync_volume_with_media_tag_1.useSyncVolumeWithMediaTag)({
|
|
31
43
|
volumePropFrame,
|
|
@@ -38,14 +50,15 @@ const AudioForDevelopmentForwardRefFunction = (props, ref) => {
|
|
|
38
50
|
volume,
|
|
39
51
|
mediaVolume,
|
|
40
52
|
mediaRef: audioRef,
|
|
41
|
-
src
|
|
53
|
+
src,
|
|
42
54
|
mediaType: 'audio',
|
|
43
55
|
});
|
|
44
56
|
(0, use_media_playback_1.useMediaPlayback)({
|
|
45
57
|
mediaRef: audioRef,
|
|
46
|
-
src
|
|
58
|
+
src,
|
|
47
59
|
mediaType: 'audio',
|
|
48
60
|
playbackRate: playbackRate !== null && playbackRate !== void 0 ? playbackRate : 1,
|
|
61
|
+
onlyWarnForMediaSeekingError: false,
|
|
49
62
|
});
|
|
50
63
|
(0, react_1.useImperativeHandle)(ref, () => {
|
|
51
64
|
return audioRef.current;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import type { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
1
2
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
3
|
+
export declare const AudioForRendering: ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.AudioHTMLAttributes<HTMLAudioElement>, HTMLAudioElement>, "onEnded" | "autoPlay" | "controls" | "loop"> & {
|
|
4
|
+
volume?: import("../volume-prop").VolumeProp | undefined;
|
|
5
|
+
playbackRate?: number | undefined;
|
|
6
|
+
} & RefAttributes<HTMLAudioElement>>;
|
|
@@ -6,23 +6,24 @@ const react_1 = require("react");
|
|
|
6
6
|
const absolute_src_1 = require("../absolute-src");
|
|
7
7
|
const CompositionManager_1 = require("../CompositionManager");
|
|
8
8
|
const random_1 = require("../random");
|
|
9
|
-
const
|
|
10
|
-
const
|
|
9
|
+
const Sequence_1 = require("../Sequence");
|
|
10
|
+
const timeline_position_state_1 = require("../timeline-position-state");
|
|
11
|
+
const use_current_frame_1 = require("../use-current-frame");
|
|
11
12
|
const volume_prop_1 = require("../volume-prop");
|
|
12
13
|
const use_audio_frame_1 = require("./use-audio-frame");
|
|
13
14
|
const AudioForRenderingRefForwardingFunction = (props, ref) => {
|
|
14
15
|
const audioRef = (0, react_1.useRef)(null);
|
|
15
|
-
const absoluteFrame = (0,
|
|
16
|
+
const absoluteFrame = (0, timeline_position_state_1.useTimelinePosition)();
|
|
16
17
|
const volumePropFrame = (0, use_audio_frame_1.useFrameForVolumeProp)();
|
|
17
|
-
const frame = (0,
|
|
18
|
-
const sequenceContext = (0, react_1.useContext)(
|
|
18
|
+
const frame = (0, use_current_frame_1.useCurrentFrame)();
|
|
19
|
+
const sequenceContext = (0, react_1.useContext)(Sequence_1.SequenceContext);
|
|
19
20
|
const { registerAsset, unregisterAsset } = (0, react_1.useContext)(CompositionManager_1.CompositionManager);
|
|
20
21
|
// Generate a string that's as unique as possible for this asset
|
|
21
22
|
// but at the same time the same on all threads
|
|
22
23
|
const id = (0, react_1.useMemo)(() => {
|
|
23
24
|
var _a;
|
|
24
|
-
return `audio-${(0, random_1.random)((_a = props.src) !== null && _a !== void 0 ? _a : '')}-${sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.relativeFrom}-${sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.cumulatedFrom}-${sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.durationInFrames}
|
|
25
|
-
}, [props.
|
|
25
|
+
return `audio-${(0, random_1.random)((_a = props.src) !== null && _a !== void 0 ? _a : '')}-${sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.relativeFrom}-${sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.cumulatedFrom}-${sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.durationInFrames}`;
|
|
26
|
+
}, [props.src, sequenceContext]);
|
|
26
27
|
const { volume: volumeProp, playbackRate, ...nativeProps } = props;
|
|
27
28
|
const volume = (0, volume_prop_1.evaluateVolume)({
|
|
28
29
|
volume: volumeProp,
|
|
@@ -37,9 +38,15 @@ const AudioForRenderingRefForwardingFunction = (props, ref) => {
|
|
|
37
38
|
if (!props.src) {
|
|
38
39
|
throw new Error('No src passed');
|
|
39
40
|
}
|
|
41
|
+
if (!window.remotion_audioEnabled) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
40
44
|
if (props.muted) {
|
|
41
45
|
return;
|
|
42
46
|
}
|
|
47
|
+
if (volume <= 0) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
43
50
|
registerAsset({
|
|
44
51
|
type: 'audio',
|
|
45
52
|
src: (0, absolute_src_1.getAbsoluteSrc)(props.src),
|
package/dist/audio/props.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { RemotionAudioProps } from './props';
|
|
2
|
+
import type { RemotionAudioProps } from './props';
|
|
3
3
|
/**
|
|
4
4
|
* This functionality of Remotion will keep a certain amount
|
|
5
5
|
* of <audio> tags pre-mounted and by default filled with an empty audio track.
|
|
@@ -15,9 +15,10 @@ declare type AudioElem = {
|
|
|
15
15
|
id: number;
|
|
16
16
|
props: RemotionAudioProps;
|
|
17
17
|
el: React.RefObject<HTMLAudioElement>;
|
|
18
|
+
audioId: string;
|
|
18
19
|
};
|
|
19
20
|
declare type SharedContext = {
|
|
20
|
-
registerAudio: (aud: RemotionAudioProps) => AudioElem;
|
|
21
|
+
registerAudio: (aud: RemotionAudioProps, audioId: string) => AudioElem;
|
|
21
22
|
unregisterAudio: (id: number) => void;
|
|
22
23
|
updateAudio: (id: number, aud: RemotionAudioProps) => void;
|
|
23
24
|
playAllAudios: () => void;
|
|
@@ -28,5 +29,5 @@ export declare const SharedAudioContextProvider: React.FC<{
|
|
|
28
29
|
numberOfAudioTags: number;
|
|
29
30
|
children: React.ReactNode;
|
|
30
31
|
}>;
|
|
31
|
-
export declare const useSharedAudio: (aud: RemotionAudioProps) => AudioElem;
|
|
32
|
+
export declare const useSharedAudio: (aud: RemotionAudioProps, audioId: string) => AudioElem;
|
|
32
33
|
export {};
|
|
@@ -27,9 +27,40 @@ exports.useSharedAudio = exports.SharedAudioContextProvider = exports.SharedAudi
|
|
|
27
27
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
28
28
|
const react_1 = __importStar(require("react"));
|
|
29
29
|
const EMPTY_AUDIO = 'data:audio/mp3;base64,/+MYxAAJcAV8AAgAABn//////+/gQ5BAMA+D4Pg+BAQBAEAwD4Pg+D4EBAEAQDAPg++hYBH///hUFQVBUFREDQNHmf///////+MYxBUGkAGIMAAAAP/29Xt6lUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV/+MYxDUAAANIAAAAAFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV';
|
|
30
|
+
const compareProps = (obj1, obj2) => {
|
|
31
|
+
const keysA = Object.keys(obj1).sort();
|
|
32
|
+
const keysB = Object.keys(obj2).sort();
|
|
33
|
+
if (keysA.length !== keysB.length) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
for (let i = 0; i < keysA.length; i++) {
|
|
37
|
+
// Not the same keys
|
|
38
|
+
if (keysA[i] !== keysB[i]) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
// Not the same values
|
|
42
|
+
if (obj1[keysA[i]] !== obj2[keysB[i]]) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return true;
|
|
47
|
+
};
|
|
48
|
+
const didPropChange = (key, newProp, prevProp) => {
|
|
49
|
+
// /music.mp3 and http://localhost:3000/music.mp3 are the same
|
|
50
|
+
if (key === 'src' &&
|
|
51
|
+
!prevProp.startsWith('data:') &&
|
|
52
|
+
!newProp.startsWith('data:')) {
|
|
53
|
+
return (new URL(prevProp, window.location.origin).toString() !==
|
|
54
|
+
new URL(newProp, window.location.origin).toString());
|
|
55
|
+
}
|
|
56
|
+
if (prevProp === newProp) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
return true;
|
|
60
|
+
};
|
|
30
61
|
exports.SharedAudioContext = (0, react_1.createContext)(null);
|
|
31
62
|
const SharedAudioContextProvider = ({ children, numberOfAudioTags }) => {
|
|
32
|
-
const
|
|
63
|
+
const audios = (0, react_1.useRef)([]);
|
|
33
64
|
const [initialNumberOfAudioTags] = (0, react_1.useState)(numberOfAudioTags);
|
|
34
65
|
if (numberOfAudioTags !== initialNumberOfAudioTags) {
|
|
35
66
|
throw new Error('The number of shared audio tags has changed dynamically. Once you have set this property, you cannot change it afterwards.');
|
|
@@ -40,7 +71,38 @@ const SharedAudioContextProvider = ({ children, numberOfAudioTags }) => {
|
|
|
40
71
|
});
|
|
41
72
|
}, [numberOfAudioTags]);
|
|
42
73
|
const takenAudios = (0, react_1.useRef)(new Array(numberOfAudioTags).fill(false));
|
|
43
|
-
const
|
|
74
|
+
const rerenderAudios = (0, react_1.useCallback)(() => {
|
|
75
|
+
refs.forEach(({ ref, id }) => {
|
|
76
|
+
var _a;
|
|
77
|
+
const data = (_a = audios.current) === null || _a === void 0 ? void 0 : _a.find((a) => a.id === id);
|
|
78
|
+
const { current } = ref;
|
|
79
|
+
if (!current) {
|
|
80
|
+
// Whole player has been unmounted, the refs don't exist anymore.
|
|
81
|
+
// It is not an error anymore though
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (data === undefined) {
|
|
85
|
+
current.src = EMPTY_AUDIO;
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (!data) {
|
|
89
|
+
throw new TypeError('Expected audio data to be there');
|
|
90
|
+
}
|
|
91
|
+
Object.keys(data.props).forEach((key) => {
|
|
92
|
+
// @ts-expect-error
|
|
93
|
+
if (didPropChange(key, data.props[key], current[key])) {
|
|
94
|
+
// @ts-expect-error
|
|
95
|
+
current[key] = data.props[key];
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
}, [refs]);
|
|
100
|
+
const registerAudio = (0, react_1.useCallback)((aud, audioId) => {
|
|
101
|
+
var _a, _b;
|
|
102
|
+
const found = (_a = audios.current) === null || _a === void 0 ? void 0 : _a.find((a) => a.audioId === audioId);
|
|
103
|
+
if (found) {
|
|
104
|
+
return found;
|
|
105
|
+
}
|
|
44
106
|
const firstFreeAudio = takenAudios.current.findIndex((a) => a === false);
|
|
45
107
|
if (firstFreeAudio === -1) {
|
|
46
108
|
throw new Error(`Tried to simultaneously mount ${numberOfAudioTags + 1} <Audio /> tags at the same time. With the current settings, the maximum amount of <Audio /> tags is limited to ${numberOfAudioTags} at the same time. Remotion pre-mounts silent audio tags to help avoid browser autoplay restrictions. See https://remotion.dev/docs/player/autoplay#use-the-numberofsharedaudiotags-property for more information on how to increase this limit.`);
|
|
@@ -53,17 +115,14 @@ const SharedAudioContextProvider = ({ children, numberOfAudioTags }) => {
|
|
|
53
115
|
props: aud,
|
|
54
116
|
id,
|
|
55
117
|
el: ref,
|
|
118
|
+
audioId,
|
|
56
119
|
};
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
// to be updated in the next tick.
|
|
60
|
-
// This can lead to a tiny delay of audio playback, improvement ideas are welcome.
|
|
61
|
-
setTimeout(() => {
|
|
62
|
-
setAudios((prevAudios) => [...prevAudios, newElem]);
|
|
63
|
-
}, 4);
|
|
120
|
+
(_b = audios.current) === null || _b === void 0 ? void 0 : _b.push(newElem);
|
|
121
|
+
rerenderAudios();
|
|
64
122
|
return newElem;
|
|
65
|
-
}, [numberOfAudioTags, refs]);
|
|
123
|
+
}, [numberOfAudioTags, refs, rerenderAudios]);
|
|
66
124
|
const unregisterAudio = (0, react_1.useCallback)((id) => {
|
|
125
|
+
var _a;
|
|
67
126
|
const cloned = [...takenAudios.current];
|
|
68
127
|
const index = refs.findIndex((r) => r.id === id);
|
|
69
128
|
if (index === -1) {
|
|
@@ -71,23 +130,30 @@ const SharedAudioContextProvider = ({ children, numberOfAudioTags }) => {
|
|
|
71
130
|
}
|
|
72
131
|
cloned[index] = false;
|
|
73
132
|
takenAudios.current = cloned;
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}, [refs]);
|
|
133
|
+
audios.current = (_a = audios.current) === null || _a === void 0 ? void 0 : _a.filter((a) => a.id !== id);
|
|
134
|
+
rerenderAudios();
|
|
135
|
+
}, [refs, rerenderAudios]);
|
|
78
136
|
const updateAudio = (0, react_1.useCallback)((id, aud) => {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
137
|
+
var _a;
|
|
138
|
+
let changed = false;
|
|
139
|
+
audios.current = (_a = audios.current) === null || _a === void 0 ? void 0 : _a.map((prevA) => {
|
|
140
|
+
if (prevA.id === id) {
|
|
141
|
+
const isTheSame = compareProps(aud, prevA.props);
|
|
142
|
+
if (isTheSame) {
|
|
143
|
+
return prevA;
|
|
86
144
|
}
|
|
87
|
-
|
|
88
|
-
|
|
145
|
+
changed = true;
|
|
146
|
+
return {
|
|
147
|
+
...prevA,
|
|
148
|
+
props: aud,
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
return prevA;
|
|
89
152
|
});
|
|
90
|
-
|
|
153
|
+
if (changed) {
|
|
154
|
+
rerenderAudios();
|
|
155
|
+
}
|
|
156
|
+
}, [rerenderAudios]);
|
|
91
157
|
const playAllAudios = (0, react_1.useCallback)(() => {
|
|
92
158
|
refs.forEach((ref) => {
|
|
93
159
|
var _a;
|
|
@@ -110,41 +176,44 @@ const SharedAudioContextProvider = ({ children, numberOfAudioTags }) => {
|
|
|
110
176
|
updateAudio,
|
|
111
177
|
]);
|
|
112
178
|
return ((0, jsx_runtime_1.jsxs)(exports.SharedAudioContext.Provider, { value: value, children: [refs.map(({ id, ref }) => {
|
|
113
|
-
|
|
114
|
-
if (data === undefined) {
|
|
115
|
-
return (0, jsx_runtime_1.jsx)("audio", { ref: ref, src: EMPTY_AUDIO }, id);
|
|
116
|
-
}
|
|
117
|
-
if (!data) {
|
|
118
|
-
throw new TypeError('Expected audio data to be there');
|
|
119
|
-
}
|
|
120
|
-
return (0, jsx_runtime_1.jsx)("audio", { ref: ref, ...data.props }, id);
|
|
179
|
+
return (0, jsx_runtime_1.jsx)("audio", { ref: ref, src: EMPTY_AUDIO }, id);
|
|
121
180
|
}), children] }));
|
|
122
181
|
};
|
|
123
182
|
exports.SharedAudioContextProvider = SharedAudioContextProvider;
|
|
124
|
-
const useSharedAudio = (aud) => {
|
|
183
|
+
const useSharedAudio = (aud, audioId) => {
|
|
125
184
|
const ctx = (0, react_1.useContext)(exports.SharedAudioContext);
|
|
185
|
+
/**
|
|
186
|
+
* We work around this in React 18 so an audio tag will only register itself once
|
|
187
|
+
*/
|
|
126
188
|
const [elem] = (0, react_1.useState)(() => {
|
|
127
189
|
if (ctx && ctx.numberOfAudioTags > 0) {
|
|
128
|
-
return ctx.registerAudio(aud);
|
|
190
|
+
return ctx.registerAudio(aud, audioId);
|
|
129
191
|
}
|
|
130
192
|
return {
|
|
131
193
|
el: react_1.default.createRef(),
|
|
132
194
|
id: Math.random(),
|
|
133
195
|
props: aud,
|
|
196
|
+
audioId,
|
|
134
197
|
};
|
|
135
198
|
});
|
|
136
|
-
|
|
199
|
+
/**
|
|
200
|
+
* Effects in React 18 fire twice, and we are looking for a way to only fire it once.
|
|
201
|
+
* - useInsertionEffect only fires once. If it's available we are in React 18.
|
|
202
|
+
* - useLayoutEffect only fires once in React 17.
|
|
203
|
+
*/
|
|
204
|
+
const effectToUse = react_1.useInsertionEffect !== null && react_1.useInsertionEffect !== void 0 ? react_1.useInsertionEffect : react_1.useLayoutEffect;
|
|
205
|
+
effectToUse(() => {
|
|
206
|
+
if (ctx && ctx.numberOfAudioTags > 0) {
|
|
207
|
+
ctx.updateAudio(elem.id, aud);
|
|
208
|
+
}
|
|
209
|
+
}, [aud, ctx, elem.id]);
|
|
210
|
+
effectToUse(() => {
|
|
137
211
|
return () => {
|
|
138
212
|
if (ctx && ctx.numberOfAudioTags > 0) {
|
|
139
213
|
ctx.unregisterAudio(elem.id);
|
|
140
214
|
}
|
|
141
215
|
};
|
|
142
216
|
}, [ctx, elem.id]);
|
|
143
|
-
(0, react_1.useEffect)(() => {
|
|
144
|
-
if (ctx && ctx.numberOfAudioTags > 0) {
|
|
145
|
-
ctx.updateAudio(elem.id, aud);
|
|
146
|
-
}
|
|
147
|
-
}, [aud, ctx, elem.id]);
|
|
148
217
|
return elem;
|
|
149
218
|
};
|
|
150
219
|
exports.useSharedAudio = useSharedAudio;
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useFrameForVolumeProp = exports.useMediaStartsAt = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
5
|
+
const Sequence_1 = require("../Sequence");
|
|
6
|
+
const use_current_frame_1 = require("../use-current-frame");
|
|
7
7
|
const useMediaStartsAt = () => {
|
|
8
8
|
var _a;
|
|
9
|
-
const parentSequence = (0, react_1.useContext)(
|
|
9
|
+
const parentSequence = (0, react_1.useContext)(Sequence_1.SequenceContext);
|
|
10
10
|
const startsAt = Math.min(0, (_a = parentSequence === null || parentSequence === void 0 ? void 0 : parentSequence.relativeFrom) !== null && _a !== void 0 ? _a : 0);
|
|
11
11
|
return startsAt;
|
|
12
12
|
};
|
|
@@ -16,7 +16,7 @@ exports.useMediaStartsAt = useMediaStartsAt;
|
|
|
16
16
|
* we calculate the way more intuitive value for currentFrame
|
|
17
17
|
*/
|
|
18
18
|
const useFrameForVolumeProp = () => {
|
|
19
|
-
const frame = (0,
|
|
19
|
+
const frame = (0, use_current_frame_1.useCurrentFrame)();
|
|
20
20
|
const startsAt = (0, exports.useMediaStartsAt)();
|
|
21
21
|
return frame + startsAt;
|
|
22
22
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setBundleOutDir = exports.getBundleOutDir = void 0;
|
|
4
|
+
let bundleOutDir = null;
|
|
5
|
+
const getBundleOutDir = () => {
|
|
6
|
+
return bundleOutDir;
|
|
7
|
+
};
|
|
8
|
+
exports.getBundleOutDir = getBundleOutDir;
|
|
9
|
+
const setBundleOutDir = (path) => {
|
|
10
|
+
bundleOutDir = path;
|
|
11
|
+
};
|
|
12
|
+
exports.setBundleOutDir = setBundleOutDir;
|
|
@@ -13,21 +13,19 @@ const warnOnceSSRImport = () => {
|
|
|
13
13
|
console.warn(" typeof window === 'undefined' ? {} : getInputProps()");
|
|
14
14
|
};
|
|
15
15
|
const getInputProps = () => {
|
|
16
|
-
if (
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return {};
|
|
20
|
-
}
|
|
21
|
-
const param = window.remotion_inputProps;
|
|
22
|
-
if (!param) {
|
|
23
|
-
return {};
|
|
24
|
-
}
|
|
25
|
-
const parsed = JSON.parse(param);
|
|
26
|
-
return parsed;
|
|
16
|
+
if (typeof window === 'undefined') {
|
|
17
|
+
warnOnceSSRImport();
|
|
18
|
+
return {};
|
|
27
19
|
}
|
|
28
|
-
if ((0, get_environment_1.getRemotionEnvironment)() === '
|
|
29
|
-
|
|
20
|
+
if ((0, get_environment_1.getRemotionEnvironment)() === 'player-development' ||
|
|
21
|
+
(0, get_environment_1.getRemotionEnvironment)() === 'player-production') {
|
|
22
|
+
throw new Error('You cannot call `getInputProps()` from a <Player>. Instead, the props are available as React props from component that you passed as `component` prop.');
|
|
30
23
|
}
|
|
31
|
-
|
|
24
|
+
const param = window.remotion_inputProps;
|
|
25
|
+
if (!param) {
|
|
26
|
+
return {};
|
|
27
|
+
}
|
|
28
|
+
const parsed = JSON.parse(param);
|
|
29
|
+
return parsed;
|
|
32
30
|
};
|
|
33
31
|
exports.getInputProps = getInputProps;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setPublicPath = exports.getPublicPath = void 0;
|
|
4
|
+
let publicPath = null;
|
|
5
|
+
const getPublicPath = () => {
|
|
6
|
+
return publicPath;
|
|
7
|
+
};
|
|
8
|
+
exports.getPublicPath = getPublicPath;
|
|
9
|
+
const setPublicPath = (path) => {
|
|
10
|
+
publicPath = path;
|
|
11
|
+
};
|
|
12
|
+
exports.setPublicPath = setPublicPath;
|