remotion 4.0.0-oops.3 → 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.
Files changed (189) hide show
  1. package/.turbo/turbo-build.log +5 -5
  2. package/README.md +30 -19
  3. package/dist/AbsoluteFill.d.ts +6 -2
  4. package/dist/AbsoluteFill.js +7 -3
  5. package/dist/CanUseRemotionHooks.d.ts +5 -0
  6. package/dist/CanUseRemotionHooks.js +10 -0
  7. package/dist/Composition.d.ts +3 -6
  8. package/dist/Composition.js +40 -28
  9. package/dist/CompositionManager.d.ts +7 -12
  10. package/dist/CompositionManager.js +15 -5
  11. package/dist/Folder.d.ts +15 -0
  12. package/dist/Folder.js +33 -0
  13. package/dist/IFrame.js +1 -1
  14. package/dist/Img.js +33 -16
  15. package/dist/RemotionRoot.js +1 -1
  16. package/dist/{sequencing/index.d.ts → Sequence.d.ts} +13 -3
  17. package/dist/{sequencing/index.js → Sequence.js} +40 -34
  18. package/dist/Still.d.ts +1 -1
  19. package/dist/Still.js +1 -1
  20. package/dist/asset-types.d.ts +1 -4
  21. package/dist/audio/Audio.d.ts +2 -2
  22. package/dist/audio/Audio.js +5 -5
  23. package/dist/audio/AudioForDevelopment.d.ts +3 -2
  24. package/dist/audio/AudioForDevelopment.js +19 -6
  25. package/dist/audio/AudioForRendering.d.ts +5 -2
  26. package/dist/audio/AudioForRendering.js +15 -8
  27. package/dist/audio/index.js +5 -1
  28. package/dist/audio/props.d.ts +1 -1
  29. package/dist/audio/shared-audio-tags.d.ts +4 -3
  30. package/dist/audio/shared-audio-tags.js +115 -42
  31. package/dist/audio/use-audio-frame.js +4 -4
  32. package/dist/config/bundle-out-dir.d.ts +2 -0
  33. package/dist/config/bundle-out-dir.js +12 -0
  34. package/dist/config/input-props.js +12 -14
  35. package/dist/config/public-path.d.ts +2 -0
  36. package/dist/config/public-path.js +12 -0
  37. package/dist/{config/index.d.ts → config.d.ts} +70 -22
  38. package/dist/config.js +21 -0
  39. package/dist/default-css.d.ts +1 -0
  40. package/dist/default-css.js +9 -2
  41. package/dist/delay-render.d.ts +1 -1
  42. package/dist/delay-render.js +4 -4
  43. package/dist/freeze.d.ts +2 -2
  44. package/dist/freeze.js +2 -2
  45. package/dist/get-timeline-clip-name.js +2 -1
  46. package/dist/index.d.ts +23 -8
  47. package/dist/index.js +18 -8
  48. package/dist/internals.d.ts +35 -101
  49. package/dist/internals.js +18 -94
  50. package/dist/{interpolateColors.d.ts → interpolate-colors.d.ts} +0 -0
  51. package/dist/{interpolateColors.js → interpolate-colors.js} +0 -0
  52. package/dist/loading-indicator.d.ts +2 -0
  53. package/dist/loading-indicator.js +35 -0
  54. package/dist/loop/index.js +5 -4
  55. package/dist/multiple-versions-warning.js +18 -4
  56. package/dist/play-and-handle-not-allowed-error.d.ts +1 -1
  57. package/dist/portal-node.d.ts +1 -0
  58. package/dist/portal-node.js +23 -0
  59. package/dist/preload.d.ts +7 -0
  60. package/dist/preload.js +83 -0
  61. package/dist/register-root.d.ts +2 -1
  62. package/dist/register-root.js +20 -5
  63. package/dist/series/index.d.ts +2 -2
  64. package/dist/series/index.js +4 -4
  65. package/dist/spring/index.d.ts +8 -4
  66. package/dist/spring/index.js +21 -6
  67. package/dist/spring/measure-spring.d.ts +1 -1
  68. package/dist/spring/measure-spring.js +1 -1
  69. package/dist/static-file.js +6 -0
  70. package/dist/timeline-position-state.d.ts +1 -1
  71. package/dist/{use-frame.d.ts → use-current-frame.d.ts} +0 -1
  72. package/dist/use-current-frame.js +28 -0
  73. package/dist/use-lazy-component.d.ts +3 -3
  74. package/dist/use-lazy-component.js +5 -1
  75. package/dist/use-media-in-timeline.d.ts +2 -2
  76. package/dist/use-media-in-timeline.js +10 -7
  77. package/dist/use-media-playback.d.ts +3 -2
  78. package/dist/use-media-playback.js +9 -6
  79. package/dist/use-media-tag-volume.d.ts +1 -1
  80. package/dist/use-sync-volume-with-media-tag.d.ts +2 -2
  81. package/dist/use-unsafe-video-config.d.ts +1 -1
  82. package/dist/use-unsafe-video-config.js +2 -2
  83. package/dist/use-video-config.d.ts +1 -1
  84. package/dist/use-video-config.js +6 -0
  85. package/dist/use-video.d.ts +13 -1
  86. package/dist/use-video.js +16 -3
  87. package/dist/validate-media-props.d.ts +4 -3
  88. package/dist/validation/validate-fps.d.ts +1 -1
  89. package/dist/validation/validate-fps.js +4 -1
  90. package/dist/validation/validate-offthreadvideo-image-format.d.ts +1 -0
  91. package/dist/validation/validate-offthreadvideo-image-format.js +15 -0
  92. package/dist/validation/validation-spring-duration.d.ts +1 -0
  93. package/dist/validation/validation-spring-duration.js +21 -0
  94. package/dist/version.d.ts +1 -0
  95. package/dist/version.js +5 -0
  96. package/dist/video/OffthreadVideo.d.ts +3 -0
  97. package/dist/video/OffthreadVideo.js +27 -0
  98. package/dist/video/OffthreadVideoForRendering.d.ts +3 -0
  99. package/dist/video/OffthreadVideoForRendering.js +101 -0
  100. package/dist/video/Video.d.ts +3 -3
  101. package/dist/video/Video.js +4 -4
  102. package/dist/video/VideoForDevelopment.d.ts +7 -2
  103. package/dist/video/VideoForDevelopment.js +28 -4
  104. package/dist/video/VideoForRendering.d.ts +5 -2
  105. package/dist/video/VideoForRendering.js +62 -40
  106. package/dist/video/get-current-time.d.ts +7 -1
  107. package/dist/video/get-current-time.js +17 -9
  108. package/dist/video/index.d.ts +3 -2
  109. package/dist/video/index.js +5 -12
  110. package/dist/video/props.d.ts +13 -2
  111. package/dist/volume-prop.js +1 -1
  112. package/dist/warn-about-non-seekable-media.d.ts +1 -1
  113. package/dist/warn-about-non-seekable-media.js +14 -2
  114. package/dist/wrap-remotion-context.d.ts +2 -1
  115. package/dist/wrap-remotion-context.js +12 -4
  116. package/ensure-correct-version.js +24 -0
  117. package/package.json +10 -11
  118. package/version.d.ts +1 -0
  119. package/version.js +1 -0
  120. package/dist/compress-assets.d.ts +0 -7
  121. package/dist/compress-assets.js +0 -25
  122. package/dist/config/browser-executable.d.ts +0 -3
  123. package/dist/config/browser-executable.js +0 -12
  124. package/dist/config/browser.d.ts +0 -4
  125. package/dist/config/browser.js +0 -19
  126. package/dist/config/chromium-flags.d.ts +0 -10
  127. package/dist/config/chromium-flags.js +0 -34
  128. package/dist/config/codec.d.ts +0 -17
  129. package/dist/config/codec.js +0 -103
  130. package/dist/config/concurrency.d.ts +0 -3
  131. package/dist/config/concurrency.js +0 -15
  132. package/dist/config/crf.d.ts +0 -9
  133. package/dist/config/crf.js +0 -83
  134. package/dist/config/env-file.d.ts +0 -2
  135. package/dist/config/env-file.js +0 -10
  136. package/dist/config/ffmpeg-executable.d.ts +0 -3
  137. package/dist/config/ffmpeg-executable.js +0 -12
  138. package/dist/config/frame-range.d.ts +0 -5
  139. package/dist/config/frame-range.js +0 -80
  140. package/dist/config/image-format.d.ts +0 -8
  141. package/dist/config/image-format.js +0 -37
  142. package/dist/config/image-sequence.d.ts +0 -3
  143. package/dist/config/image-sequence.js +0 -15
  144. package/dist/config/index.js +0 -175
  145. package/dist/config/log.d.ts +0 -7
  146. package/dist/config/log.js +0 -25
  147. package/dist/config/max-timeline-tracks.d.ts +0 -2
  148. package/dist/config/max-timeline-tracks.js +0 -24
  149. package/dist/config/override-webpack.d.ts +0 -12
  150. package/dist/config/override-webpack.js +0 -14
  151. package/dist/config/overwrite.d.ts +0 -3
  152. package/dist/config/overwrite.js +0 -14
  153. package/dist/config/pixel-format.d.ts +0 -8
  154. package/dist/config/pixel-format.js +0 -38
  155. package/dist/config/preview-server.d.ts +0 -2
  156. package/dist/config/preview-server.js +0 -20
  157. package/dist/config/prores-profile.d.ts +0 -7
  158. package/dist/config/prores-profile.js +0 -32
  159. package/dist/config/quality.d.ts +0 -2
  160. package/dist/config/quality.js +0 -17
  161. package/dist/config/scale.d.ts +0 -3
  162. package/dist/config/scale.js +0 -15
  163. package/dist/config/still-frame.d.ts +0 -2
  164. package/dist/config/still-frame.js +0 -12
  165. package/dist/config/timeout.d.ts +0 -2
  166. package/dist/config/timeout.js +0 -17
  167. package/dist/config/webpack-caching.d.ts +0 -3
  168. package/dist/config/webpack-caching.js +0 -16
  169. package/dist/feature-flags.d.ts +0 -1
  170. package/dist/feature-flags.js +0 -7
  171. package/dist/initial-frame.d.ts +0 -2
  172. package/dist/initial-frame.js +0 -12
  173. package/dist/is-audio-codec.d.ts +0 -2
  174. package/dist/is-audio-codec.js +0 -7
  175. package/dist/perf/index.d.ts +0 -5
  176. package/dist/perf/index.js +0 -33
  177. package/dist/timeline-inout-position-state.d.ts +0 -12
  178. package/dist/timeline-inout-position-state.js +0 -23
  179. package/dist/timeout.d.ts +0 -2
  180. package/dist/timeout.js +0 -12
  181. package/dist/use-frame.js +0 -25
  182. package/dist/validation/validate-frame.d.ts +0 -1
  183. package/dist/validation/validate-frame.js +0 -24
  184. package/dist/validation/validate-image-format.d.ts +0 -2
  185. package/dist/validation/validate-image-format.js +0 -9
  186. package/dist/validation/validate-opengl-renderer.d.ts +0 -4
  187. package/dist/validation/validate-opengl-renderer.js +0 -14
  188. package/dist/validation/validate-quality.d.ts +0 -1
  189. package/dist/validation/validate-quality.js +0 -21
@@ -3,25 +3,30 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Sequence = exports.SequenceContext = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
- const CompositionManager_1 = require("../CompositionManager");
7
- const get_timeline_clip_name_1 = require("../get-timeline-clip-name");
8
- const nonce_1 = require("../nonce");
9
- const timeline_position_state_1 = require("../timeline-position-state");
10
- const use_frame_1 = require("../use-frame");
11
- const use_unsafe_video_config_1 = require("../use-unsafe-video-config");
6
+ const AbsoluteFill_1 = require("./AbsoluteFill");
7
+ const CompositionManager_1 = require("./CompositionManager");
8
+ const get_environment_1 = require("./get-environment");
9
+ const get_timeline_clip_name_1 = require("./get-timeline-clip-name");
10
+ const nonce_1 = require("./nonce");
11
+ const timeline_position_state_1 = require("./timeline-position-state");
12
+ const use_video_config_1 = require("./use-video-config");
12
13
  exports.SequenceContext = (0, react_1.createContext)(null);
13
- const Sequence = ({ from, durationInFrames = Infinity, children, name, layout = 'absolute-fill', showInTimeline = true, showLoopTimesInTimeline, }) => {
14
+ const SequenceRefForwardingFunction = ({ from, durationInFrames = Infinity, children, name, showInTimeline = true, showLoopTimesInTimeline, ...other }, ref) => {
15
+ const { layout = 'absolute-fill' } = other;
14
16
  const [id] = (0, react_1.useState)(() => String(Math.random()));
15
17
  const parentSequence = (0, react_1.useContext)(exports.SequenceContext);
16
18
  const { rootId } = (0, react_1.useContext)(timeline_position_state_1.TimelineContext);
17
19
  const cumulatedFrom = parentSequence
18
20
  ? parentSequence.cumulatedFrom + parentSequence.relativeFrom
19
21
  : 0;
20
- const actualFrom = cumulatedFrom + from;
21
22
  const nonce = (0, nonce_1.useNonce)();
22
23
  if (layout !== 'absolute-fill' && layout !== 'none') {
23
24
  throw new TypeError(`The layout prop of <Sequence /> expects either "absolute-fill" or "none", but you passed: ${layout}`);
24
25
  }
26
+ // @ts-expect-error
27
+ if (layout === 'none' && typeof other.style !== 'undefined') {
28
+ throw new TypeError('If layout="none", you may not pass a style.');
29
+ }
25
30
  if (typeof durationInFrames !== 'number') {
26
31
  throw new TypeError(`You passed to durationInFrames an argument of type ${typeof durationInFrames}, but it must be a number.`);
27
32
  }
@@ -38,16 +43,12 @@ const Sequence = ({ from, durationInFrames = Infinity, children, name, layout =
38
43
  if (from % 1 !== 0) {
39
44
  throw new TypeError(`The "from" prop of a sequence must be an integer, but got ${from}.`);
40
45
  }
41
- const absoluteFrame = (0, use_frame_1.useAbsoluteCurrentFrame)();
42
- const unsafeVideoConfig = (0, use_unsafe_video_config_1.useUnsafeVideoConfig)();
43
- const compositionDuration = unsafeVideoConfig
44
- ? unsafeVideoConfig.durationInFrames
45
- : 0;
46
- const actualDurationInFrames = Math.min(compositionDuration - from, parentSequence
47
- ? Math.min(parentSequence.durationInFrames +
48
- (parentSequence.cumulatedFrom + parentSequence.relativeFrom) -
49
- actualFrom, durationInFrames)
50
- : durationInFrames);
46
+ const absoluteFrame = (0, timeline_position_state_1.useTimelinePosition)();
47
+ const videoConfig = (0, use_video_config_1.useVideoConfig)();
48
+ const parentSequenceDuration = parentSequence
49
+ ? Math.min(parentSequence.durationInFrames - from, durationInFrames)
50
+ : durationInFrames;
51
+ const actualDurationInFrames = Math.max(0, Math.min(videoConfig.durationInFrames - from, parentSequenceDuration));
51
52
  const { registerSequence, unregisterSequence } = (0, react_1.useContext)(CompositionManager_1.CompositionManager);
52
53
  const contextValue = (0, react_1.useMemo)(() => {
53
54
  var _a;
@@ -70,6 +71,9 @@ const Sequence = ({ from, durationInFrames = Infinity, children, name, layout =
70
71
  }, [children, name]);
71
72
  (0, react_1.useEffect)(() => {
72
73
  var _a;
74
+ if ((0, get_environment_1.getRemotionEnvironment)() !== 'preview') {
75
+ return;
76
+ }
73
77
  registerSequence({
74
78
  from,
75
79
  duration: actualDurationInFrames,
@@ -87,7 +91,6 @@ const Sequence = ({ from, durationInFrames = Infinity, children, name, layout =
87
91
  };
88
92
  }, [
89
93
  durationInFrames,
90
- actualFrom,
91
94
  id,
92
95
  name,
93
96
  registerSequence,
@@ -101,23 +104,26 @@ const Sequence = ({ from, durationInFrames = Infinity, children, name, layout =
101
104
  nonce,
102
105
  showLoopTimesInTimeline,
103
106
  ]);
104
- const endThreshold = (() => {
105
- return actualFrom + durationInFrames - 1;
106
- })();
107
- const content = absoluteFrame < actualFrom
107
+ const endThreshold = cumulatedFrom + from + durationInFrames - 1;
108
+ const content = absoluteFrame < cumulatedFrom + from
108
109
  ? null
109
110
  : absoluteFrame > endThreshold
110
111
  ? null
111
112
  : children;
112
- return ((0, jsx_runtime_1.jsx)(exports.SequenceContext.Provider, { value: contextValue, children: content === null ? null : layout === 'absolute-fill' ? ((0, jsx_runtime_1.jsx)("div", { style: {
113
- position: 'absolute',
114
- display: 'flex',
115
- width: '100%',
116
- height: '100%',
117
- top: 0,
118
- bottom: 0,
119
- left: 0,
120
- right: 0,
121
- }, children: content }, void 0)) : (content) }, void 0));
113
+ const styleIfThere = other.layout === 'none' ? undefined : other.style;
114
+ const defaultStyle = (0, react_1.useMemo)(() => {
115
+ return {
116
+ flexDirection: undefined,
117
+ ...(styleIfThere !== null && styleIfThere !== void 0 ? styleIfThere : {}),
118
+ };
119
+ }, [styleIfThere]);
120
+ if (ref !== null && layout === 'none') {
121
+ throw new TypeError('It is not supported to pass both a `ref` and `layout="none"` to <Sequence />.');
122
+ }
123
+ return ((0, jsx_runtime_1.jsx)(exports.SequenceContext.Provider, { value: contextValue, children: content === null ? null : layout === 'absolute-fill' ? ((0, jsx_runtime_1.jsx)(AbsoluteFill_1.AbsoluteFill, { ref: ref, style: defaultStyle, children: content })) : (content) }));
122
124
  };
123
- exports.Sequence = Sequence;
125
+ /**
126
+ * A component that time-shifts its children and wraps them in an absolutely positioned <div>.
127
+ * @link https://www.remotion.dev/docs/sequence
128
+ */
129
+ exports.Sequence = (0, react_1.forwardRef)(SequenceRefForwardingFunction);
package/dist/Still.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
- import { StillProps } from './Composition';
2
+ import type { StillProps } from './Composition';
3
3
  export declare const Still: <T>(props: StillProps<T>) => JSX.Element;
package/dist/Still.js CHANGED
@@ -4,6 +4,6 @@ exports.Still = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const Composition_1 = require("./Composition");
6
6
  const Still = (props) => {
7
- return (0, jsx_runtime_1.jsx)(Composition_1.Composition, { fps: 1, durationInFrames: 1, ...props }, void 0);
7
+ return (0, jsx_runtime_1.jsx)(Composition_1.Composition, { fps: 1, durationInFrames: 1, ...props });
8
8
  };
9
9
  exports.Still = Still;
@@ -22,10 +22,7 @@ declare module '*.aac' {
22
22
  const src: string;
23
23
  export default src;
24
24
  }
25
- declare module '*.svg' {
26
- const src: string;
27
- export default src;
28
- }
25
+ declare module '*.svg';
29
26
  declare module '*.jpg' {
30
27
  const src: string;
31
28
  export default src;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
- import { RemotionMainAudioProps } from './props';
2
+ import type { RemotionMainAudioProps } from './props';
3
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, "style" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "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" | "key" | keyof RemotionMainAudioProps> & React.RefAttributes<HTMLAudioElement>>;
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>>;
@@ -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 sequencing_1 = require("../sequencing");
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,18 +15,18 @@ 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)(sequencing_1.Sequence, { layout: "none", from: 0 - startFromFrameNo, showInTimeline: false, durationInFrames: endAtFrameNo, children: (0, jsx_runtime_1.jsx)(exports.Audio, { ...otherProps, ref: ref }, void 0) }, void 0));
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') {
28
- return (0, jsx_runtime_1.jsx)(AudioForRendering_1.AudioForRendering, { ...props, ref: ref, onError: onError }, void 0);
28
+ return (0, jsx_runtime_1.jsx)(AudioForRendering_1.AudioForRendering, { ...props, ref: ref, onError: onError });
29
29
  }
30
- return ((0, jsx_runtime_1.jsx)(AudioForDevelopment_1.AudioForDevelopment, { shouldPreMountAudioTags: audioContext !== null && audioContext.numberOfAudioTags > 0, ...props, ref: ref, onError: onError }, void 0));
30
+ return ((0, jsx_runtime_1.jsx)(AudioForDevelopment_1.AudioForDevelopment, { shouldPreMountAudioTags: audioContext !== null && audioContext.numberOfAudioTags > 0, ...props, ref: ref, onError: onError }));
31
31
  };
32
32
  exports.Audio = (0, react_1.forwardRef)(AudioRefForwardingFunction);
@@ -1,7 +1,8 @@
1
+ import type { ForwardRefExoticComponent, RefAttributes } from 'react';
1
2
  import React from 'react';
2
- export declare const AudioForDevelopment: React.ForwardRefExoticComponent<Pick<Omit<React.DetailedHTMLProps<React.AudioHTMLAttributes<HTMLAudioElement>, HTMLAudioElement>, "onEnded" | "autoPlay" | "controls" | "loop"> & {
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
- }, "style" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "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" | "key" | "shouldPreMountAudioTags"> & React.RefAttributes<HTMLAudioElement>>;
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 audioRef = (0, shared_audio_tags_1.useSharedAudio)(propsToPass).el;
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: nativeProps.src,
53
+ src,
42
54
  mediaType: 'audio',
43
55
  });
44
56
  (0, use_media_playback_1.useMediaPlayback)({
45
57
  mediaRef: audioRef,
46
- src: nativeProps.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;
@@ -53,6 +66,6 @@ const AudioForDevelopmentForwardRefFunction = (props, ref) => {
53
66
  if (initialShouldPreMountAudioElements) {
54
67
  return null;
55
68
  }
56
- return (0, jsx_runtime_1.jsx)("audio", { ref: audioRef, ...propsToPass }, void 0);
69
+ return (0, jsx_runtime_1.jsx)("audio", { ref: audioRef, ...propsToPass });
57
70
  };
58
71
  exports.AudioForDevelopment = (0, react_1.forwardRef)(AudioForDevelopmentForwardRefFunction);
@@ -1,3 +1,6 @@
1
+ import type { ForwardRefExoticComponent, RefAttributes } from 'react';
1
2
  import React from 'react';
2
- import { RemotionAudioProps } from './props';
3
- export declare const AudioForRendering: React.ForwardRefExoticComponent<Pick<RemotionAudioProps, "style" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "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" | "key"> & React.RefAttributes<HTMLAudioElement>>;
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 sequencing_1 = require("../sequencing");
10
- const use_frame_1 = require("../use-frame");
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, use_frame_1.useAbsoluteCurrentFrame)();
16
+ const absoluteFrame = (0, timeline_position_state_1.useTimelinePosition)();
16
17
  const volumePropFrame = (0, use_audio_frame_1.useFrameForVolumeProp)();
17
- const frame = (0, use_frame_1.useCurrentFrame)();
18
- const sequenceContext = (0, react_1.useContext)(sequencing_1.SequenceContext);
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}-muted:${props.muted}`;
25
- }, [props.muted, props.src, sequenceContext]);
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),
@@ -63,6 +70,6 @@ const AudioForRenderingRefForwardingFunction = (props, ref) => {
63
70
  playbackRate,
64
71
  props.playbackRate,
65
72
  ]);
66
- return (0, jsx_runtime_1.jsx)("audio", { ref: audioRef, ...nativeProps }, void 0);
73
+ return (0, jsx_runtime_1.jsx)("audio", { ref: audioRef, ...nativeProps });
67
74
  };
68
75
  exports.AudioForRendering = (0, react_1.forwardRef)(AudioForRenderingRefForwardingFunction);
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { VolumeProp } from '../volume-prop';
2
+ import type { VolumeProp } from '../volume-prop';
3
3
  export declare type RemotionMainAudioProps = {
4
4
  startFrom?: number;
5
5
  endAt?: number;
@@ -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 {};