remotion 4.0.0-webhook.27 → 4.1.0-alpha2

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 (283) hide show
  1. package/LICENSE.md +8 -8
  2. package/README.md +7 -7
  3. package/dist/{AbsoluteFill.d.ts → cjs/AbsoluteFill.d.ts} +2 -2
  4. package/dist/{AbsoluteFill.js → cjs/AbsoluteFill.js} +2 -2
  5. package/dist/cjs/AssetManager.d.ts +11 -0
  6. package/dist/cjs/AssetManager.js +40 -0
  7. package/dist/{CanUseRemotionHooks.d.ts → cjs/CanUseRemotionHooks.d.ts} +0 -0
  8. package/dist/{CanUseRemotionHooks.js → cjs/CanUseRemotionHooks.js} +0 -0
  9. package/dist/cjs/Clipper.d.ts +7 -0
  10. package/dist/cjs/Clipper.js +24 -0
  11. package/dist/cjs/Composition.d.ts +41 -0
  12. package/dist/cjs/Composition.js +132 -0
  13. package/dist/cjs/CompositionManager.d.ts +75 -0
  14. package/dist/{CompositionManager.js → cjs/CompositionManager.js} +29 -66
  15. package/dist/cjs/CompositionManagerContext.d.ts +18 -0
  16. package/dist/cjs/CompositionManagerContext.js +16 -0
  17. package/dist/cjs/EditorProps.d.ts +15 -0
  18. package/dist/cjs/EditorProps.js +53 -0
  19. package/dist/{Folder.d.ts → cjs/Folder.d.ts} +6 -2
  20. package/dist/{Folder.js → cjs/Folder.js} +10 -6
  21. package/dist/{IFrame.d.ts → cjs/IFrame.d.ts} +4 -0
  22. package/dist/{IFrame.js → cjs/IFrame.js} +8 -4
  23. package/dist/cjs/Img.d.ts +9 -0
  24. package/dist/cjs/Img.js +100 -0
  25. package/dist/cjs/NativeLayers.d.ts +13 -0
  26. package/dist/cjs/NativeLayers.js +29 -0
  27. package/dist/cjs/Null.d.ts +2 -0
  28. package/dist/cjs/Null.js +25 -0
  29. package/dist/{RemotionRoot.d.ts → cjs/RemotionRoot.d.ts} +1 -0
  30. package/dist/cjs/RemotionRoot.js +72 -0
  31. package/dist/cjs/ResolveCompositionConfig.d.ts +24 -0
  32. package/dist/cjs/ResolveCompositionConfig.js +192 -0
  33. package/dist/cjs/Sequence.d.ts +22 -0
  34. package/dist/{Sequence.js → cjs/Sequence.js} +27 -29
  35. package/dist/cjs/SequenceContext.d.ts +9 -0
  36. package/dist/cjs/SequenceContext.js +5 -0
  37. package/dist/cjs/SequenceManager.d.ts +11 -0
  38. package/dist/cjs/SequenceManager.js +57 -0
  39. package/dist/cjs/Still.d.ts +8 -0
  40. package/dist/cjs/Still.js +22 -0
  41. package/dist/{absolute-src.d.ts → cjs/absolute-src.d.ts} +0 -0
  42. package/dist/{absolute-src.js → cjs/absolute-src.js} +0 -0
  43. package/dist/{asset-types.d.ts → cjs/asset-types.d.ts} +0 -0
  44. package/dist/{asset-types.js → cjs/asset-types.js} +0 -0
  45. package/dist/{audio → cjs/audio}/Audio.d.ts +10 -4
  46. package/dist/cjs/audio/Audio.js +58 -0
  47. package/dist/cjs/audio/AudioForDevelopment.d.ts +11 -0
  48. package/dist/cjs/audio/AudioForDevelopment.js +101 -0
  49. package/dist/cjs/audio/AudioForRendering.d.ts +10 -0
  50. package/dist/cjs/audio/AudioForRendering.js +111 -0
  51. package/dist/cjs/audio/index.d.ts +2 -0
  52. package/dist/{audio → cjs/audio}/index.js +2 -2
  53. package/dist/cjs/audio/props.d.ts +12 -0
  54. package/dist/{audio → cjs/audio}/props.js +0 -0
  55. package/dist/{audio → cjs/audio}/shared-audio-tags.d.ts +10 -4
  56. package/dist/{audio → cjs/audio}/shared-audio-tags.js +35 -13
  57. package/dist/{audio → cjs/audio}/use-audio-frame.d.ts +0 -0
  58. package/dist/{audio → cjs/audio}/use-audio-frame.js +4 -4
  59. package/dist/{bezier.d.ts → cjs/bezier.d.ts} +0 -0
  60. package/dist/{bezier.js → cjs/bezier.js} +0 -0
  61. package/dist/cjs/cancel-render.d.ts +5 -0
  62. package/dist/cjs/cancel-render.js +47 -0
  63. package/dist/{config → cjs/config}/input-props.d.ts +0 -0
  64. package/dist/{config → cjs/config}/input-props.js +3 -3
  65. package/dist/{default-css.d.ts → cjs/default-css.d.ts} +0 -0
  66. package/dist/{default-css.js → cjs/default-css.js} +0 -0
  67. package/dist/{delay-render.d.ts → cjs/delay-render.d.ts} +4 -4
  68. package/dist/{delay-render.js → cjs/delay-render.js} +12 -12
  69. package/dist/{easing.d.ts → cjs/easing.d.ts} +4 -0
  70. package/dist/{easing.js → cjs/easing.js} +6 -2
  71. package/dist/cjs/freeze.d.ts +11 -0
  72. package/dist/{freeze.js → cjs/freeze.js} +8 -4
  73. package/dist/{get-asset-file-name.d.ts → cjs/get-asset-file-name.d.ts} +0 -0
  74. package/dist/{get-asset-file-name.js → cjs/get-asset-file-name.js} +0 -0
  75. package/dist/cjs/get-environment.d.ts +3 -0
  76. package/dist/{get-environment.js → cjs/get-environment.js} +14 -2
  77. package/dist/cjs/get-preview-dom-element.d.ts +2 -0
  78. package/dist/cjs/get-preview-dom-element.js +8 -0
  79. package/dist/cjs/get-static-files.d.ts +21 -0
  80. package/dist/cjs/get-static-files.js +35 -0
  81. package/dist/{get-timeline-clip-name.d.ts → cjs/get-timeline-clip-name.d.ts} +0 -0
  82. package/dist/{get-timeline-clip-name.js → cjs/get-timeline-clip-name.js} +0 -0
  83. package/dist/cjs/index.d.ts +102 -0
  84. package/dist/cjs/index.js +105 -0
  85. package/dist/cjs/internals.d.ts +131 -0
  86. package/dist/cjs/internals.js +120 -0
  87. package/dist/{interpolate-colors.d.ts → cjs/interpolate-colors.d.ts} +5 -0
  88. package/dist/{interpolate-colors.js → cjs/interpolate-colors.js} +10 -10
  89. package/dist/{interpolate.d.ts → cjs/interpolate.d.ts} +11 -7
  90. package/dist/{interpolate.js → cjs/interpolate.js} +0 -0
  91. package/dist/{is-approximately-the-same.d.ts → cjs/is-approximately-the-same.d.ts} +0 -0
  92. package/dist/{is-approximately-the-same.js → cjs/is-approximately-the-same.js} +0 -0
  93. package/dist/cjs/is-player.d.ts +3 -0
  94. package/dist/cjs/is-player.js +14 -0
  95. package/dist/{loading-indicator.d.ts → cjs/loading-indicator.d.ts} +0 -0
  96. package/dist/{loading-indicator.js → cjs/loading-indicator.js} +4 -4
  97. package/dist/cjs/loop/index.d.ts +13 -0
  98. package/dist/cjs/loop/index.js +46 -0
  99. package/dist/{multiple-versions-warning.d.ts → cjs/multiple-versions-warning.d.ts} +0 -0
  100. package/dist/{multiple-versions-warning.js → cjs/multiple-versions-warning.js} +11 -6
  101. package/dist/{nonce.d.ts → cjs/nonce.d.ts} +1 -1
  102. package/dist/{nonce.js → cjs/nonce.js} +6 -0
  103. package/dist/{play-and-handle-not-allowed-error.d.ts → cjs/play-and-handle-not-allowed-error.d.ts} +0 -0
  104. package/dist/{play-and-handle-not-allowed-error.js → cjs/play-and-handle-not-allowed-error.js} +4 -0
  105. package/dist/{portal-node.d.ts → cjs/portal-node.d.ts} +0 -0
  106. package/dist/{portal-node.js → cjs/portal-node.js} +0 -0
  107. package/dist/cjs/prefetch-state.d.ts +8 -0
  108. package/dist/cjs/prefetch-state.js +27 -0
  109. package/dist/cjs/prefetch.d.ts +13 -0
  110. package/dist/{prefetch.js → cjs/prefetch.js} +43 -17
  111. package/dist/cjs/props-if-has-props.d.ts +10 -0
  112. package/dist/{video-config.js → cjs/props-if-has-props.js} +0 -0
  113. package/dist/cjs/random.d.ts +6 -0
  114. package/dist/{random.js → cjs/random.js} +3 -3
  115. package/dist/{register-root.d.ts → cjs/register-root.d.ts} +4 -0
  116. package/dist/{register-root.js → cjs/register-root.js} +4 -0
  117. package/dist/cjs/resolve-video-config.d.ts +8 -0
  118. package/dist/cjs/resolve-video-config.js +89 -0
  119. package/dist/cjs/series/flatten-children.d.ts +2 -0
  120. package/dist/{series → cjs/series}/flatten-children.js +0 -0
  121. package/dist/cjs/series/index.d.ts +17 -0
  122. package/dist/{series → cjs/series}/index.js +22 -8
  123. package/dist/cjs/setup-env-variables.d.ts +1 -0
  124. package/dist/{setup-env-variables.js → cjs/setup-env-variables.js} +7 -9
  125. package/dist/{spring → cjs/spring}/index.d.ts +10 -6
  126. package/dist/cjs/spring/index.js +75 -0
  127. package/dist/cjs/spring/measure-spring.d.ts +12 -0
  128. package/dist/{spring → cjs/spring}/measure-spring.js +8 -4
  129. package/dist/{spring → cjs/spring}/spring-utils.d.ts +2 -2
  130. package/dist/{spring → cjs/spring}/spring-utils.js +0 -0
  131. package/dist/cjs/static-file.d.ts +33 -0
  132. package/dist/cjs/static-file.js +87 -0
  133. package/dist/{timeline-position-state.d.ts → cjs/timeline-position-state.d.ts} +4 -4
  134. package/dist/{timeline-position-state.js → cjs/timeline-position-state.js} +9 -1
  135. package/dist/cjs/truthy.d.ts +3 -0
  136. package/dist/{truthy.js → cjs/truthy.js} +0 -0
  137. package/dist/cjs/use-current-frame.d.ts +5 -0
  138. package/dist/{use-current-frame.js → cjs/use-current-frame.js} +8 -9
  139. package/dist/cjs/use-lazy-component.d.ts +7 -0
  140. package/dist/{use-lazy-component.js → cjs/use-lazy-component.js} +0 -0
  141. package/dist/{use-media-in-timeline.d.ts → cjs/use-media-in-timeline.d.ts} +3 -2
  142. package/dist/{use-media-in-timeline.js → cjs/use-media-in-timeline.js} +29 -25
  143. package/dist/{use-media-playback.d.ts → cjs/use-media-playback.d.ts} +3 -1
  144. package/dist/cjs/use-media-playback.js +86 -0
  145. package/dist/{use-media-tag-volume.d.ts → cjs/use-media-tag-volume.d.ts} +0 -0
  146. package/dist/{use-media-tag-volume.js → cjs/use-media-tag-volume.js} +0 -0
  147. package/dist/{use-sync-volume-with-media-tag.d.ts → cjs/use-sync-volume-with-media-tag.d.ts} +2 -2
  148. package/dist/{use-sync-volume-with-media-tag.js → cjs/use-sync-volume-with-media-tag.js} +5 -4
  149. package/dist/{use-unsafe-video-config.d.ts → cjs/use-unsafe-video-config.d.ts} +1 -1
  150. package/dist/{use-unsafe-video-config.js → cjs/use-unsafe-video-config.js} +4 -4
  151. package/dist/cjs/use-video-config.d.ts +8 -0
  152. package/dist/cjs/use-video-config.js +34 -0
  153. package/dist/cjs/use-video.d.ts +7 -0
  154. package/dist/cjs/use-video.js +38 -0
  155. package/dist/cjs/validate-frame.d.ts +5 -0
  156. package/dist/cjs/validate-frame.js +24 -0
  157. package/dist/cjs/validate-media-props.d.ts +4 -0
  158. package/dist/{validate-media-props.js → cjs/validate-media-props.js} +0 -0
  159. package/dist/{validate-start-from-props.d.ts → cjs/validate-start-from-props.d.ts} +0 -0
  160. package/dist/{validate-start-from-props.js → cjs/validate-start-from-props.js} +0 -0
  161. package/dist/{validation → cjs/validation}/validate-composition-id.d.ts +0 -0
  162. package/dist/{validation → cjs/validation}/validate-composition-id.js +0 -0
  163. package/dist/cjs/validation/validate-default-props.d.ts +1 -0
  164. package/dist/cjs/validation/validate-default-props.js +15 -0
  165. package/dist/{validation → cjs/validation}/validate-dimensions.d.ts +0 -0
  166. package/dist/{validation → cjs/validation}/validate-dimensions.js +0 -0
  167. package/dist/cjs/validation/validate-duration-in-frames.d.ts +5 -0
  168. package/dist/{validation → cjs/validation}/validate-duration-in-frames.js +5 -2
  169. package/dist/{validation → cjs/validation}/validate-folder-name.d.ts +0 -0
  170. package/dist/{validation → cjs/validation}/validate-folder-name.js +0 -0
  171. package/dist/{validation → cjs/validation}/validate-fps.d.ts +0 -0
  172. package/dist/{validation → cjs/validation}/validate-fps.js +0 -0
  173. package/dist/{validation → cjs/validation}/validation-spring-duration.d.ts +0 -0
  174. package/dist/{validation → cjs/validation}/validation-spring-duration.js +0 -0
  175. package/dist/cjs/version.d.ts +1 -0
  176. package/dist/{version.js → cjs/version.js} +1 -1
  177. package/dist/cjs/video/OffthreadVideo.d.ts +7 -0
  178. package/dist/cjs/video/OffthreadVideo.js +38 -0
  179. package/dist/{video → cjs/video}/OffthreadVideoForRendering.d.ts +1 -1
  180. package/dist/cjs/video/OffthreadVideoForRendering.js +103 -0
  181. package/dist/cjs/video/Video.d.ts +12 -0
  182. package/dist/cjs/video/Video.js +55 -0
  183. package/dist/{video → cjs/video}/VideoForDevelopment.d.ts +5 -2
  184. package/dist/cjs/video/VideoForDevelopment.js +117 -0
  185. package/dist/cjs/video/VideoForRendering.d.ts +10 -0
  186. package/dist/cjs/video/VideoForRendering.js +208 -0
  187. package/dist/cjs/video/duration-state.d.ts +17 -0
  188. package/dist/cjs/video/duration-state.js +35 -0
  189. package/dist/{video → cjs/video}/get-current-time.d.ts +0 -0
  190. package/dist/{video → cjs/video}/get-current-time.js +12 -11
  191. package/dist/cjs/video/index.d.ts +3 -0
  192. package/dist/{video → cjs/video}/index.js +4 -4
  193. package/dist/cjs/video/props.d.ts +32 -0
  194. package/dist/cjs/video/props.js +2 -0
  195. package/dist/cjs/video/video-fragment.d.ts +12 -0
  196. package/dist/cjs/video/video-fragment.js +60 -0
  197. package/dist/{video-config.d.ts → cjs/video-config.d.ts} +2 -2
  198. package/dist/{video/props.js → cjs/video-config.js} +0 -0
  199. package/dist/{volume-position-state.d.ts → cjs/volume-position-state.d.ts} +4 -4
  200. package/dist/{volume-position-state.js → cjs/volume-position-state.js} +0 -0
  201. package/dist/{volume-prop.d.ts → cjs/volume-prop.d.ts} +3 -2
  202. package/dist/{volume-prop.js → cjs/volume-prop.js} +4 -3
  203. package/dist/{warn-about-non-seekable-media.d.ts → cjs/warn-about-non-seekable-media.d.ts} +0 -0
  204. package/dist/{warn-about-non-seekable-media.js → cjs/warn-about-non-seekable-media.js} +2 -2
  205. package/dist/cjs/wrap-remotion-context.d.ts +31 -0
  206. package/dist/cjs/wrap-remotion-context.js +85 -0
  207. package/dist/esm/index.mjs +4623 -0
  208. package/dist/esm/version.mjs +4 -0
  209. package/package.json +80 -57
  210. package/version.js +2 -1
  211. package/.prettierrc.js +0 -14
  212. package/.turbo/turbo-build.log +0 -5
  213. package/dist/Composition.d.ts +0 -22
  214. package/dist/Composition.js +0 -98
  215. package/dist/CompositionManager.d.ts +0 -79
  216. package/dist/Img.d.ts +0 -2
  217. package/dist/Img.js +0 -51
  218. package/dist/RemotionRoot.js +0 -71
  219. package/dist/Sequence.d.ts +0 -29
  220. package/dist/Still.d.ts +0 -3
  221. package/dist/Still.js +0 -9
  222. package/dist/audio/Audio.js +0 -32
  223. package/dist/audio/AudioForDevelopment.d.ts +0 -8
  224. package/dist/audio/AudioForDevelopment.js +0 -71
  225. package/dist/audio/AudioForRendering.d.ts +0 -6
  226. package/dist/audio/AudioForRendering.js +0 -75
  227. package/dist/audio/index.d.ts +0 -2
  228. package/dist/audio/props.d.ts +0 -10
  229. package/dist/config.d.ts +0 -218
  230. package/dist/config.js +0 -21
  231. package/dist/freeze.d.ts +0 -7
  232. package/dist/get-environment.d.ts +0 -2
  233. package/dist/get-preview-dom-element.d.ts +0 -1
  234. package/dist/get-preview-dom-element.js +0 -7
  235. package/dist/index.d.ts +0 -72
  236. package/dist/index.js +0 -58
  237. package/dist/internals.d.ts +0 -88
  238. package/dist/internals.js +0 -93
  239. package/dist/loop/index.d.ts +0 -9
  240. package/dist/loop/index.js +0 -28
  241. package/dist/prefetch-state.d.ts +0 -13
  242. package/dist/prefetch-state.js +0 -26
  243. package/dist/prefetch.d.ts +0 -7
  244. package/dist/random.d.ts +0 -6
  245. package/dist/series/flatten-children.d.ts +0 -2
  246. package/dist/series/index.d.ts +0 -13
  247. package/dist/setup-env-variables.d.ts +0 -2
  248. package/dist/spring/index.js +0 -51
  249. package/dist/spring/measure-spring.d.ts +0 -8
  250. package/dist/static-file.d.ts +0 -1
  251. package/dist/static-file.js +0 -29
  252. package/dist/truthy.d.ts +0 -3
  253. package/dist/use-current-frame.d.ts +0 -6
  254. package/dist/use-lazy-component.d.ts +0 -7
  255. package/dist/use-media-playback.js +0 -75
  256. package/dist/use-video-config.d.ts +0 -7
  257. package/dist/use-video-config.js +0 -26
  258. package/dist/use-video.d.ts +0 -13
  259. package/dist/use-video.js +0 -28
  260. package/dist/validate-media-props.d.ts +0 -4
  261. package/dist/validation/validate-duration-in-frames.d.ts +0 -1
  262. package/dist/validation/validate-offthreadvideo-image-format.d.ts +0 -1
  263. package/dist/validation/validate-offthreadvideo-image-format.js +0 -15
  264. package/dist/version.d.ts +0 -1
  265. package/dist/video/LoopedVideo.d.ts +0 -3
  266. package/dist/video/LoopedVideo.js +0 -16
  267. package/dist/video/OffthreadVideo.d.ts +0 -3
  268. package/dist/video/OffthreadVideo.js +0 -27
  269. package/dist/video/OffthreadVideoForRendering.js +0 -101
  270. package/dist/video/Video.d.ts +0 -6
  271. package/dist/video/Video.js +0 -29
  272. package/dist/video/VideoForDevelopment.js +0 -69
  273. package/dist/video/VideoForRendering.d.ts +0 -6
  274. package/dist/video/VideoForRendering.js +0 -168
  275. package/dist/video/duration-state.d.ts +0 -8
  276. package/dist/video/duration-state.js +0 -15
  277. package/dist/video/index.d.ts +0 -3
  278. package/dist/video/props.d.ts +0 -21
  279. package/dist/wrap-remotion-context.d.ts +0 -14
  280. package/dist/wrap-remotion-context.js +0 -65
  281. package/ensure-correct-version.js +0 -24
  282. package/tsconfig.json +0 -12
  283. package/version.d.ts +0 -1
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ import type { LoopDisplay } from './CompositionManager.js';
3
+ export type LayoutAndStyle = {
4
+ layout: 'none';
5
+ } | {
6
+ layout?: 'absolute-fill';
7
+ style?: React.CSSProperties;
8
+ className?: string;
9
+ };
10
+ export type SequenceProps = {
11
+ children: React.ReactNode;
12
+ from?: number;
13
+ durationInFrames?: number;
14
+ name?: string;
15
+ showInTimeline?: boolean;
16
+ loopDisplay?: LoopDisplay;
17
+ } & LayoutAndStyle;
18
+ /**
19
+ * @description A component that time-shifts its children and wraps them in an absolutely positioned <div>.
20
+ * @see [Documentation](https://www.remotion.dev/docs/sequence]
21
+ */
22
+ export declare const Sequence: React.ForwardRefExoticComponent<SequenceProps & React.RefAttributes<HTMLDivElement>>;
@@ -1,25 +1,26 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Sequence = exports.SequenceContext = void 0;
3
+ exports.Sequence = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
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");
13
- exports.SequenceContext = (0, react_1.createContext)(null);
14
- const SequenceRefForwardingFunction = ({ from, durationInFrames = Infinity, children, name, showInTimeline = true, showLoopTimesInTimeline, ...other }, ref) => {
6
+ const AbsoluteFill_js_1 = require("./AbsoluteFill.js");
7
+ const get_environment_js_1 = require("./get-environment.js");
8
+ const get_timeline_clip_name_js_1 = require("./get-timeline-clip-name.js");
9
+ const nonce_js_1 = require("./nonce.js");
10
+ const SequenceContext_js_1 = require("./SequenceContext.js");
11
+ const SequenceManager_js_1 = require("./SequenceManager.js");
12
+ const timeline_position_state_js_1 = require("./timeline-position-state.js");
13
+ const use_video_config_js_1 = require("./use-video-config.js");
14
+ const SequenceRefForwardingFunction = ({ from = 0, durationInFrames = Infinity, children, name, showInTimeline = true, loopDisplay, ...other }, ref) => {
15
15
  const { layout = 'absolute-fill' } = other;
16
16
  const [id] = (0, react_1.useState)(() => String(Math.random()));
17
- const parentSequence = (0, react_1.useContext)(exports.SequenceContext);
18
- const { rootId } = (0, react_1.useContext)(timeline_position_state_1.TimelineContext);
17
+ const parentSequence = (0, react_1.useContext)(SequenceContext_js_1.SequenceContext);
18
+ const { rootId } = (0, react_1.useContext)(timeline_position_state_js_1.TimelineContext);
19
19
  const cumulatedFrom = parentSequence
20
20
  ? parentSequence.cumulatedFrom + parentSequence.relativeFrom
21
21
  : 0;
22
- const nonce = (0, nonce_1.useNonce)();
22
+ const nonce = (0, nonce_js_1.useNonce)();
23
+ const environment = (0, get_environment_js_1.useRemotionEnvironment)();
23
24
  if (layout !== 'absolute-fill' && layout !== 'none') {
24
25
  throw new TypeError(`The layout prop of <Sequence /> expects either "absolute-fill" or "none", but you passed: ${layout}`);
25
26
  }
@@ -33,23 +34,19 @@ const SequenceRefForwardingFunction = ({ from, durationInFrames = Infinity, chil
33
34
  if (durationInFrames <= 0) {
34
35
  throw new TypeError(`durationInFrames must be positive, but got ${durationInFrames}`);
35
36
  }
36
- // Infinity is non-integer but allowed!
37
- if (durationInFrames % 1 !== 0 && Number.isFinite(durationInFrames)) {
38
- throw new TypeError(`The "durationInFrames" of a sequence must be an integer, but got ${durationInFrames}.`);
39
- }
40
37
  if (typeof from !== 'number') {
41
38
  throw new TypeError(`You passed to the "from" props of your <Sequence> an argument of type ${typeof from}, but it must be a number.`);
42
39
  }
43
- if (from % 1 !== 0) {
44
- throw new TypeError(`The "from" prop of a sequence must be an integer, but got ${from}.`);
40
+ if (!Number.isFinite(from)) {
41
+ throw new TypeError(`The "from" prop of a sequence must be finite, but got ${from}.`);
45
42
  }
46
- const absoluteFrame = (0, timeline_position_state_1.useTimelinePosition)();
47
- const videoConfig = (0, use_video_config_1.useVideoConfig)();
43
+ const absoluteFrame = (0, timeline_position_state_js_1.useTimelinePosition)();
44
+ const videoConfig = (0, use_video_config_js_1.useVideoConfig)();
48
45
  const parentSequenceDuration = parentSequence
49
46
  ? Math.min(parentSequence.durationInFrames - from, durationInFrames)
50
47
  : durationInFrames;
51
48
  const actualDurationInFrames = Math.max(0, Math.min(videoConfig.durationInFrames - from, parentSequenceDuration));
52
- const { registerSequence, unregisterSequence } = (0, react_1.useContext)(CompositionManager_1.CompositionManager);
49
+ const { registerSequence, unregisterSequence } = (0, react_1.useContext)(SequenceManager_js_1.SequenceManager);
53
50
  const contextValue = (0, react_1.useMemo)(() => {
54
51
  var _a;
55
52
  return {
@@ -67,11 +64,11 @@ const SequenceRefForwardingFunction = ({ from, durationInFrames = Infinity, chil
67
64
  id,
68
65
  ]);
69
66
  const timelineClipName = (0, react_1.useMemo)(() => {
70
- return name !== null && name !== void 0 ? name : (0, get_timeline_clip_name_1.getTimelineClipName)(children);
67
+ return name !== null && name !== void 0 ? name : (0, get_timeline_clip_name_js_1.getTimelineClipName)(children);
71
68
  }, [children, name]);
72
69
  (0, react_1.useEffect)(() => {
73
70
  var _a;
74
- if ((0, get_environment_1.getRemotionEnvironment)() !== 'preview') {
71
+ if (environment !== 'preview') {
75
72
  return;
76
73
  }
77
74
  registerSequence({
@@ -84,7 +81,7 @@ const SequenceRefForwardingFunction = ({ from, durationInFrames = Infinity, chil
84
81
  rootId,
85
82
  showInTimeline,
86
83
  nonce,
87
- showLoopTimesInTimeline,
84
+ loopDisplay,
88
85
  });
89
86
  return () => {
90
87
  unregisterSequence(id);
@@ -102,7 +99,8 @@ const SequenceRefForwardingFunction = ({ from, durationInFrames = Infinity, chil
102
99
  from,
103
100
  showInTimeline,
104
101
  nonce,
105
- showLoopTimesInTimeline,
102
+ loopDisplay,
103
+ environment,
106
104
  ]);
107
105
  const endThreshold = cumulatedFrom + from + durationInFrames - 1;
108
106
  const content = absoluteFrame < cumulatedFrom + from
@@ -120,10 +118,10 @@ const SequenceRefForwardingFunction = ({ from, durationInFrames = Infinity, chil
120
118
  if (ref !== null && layout === 'none') {
121
119
  throw new TypeError('It is not supported to pass both a `ref` and `layout="none"` to <Sequence />.');
122
120
  }
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) }));
121
+ return ((0, jsx_runtime_1.jsx)(SequenceContext_js_1.SequenceContext.Provider, { value: contextValue, children: content === null ? null : other.layout === 'none' ? (content) : ((0, jsx_runtime_1.jsx)(AbsoluteFill_js_1.AbsoluteFill, { ref: ref, style: defaultStyle, className: other.className, children: content })) }));
124
122
  };
125
123
  /**
126
- * A component that time-shifts its children and wraps them in an absolutely positioned <div>.
127
- * @link https://www.remotion.dev/docs/sequence
124
+ * @description A component that time-shifts its children and wraps them in an absolutely positioned <div>.
125
+ * @see [Documentation](https://www.remotion.dev/docs/sequence]
128
126
  */
129
127
  exports.Sequence = (0, react_1.forwardRef)(SequenceRefForwardingFunction);
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ export declare const SequenceContext: import("react").Context<SequenceContextType | null>;
3
+ export type SequenceContextType = {
4
+ cumulatedFrom: number;
5
+ relativeFrom: number;
6
+ parentFrom: number;
7
+ durationInFrames: number;
8
+ id: string;
9
+ };
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SequenceContext = void 0;
4
+ const react_1 = require("react");
5
+ exports.SequenceContext = (0, react_1.createContext)(null);
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import type { TSequence } from './CompositionManager.js';
3
+ export type SequenceManagerContext = {
4
+ registerSequence: (seq: TSequence) => void;
5
+ unregisterSequence: (id: string) => void;
6
+ sequences: TSequence[];
7
+ };
8
+ export declare const SequenceManager: React.Context<SequenceManagerContext>;
9
+ export declare const SequenceManagerProvider: React.FC<{
10
+ children: React.ReactNode;
11
+ }>;
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.SequenceManagerProvider = exports.SequenceManager = void 0;
27
+ const jsx_runtime_1 = require("react/jsx-runtime");
28
+ const react_1 = __importStar(require("react"));
29
+ exports.SequenceManager = react_1.default.createContext({
30
+ registerSequence: () => {
31
+ throw new Error('SequenceManagerContext not initialized');
32
+ },
33
+ unregisterSequence: () => {
34
+ throw new Error('SequenceManagerContext not initialized');
35
+ },
36
+ sequences: [],
37
+ });
38
+ const SequenceManagerProvider = ({ children }) => {
39
+ const [sequences, setSequences] = (0, react_1.useState)([]);
40
+ const registerSequence = (0, react_1.useCallback)((seq) => {
41
+ setSequences((seqs) => {
42
+ return [...seqs, seq];
43
+ });
44
+ }, []);
45
+ const unregisterSequence = (0, react_1.useCallback)((seq) => {
46
+ setSequences((seqs) => seqs.filter((s) => s.id !== seq));
47
+ }, []);
48
+ const context = (0, react_1.useMemo)(() => {
49
+ return {
50
+ registerSequence,
51
+ sequences,
52
+ unregisterSequence,
53
+ };
54
+ }, [registerSequence, sequences, unregisterSequence]);
55
+ return ((0, jsx_runtime_1.jsx)(exports.SequenceManager.Provider, { value: context, children: children }));
56
+ };
57
+ exports.SequenceManagerProvider = SequenceManagerProvider;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import type { AnyZodObject } from 'zod';
3
+ import type { StillProps } from './Composition.js';
4
+ /**
5
+ * @description A `<Still />` is a `<Composition />` that is only 1 frame long.
6
+ * @see [Documentation](https://www.remotion.dev/docs/still)
7
+ */
8
+ export declare const Still: <Schema extends AnyZodObject, Props extends Record<string, unknown> | undefined>(props: StillProps<Schema, Props>) => React.DetailedReactHTMLElement<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Still = void 0;
7
+ const react_1 = __importDefault(require("react"));
8
+ const Composition_js_1 = require("./Composition.js");
9
+ /**
10
+ * @description A `<Still />` is a `<Composition />` that is only 1 frame long.
11
+ * @see [Documentation](https://www.remotion.dev/docs/still)
12
+ */
13
+ const Still = (props) => {
14
+ const newProps = {
15
+ ...props,
16
+ durationInFrames: 1,
17
+ fps: 1,
18
+ };
19
+ // @ts-expect-error TypeScript does not understand it, but should still fail on type mismatch
20
+ return react_1.default.createElement((Composition_js_1.Composition), newProps);
21
+ };
22
+ exports.Still = Still;
File without changes
File without changes
File without changes
@@ -1,6 +1,12 @@
1
1
  import React from 'react';
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
- volume?: import("../volume-prop").VolumeProp | undefined;
2
+ import type { RemotionMainAudioProps } from './props.js';
3
+ /**
4
+ * @description With this component, you can add audio to your video. All audio formats which are supported by Chromium are supported by the component.
5
+ * @see [Documentation](https://www.remotion.dev/docs/audio)
6
+ */
7
+ export declare const Audio: React.ForwardRefExoticComponent<Pick<Omit<React.DetailedHTMLProps<React.AudioHTMLAttributes<HTMLAudioElement>, HTMLAudioElement>, "nonce" | "onEnded" | "onResize" | "onResizeCapture" | "autoPlay" | "controls"> & {
8
+ volume?: import("../volume-prop.js").VolumeProp | undefined;
5
9
  playbackRate?: number | undefined;
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>>;
10
+ acceptableTimeShiftInSeconds?: number | undefined;
11
+ allowAmplificationDuringRender?: boolean | undefined;
12
+ } & 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" | "volume" | "allowAmplificationDuringRender" | "controlsList" | "crossOrigin" | "loop" | "mediaGroup" | "muted" | "playsInline" | "preload" | "src" | "playbackRate" | "acceptableTimeShiftInSeconds" | keyof RemotionMainAudioProps> & React.RefAttributes<HTMLAudioElement>>;
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Audio = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const absolute_src_js_1 = require("../absolute-src.js");
7
+ const cancel_render_js_1 = require("../cancel-render.js");
8
+ const get_environment_js_1 = require("../get-environment.js");
9
+ const index_js_1 = require("../loop/index.js");
10
+ const Sequence_js_1 = require("../Sequence.js");
11
+ const use_video_config_js_1 = require("../use-video-config.js");
12
+ const validate_media_props_js_1 = require("../validate-media-props.js");
13
+ const validate_start_from_props_js_1 = require("../validate-start-from-props.js");
14
+ const duration_state_js_1 = require("../video/duration-state.js");
15
+ const AudioForDevelopment_js_1 = require("./AudioForDevelopment.js");
16
+ const AudioForRendering_js_1 = require("./AudioForRendering.js");
17
+ const shared_audio_tags_js_1 = require("./shared-audio-tags.js");
18
+ const AudioRefForwardingFunction = (props, ref) => {
19
+ var _a;
20
+ const audioContext = (0, react_1.useContext)(shared_audio_tags_js_1.SharedAudioContext);
21
+ const { startFrom, endAt, ...otherProps } = props;
22
+ const { loop, ...propsOtherThanLoop } = props;
23
+ const { fps } = (0, use_video_config_js_1.useVideoConfig)();
24
+ const environment = (0, get_environment_js_1.useRemotionEnvironment)();
25
+ const { durations, setDurations } = (0, react_1.useContext)(duration_state_js_1.DurationsContext);
26
+ if (typeof props.src !== 'string') {
27
+ throw new TypeError(`The \`<Audio>\` tag requires a string for \`src\`, but got ${JSON.stringify(props.src)} instead.`);
28
+ }
29
+ const onError = (0, react_1.useCallback)((e) => {
30
+ console.log(e.currentTarget.error);
31
+ (0, cancel_render_js_1.cancelRender)(new Error(`Could not play audio with src ${otherProps.src}: ${e.currentTarget.error}. See https://remotion.dev/docs/media-playback-error for help.`));
32
+ }, [otherProps.src]);
33
+ const onDuration = (0, react_1.useCallback)((src, durationInSeconds) => {
34
+ setDurations({ type: 'got-duration', durationInSeconds, src });
35
+ }, [setDurations]);
36
+ if (loop && props.src && durations[(0, absolute_src_js_1.getAbsoluteSrc)(props.src)] !== undefined) {
37
+ const duration = Math.floor(durations[(0, absolute_src_js_1.getAbsoluteSrc)(props.src)] * fps);
38
+ const playbackRate = (_a = props.playbackRate) !== null && _a !== void 0 ? _a : 1;
39
+ const actualDuration = duration / playbackRate;
40
+ return ((0, jsx_runtime_1.jsx)(index_js_1.Loop, { layout: "none", durationInFrames: Math.floor(actualDuration), children: (0, jsx_runtime_1.jsx)(exports.Audio, { ...propsOtherThanLoop, ref: ref }) }));
41
+ }
42
+ if (typeof startFrom !== 'undefined' || typeof endAt !== 'undefined') {
43
+ (0, validate_start_from_props_js_1.validateStartFromProps)(startFrom, endAt);
44
+ const startFromFrameNo = startFrom !== null && startFrom !== void 0 ? startFrom : 0;
45
+ const endAtFrameNo = endAt !== null && endAt !== void 0 ? endAt : Infinity;
46
+ return ((0, jsx_runtime_1.jsx)(Sequence_js_1.Sequence, { layout: "none", from: 0 - startFromFrameNo, showInTimeline: false, durationInFrames: endAtFrameNo, children: (0, jsx_runtime_1.jsx)(exports.Audio, { ...otherProps, ref: ref }) }));
47
+ }
48
+ (0, validate_media_props_js_1.validateMediaProps)(props, 'Audio');
49
+ if (environment === 'rendering') {
50
+ return ((0, jsx_runtime_1.jsx)(AudioForRendering_js_1.AudioForRendering, { onDuration: onDuration, ...props, ref: ref, onError: onError }));
51
+ }
52
+ return ((0, jsx_runtime_1.jsx)(AudioForDevelopment_js_1.AudioForDevelopment, { shouldPreMountAudioTags: audioContext !== null && audioContext.numberOfAudioTags > 0, ...props, ref: ref, onError: onError, onDuration: onDuration }));
53
+ };
54
+ /**
55
+ * @description With this component, you can add audio to your video. All audio formats which are supported by Chromium are supported by the component.
56
+ * @see [Documentation](https://www.remotion.dev/docs/audio)
57
+ */
58
+ exports.Audio = (0, react_1.forwardRef)(AudioRefForwardingFunction);
@@ -0,0 +1,11 @@
1
+ import type { ForwardRefExoticComponent, RefAttributes } from 'react';
2
+ import React from 'react';
3
+ export declare const AudioForDevelopment: ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.AudioHTMLAttributes<HTMLAudioElement>, HTMLAudioElement>, "nonce" | "onEnded" | "onResize" | "onResizeCapture" | "autoPlay" | "controls"> & {
4
+ volume?: import("../volume-prop.js").VolumeProp | undefined;
5
+ playbackRate?: number | undefined;
6
+ acceptableTimeShiftInSeconds?: number | undefined;
7
+ allowAmplificationDuringRender?: boolean | undefined;
8
+ } & {
9
+ shouldPreMountAudioTags: boolean;
10
+ onDuration: (src: string, durationInSeconds: number) => void;
11
+ } & RefAttributes<HTMLAudioElement>>;
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AudioForDevelopment = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const prefetch_js_1 = require("../prefetch.js");
7
+ const random_js_1 = require("../random.js");
8
+ const SequenceContext_js_1 = require("../SequenceContext.js");
9
+ const use_media_in_timeline_js_1 = require("../use-media-in-timeline.js");
10
+ const use_media_playback_js_1 = require("../use-media-playback.js");
11
+ const use_media_tag_volume_js_1 = require("../use-media-tag-volume.js");
12
+ const use_sync_volume_with_media_tag_js_1 = require("../use-sync-volume-with-media-tag.js");
13
+ const volume_position_state_js_1 = require("../volume-position-state.js");
14
+ const shared_audio_tags_js_1 = require("./shared-audio-tags.js");
15
+ const use_audio_frame_js_1 = require("./use-audio-frame.js");
16
+ const AudioForDevelopmentForwardRefFunction = (props, ref) => {
17
+ const [initialShouldPreMountAudioElements] = (0, react_1.useState)(props.shouldPreMountAudioTags);
18
+ if (props.shouldPreMountAudioTags !== initialShouldPreMountAudioElements) {
19
+ throw new Error('Cannot change the behavior for pre-mounting audio tags dynamically.');
20
+ }
21
+ const [mediaVolume] = (0, volume_position_state_js_1.useMediaVolumeState)();
22
+ const [mediaMuted] = (0, volume_position_state_js_1.useMediaMutedState)();
23
+ const volumePropFrame = (0, use_audio_frame_js_1.useFrameForVolumeProp)();
24
+ const { volume, muted, playbackRate, shouldPreMountAudioTags, src, onDuration, acceptableTimeShiftInSeconds, ...nativeProps } = props;
25
+ if (!src) {
26
+ throw new TypeError("No 'src' was passed to <Audio>.");
27
+ }
28
+ const preloadedSrc = (0, prefetch_js_1.usePreload)(src);
29
+ const propsToPass = (0, react_1.useMemo)(() => {
30
+ return {
31
+ muted: muted || mediaMuted,
32
+ src: preloadedSrc,
33
+ ...nativeProps,
34
+ };
35
+ }, [mediaMuted, muted, nativeProps, preloadedSrc]);
36
+ const sequenceContext = (0, react_1.useContext)(SequenceContext_js_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_js_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}-loop:${props.loop}`, [
40
+ src,
41
+ sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.relativeFrom,
42
+ sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.cumulatedFrom,
43
+ sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.durationInFrames,
44
+ props.muted,
45
+ props.loop,
46
+ ]);
47
+ const audioRef = (0, shared_audio_tags_js_1.useSharedAudio)(propsToPass, id).el;
48
+ const actualVolume = (0, use_media_tag_volume_js_1.useMediaTagVolume)(audioRef);
49
+ (0, use_sync_volume_with_media_tag_js_1.useSyncVolumeWithMediaTag)({
50
+ volumePropFrame,
51
+ actualVolume,
52
+ volume,
53
+ mediaVolume,
54
+ mediaRef: audioRef,
55
+ });
56
+ (0, use_media_in_timeline_js_1.useMediaInTimeline)({
57
+ volume,
58
+ mediaVolume,
59
+ mediaRef: audioRef,
60
+ src,
61
+ mediaType: 'audio',
62
+ playbackRate: playbackRate !== null && playbackRate !== void 0 ? playbackRate : 1,
63
+ });
64
+ (0, use_media_playback_js_1.useMediaPlayback)({
65
+ mediaRef: audioRef,
66
+ src,
67
+ mediaType: 'audio',
68
+ playbackRate: playbackRate !== null && playbackRate !== void 0 ? playbackRate : 1,
69
+ onlyWarnForMediaSeekingError: false,
70
+ acceptableTimeshift: acceptableTimeShiftInSeconds !== null && acceptableTimeShiftInSeconds !== void 0 ? acceptableTimeShiftInSeconds : use_media_playback_js_1.DEFAULT_ACCEPTABLE_TIMESHIFT,
71
+ });
72
+ (0, react_1.useImperativeHandle)(ref, () => {
73
+ return audioRef.current;
74
+ }, [audioRef]);
75
+ const currentOnDurationCallback = (0, react_1.useRef)();
76
+ currentOnDurationCallback.current = onDuration;
77
+ (0, react_1.useEffect)(() => {
78
+ var _a;
79
+ const { current } = audioRef;
80
+ if (!current) {
81
+ return;
82
+ }
83
+ if (current.duration) {
84
+ (_a = currentOnDurationCallback.current) === null || _a === void 0 ? void 0 : _a.call(currentOnDurationCallback, current.src, current.duration);
85
+ return;
86
+ }
87
+ const onLoadedMetadata = () => {
88
+ var _a;
89
+ (_a = currentOnDurationCallback.current) === null || _a === void 0 ? void 0 : _a.call(currentOnDurationCallback, current.src, current.duration);
90
+ };
91
+ current.addEventListener('loadedmetadata', onLoadedMetadata);
92
+ return () => {
93
+ current.removeEventListener('loadedmetadata', onLoadedMetadata);
94
+ };
95
+ }, [audioRef, src]);
96
+ if (initialShouldPreMountAudioElements) {
97
+ return null;
98
+ }
99
+ return (0, jsx_runtime_1.jsx)("audio", { ref: audioRef, ...propsToPass });
100
+ };
101
+ exports.AudioForDevelopment = (0, react_1.forwardRef)(AudioForDevelopmentForwardRefFunction);
@@ -0,0 +1,10 @@
1
+ import type { ForwardRefExoticComponent, RefAttributes } from 'react';
2
+ import React from 'react';
3
+ export declare const AudioForRendering: ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.AudioHTMLAttributes<HTMLAudioElement>, HTMLAudioElement>, "nonce" | "onEnded" | "onResize" | "onResizeCapture" | "autoPlay" | "controls"> & {
4
+ volume?: import("../volume-prop.js").VolumeProp | undefined;
5
+ playbackRate?: number | undefined;
6
+ acceptableTimeShiftInSeconds?: number | undefined;
7
+ allowAmplificationDuringRender?: boolean | undefined;
8
+ } & {
9
+ onDuration: (src: string, durationInSeconds: number) => void;
10
+ } & RefAttributes<HTMLAudioElement>>;
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AudioForRendering = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const absolute_src_js_1 = require("../absolute-src.js");
7
+ const AssetManager_js_1 = require("../AssetManager.js");
8
+ const delay_render_js_1 = require("../delay-render.js");
9
+ const get_environment_js_1 = require("../get-environment.js");
10
+ const random_js_1 = require("../random.js");
11
+ const SequenceContext_js_1 = require("../SequenceContext.js");
12
+ const timeline_position_state_js_1 = require("../timeline-position-state.js");
13
+ const use_current_frame_js_1 = require("../use-current-frame.js");
14
+ const volume_prop_js_1 = require("../volume-prop.js");
15
+ const use_audio_frame_js_1 = require("./use-audio-frame.js");
16
+ const AudioForRenderingRefForwardingFunction = (props, ref) => {
17
+ const audioRef = (0, react_1.useRef)(null);
18
+ const absoluteFrame = (0, timeline_position_state_js_1.useTimelinePosition)();
19
+ const volumePropFrame = (0, use_audio_frame_js_1.useFrameForVolumeProp)();
20
+ const frame = (0, use_current_frame_js_1.useCurrentFrame)();
21
+ const sequenceContext = (0, react_1.useContext)(SequenceContext_js_1.SequenceContext);
22
+ const { registerAsset, unregisterAsset } = (0, react_1.useContext)(AssetManager_js_1.AssetManager);
23
+ const environment = (0, get_environment_js_1.useRemotionEnvironment)();
24
+ // Generate a string that's as unique as possible for this asset
25
+ // but at the same time the same on all threads
26
+ const id = (0, react_1.useMemo)(() => {
27
+ var _a;
28
+ return `audio-${(0, random_js_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}`;
29
+ }, [props.src, sequenceContext]);
30
+ const { volume: volumeProp, playbackRate, allowAmplificationDuringRender, onDuration, ...nativeProps } = props;
31
+ const volume = (0, volume_prop_js_1.evaluateVolume)({
32
+ volume: volumeProp,
33
+ frame: volumePropFrame,
34
+ mediaVolume: 1,
35
+ allowAmplificationDuringRender: allowAmplificationDuringRender !== null && allowAmplificationDuringRender !== void 0 ? allowAmplificationDuringRender : false,
36
+ });
37
+ (0, react_1.useImperativeHandle)(ref, () => {
38
+ return audioRef.current;
39
+ }, []);
40
+ (0, react_1.useEffect)(() => {
41
+ var _a;
42
+ if (!props.src) {
43
+ throw new Error('No src passed');
44
+ }
45
+ if (!window.remotion_audioEnabled) {
46
+ return;
47
+ }
48
+ if (props.muted) {
49
+ return;
50
+ }
51
+ if (volume <= 0) {
52
+ return;
53
+ }
54
+ registerAsset({
55
+ type: 'audio',
56
+ src: (0, absolute_src_js_1.getAbsoluteSrc)(props.src),
57
+ id,
58
+ frame: absoluteFrame,
59
+ volume,
60
+ mediaFrame: frame,
61
+ playbackRate: (_a = props.playbackRate) !== null && _a !== void 0 ? _a : 1,
62
+ allowAmplificationDuringRender: allowAmplificationDuringRender !== null && allowAmplificationDuringRender !== void 0 ? allowAmplificationDuringRender : false,
63
+ });
64
+ return () => unregisterAsset(id);
65
+ }, [
66
+ props.muted,
67
+ props.src,
68
+ registerAsset,
69
+ absoluteFrame,
70
+ id,
71
+ unregisterAsset,
72
+ volume,
73
+ volumePropFrame,
74
+ frame,
75
+ playbackRate,
76
+ props.playbackRate,
77
+ allowAmplificationDuringRender,
78
+ ]);
79
+ const { src } = props;
80
+ // If audio source switches, make new handle
81
+ if (environment === 'rendering') {
82
+ // eslint-disable-next-line react-hooks/rules-of-hooks
83
+ (0, react_1.useLayoutEffect)(() => {
84
+ if (process.env.NODE_ENV === 'test') {
85
+ return;
86
+ }
87
+ const newHandle = (0, delay_render_js_1.delayRender)('Loading <Audio> duration with src=' + src);
88
+ const { current } = audioRef;
89
+ const didLoad = () => {
90
+ if (current === null || current === void 0 ? void 0 : current.duration) {
91
+ onDuration(current.src, current.duration);
92
+ }
93
+ (0, delay_render_js_1.continueRender)(newHandle);
94
+ };
95
+ if (current === null || current === void 0 ? void 0 : current.duration) {
96
+ onDuration(current.src, current.duration);
97
+ (0, delay_render_js_1.continueRender)(newHandle);
98
+ }
99
+ else {
100
+ current === null || current === void 0 ? void 0 : current.addEventListener('loadedmetadata', didLoad, { once: true });
101
+ }
102
+ // If tag gets unmounted, clear pending handles because video metadata is not going to load
103
+ return () => {
104
+ current === null || current === void 0 ? void 0 : current.removeEventListener('loadedmetadata', didLoad);
105
+ (0, delay_render_js_1.continueRender)(newHandle);
106
+ };
107
+ }, [src, onDuration]);
108
+ }
109
+ return (0, jsx_runtime_1.jsx)("audio", { ref: audioRef, ...nativeProps });
110
+ };
111
+ exports.AudioForRendering = (0, react_1.forwardRef)(AudioForRenderingRefForwardingFunction);
@@ -0,0 +1,2 @@
1
+ export * from './Audio.js';
2
+ export * from './props.js';
@@ -14,5 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./Audio"), exports);
18
- __exportStar(require("./props"), exports);
17
+ __exportStar(require("./Audio.js"), exports);
18
+ __exportStar(require("./props.js"), exports);