remotion 4.0.0-webhook.26 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (287) 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 +56 -0
  12. package/dist/cjs/Composition.js +121 -0
  13. package/dist/cjs/CompositionManager.d.ts +74 -0
  14. package/dist/{CompositionManager.js → cjs/CompositionManager.js} +29 -66
  15. package/dist/cjs/CompositionManagerContext.d.ts +19 -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 +74 -0
  31. package/dist/cjs/ResolveCompositionConfig.d.ts +24 -0
  32. package/dist/cjs/ResolveCompositionConfig.js +198 -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} +14 -6
  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 +132 -0
  86. package/dist/cjs/internals.js +123 -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 +45 -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 +82 -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 -9
  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} +9 -7
  134. package/dist/cjs/timeline-position-state.js +67 -0
  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} +6 -5
  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/cjs/validation/validate-dimensions.d.ts +1 -0
  166. package/dist/{validation → cjs/validation}/validate-dimensions.js +2 -2
  167. package/dist/cjs/validation/validate-duration-in-frames.d.ts +4 -0
  168. package/dist/{validation → cjs/validation}/validate-duration-in-frames.js +10 -3
  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/cjs/validation/validate-fps.d.ts +1 -0
  172. package/dist/{validation → cjs/validation}/validate-fps.js +2 -2
  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 +40 -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/cjs/video-config.d.ts +9 -0
  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 +4643 -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/timeline-position-state.js +0 -41
  253. package/dist/truthy.d.ts +0 -3
  254. package/dist/use-current-frame.d.ts +0 -6
  255. package/dist/use-lazy-component.d.ts +0 -7
  256. package/dist/use-media-playback.js +0 -75
  257. package/dist/use-video-config.d.ts +0 -7
  258. package/dist/use-video-config.js +0 -26
  259. package/dist/use-video.d.ts +0 -13
  260. package/dist/use-video.js +0 -28
  261. package/dist/validate-media-props.d.ts +0 -4
  262. package/dist/validation/validate-dimensions.d.ts +0 -1
  263. package/dist/validation/validate-duration-in-frames.d.ts +0 -1
  264. package/dist/validation/validate-fps.d.ts +0 -1
  265. package/dist/validation/validate-offthreadvideo-image-format.d.ts +0 -1
  266. package/dist/validation/validate-offthreadvideo-image-format.js +0 -15
  267. package/dist/version.d.ts +0 -1
  268. package/dist/video/LoopedVideo.d.ts +0 -3
  269. package/dist/video/LoopedVideo.js +0 -16
  270. package/dist/video/OffthreadVideo.d.ts +0 -3
  271. package/dist/video/OffthreadVideo.js +0 -27
  272. package/dist/video/OffthreadVideoForRendering.js +0 -101
  273. package/dist/video/Video.d.ts +0 -6
  274. package/dist/video/Video.js +0 -29
  275. package/dist/video/VideoForDevelopment.js +0 -69
  276. package/dist/video/VideoForRendering.d.ts +0 -6
  277. package/dist/video/VideoForRendering.js +0 -168
  278. package/dist/video/duration-state.d.ts +0 -8
  279. package/dist/video/duration-state.js +0 -15
  280. package/dist/video/index.d.ts +0 -3
  281. package/dist/video/props.d.ts +0 -21
  282. package/dist/video-config.d.ts +0 -8
  283. package/dist/wrap-remotion-context.d.ts +0 -14
  284. package/dist/wrap-remotion-context.js +0 -65
  285. package/ensure-correct-version.js +0 -24
  286. package/tsconfig.json +0 -12
  287. package/version.d.ts +0 -1
@@ -0,0 +1,198 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useResolvedVideoConfig = exports.needsResolution = exports.ResolveCompositionConfig = exports.resolveCompositionsRef = exports.ResolveCompositionContext = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const CompositionManagerContext_js_1 = require("./CompositionManagerContext.js");
7
+ const input_props_js_1 = require("./config/input-props.js");
8
+ const EditorProps_js_1 = require("./EditorProps.js");
9
+ const get_environment_js_1 = require("./get-environment.js");
10
+ const resolve_video_config_js_1 = require("./resolve-video-config.js");
11
+ exports.ResolveCompositionContext = (0, react_1.createContext)(null);
12
+ exports.resolveCompositionsRef = (0, react_1.createRef)();
13
+ const ResolveCompositionConfig = ({ children }) => {
14
+ const [currentRenderModalComposition, setCurrentRenderModalComposition] = (0, react_1.useState)(null);
15
+ const { compositions, currentComposition, currentCompositionMetadata } = (0, react_1.useContext)(CompositionManagerContext_js_1.CompositionManager);
16
+ const selectedComposition = compositions.find((c) => c.id === currentComposition);
17
+ const renderModalComposition = compositions.find((c) => c.id === currentRenderModalComposition);
18
+ const { props: allEditorProps } = (0, react_1.useContext)(EditorProps_js_1.EditorPropsContext);
19
+ const [resolvedConfigs, setResolvedConfigs] = (0, react_1.useState)({});
20
+ const selectedEditorProps = (0, react_1.useMemo)(() => {
21
+ var _a;
22
+ return selectedComposition
23
+ ? (_a = allEditorProps[selectedComposition.id]) !== null && _a !== void 0 ? _a : {}
24
+ : {};
25
+ }, [allEditorProps, selectedComposition]);
26
+ const renderModalProps = (0, react_1.useMemo)(() => {
27
+ var _a;
28
+ return renderModalComposition
29
+ ? (_a = allEditorProps[renderModalComposition.id]) !== null && _a !== void 0 ? _a : {}
30
+ : {};
31
+ }, [allEditorProps, renderModalComposition]);
32
+ const doResolution = (0, react_1.useCallback)((composition, editorProps) => {
33
+ const controller = new AbortController();
34
+ if (currentCompositionMetadata) {
35
+ return controller;
36
+ }
37
+ const { signal } = controller;
38
+ const promOrNot = (0, resolve_video_config_js_1.resolveVideoConfig)({ composition, editorProps, signal });
39
+ if (typeof promOrNot === 'object' && 'then' in promOrNot) {
40
+ setResolvedConfigs((r) => ({
41
+ ...r,
42
+ [composition.id]: {
43
+ type: 'loading',
44
+ },
45
+ }));
46
+ promOrNot
47
+ .then((c) => {
48
+ if (controller.signal.aborted) {
49
+ return;
50
+ }
51
+ setResolvedConfigs((r) => ({
52
+ ...r,
53
+ [composition.id]: {
54
+ type: 'success',
55
+ result: c,
56
+ },
57
+ }));
58
+ })
59
+ .catch((err) => {
60
+ if (controller.signal.aborted) {
61
+ return;
62
+ }
63
+ setResolvedConfigs((r) => ({
64
+ ...r,
65
+ [composition.id]: {
66
+ type: 'error',
67
+ error: err,
68
+ },
69
+ }));
70
+ });
71
+ }
72
+ else {
73
+ setResolvedConfigs((r) => ({
74
+ ...r,
75
+ [composition.id]: {
76
+ type: 'success',
77
+ result: promOrNot,
78
+ },
79
+ }));
80
+ }
81
+ return controller;
82
+ }, [currentCompositionMetadata]);
83
+ (0, react_1.useImperativeHandle)(exports.resolveCompositionsRef, () => {
84
+ return {
85
+ setCurrentRenderModalComposition: (id) => {
86
+ setCurrentRenderModalComposition(id);
87
+ },
88
+ reloadCurrentlySelectedComposition: () => {
89
+ var _a;
90
+ if (!currentComposition) {
91
+ return;
92
+ }
93
+ const composition = compositions.find((c) => c.id === currentComposition);
94
+ if (!composition) {
95
+ throw new Error(`Could not find composition with id ${currentComposition}`);
96
+ }
97
+ const editorProps = (_a = allEditorProps[currentComposition]) !== null && _a !== void 0 ? _a : {};
98
+ doResolution(composition, editorProps);
99
+ },
100
+ };
101
+ }, [allEditorProps, compositions, currentComposition, doResolution]);
102
+ const isTheSame = (selectedComposition === null || selectedComposition === void 0 ? void 0 : selectedComposition.id) === (renderModalComposition === null || renderModalComposition === void 0 ? void 0 : renderModalComposition.id);
103
+ (0, react_1.useEffect)(() => {
104
+ if (selectedComposition && (0, exports.needsResolution)(selectedComposition)) {
105
+ const controller = doResolution(selectedComposition, selectedEditorProps);
106
+ return () => {
107
+ controller.abort();
108
+ };
109
+ }
110
+ }, [doResolution, selectedComposition, selectedEditorProps]);
111
+ (0, react_1.useEffect)(() => {
112
+ if (renderModalComposition && !isTheSame) {
113
+ const controller = doResolution(renderModalComposition, renderModalProps);
114
+ return () => {
115
+ controller.abort();
116
+ };
117
+ }
118
+ }, [doResolution, isTheSame, renderModalComposition, renderModalProps]);
119
+ const resolvedConfigsIncludingStaticOnes = (0, react_1.useMemo)(() => {
120
+ const staticComps = compositions.filter((c) => {
121
+ return c.calculateMetadata === null;
122
+ });
123
+ return {
124
+ ...resolvedConfigs,
125
+ ...staticComps.reduce((acc, curr) => {
126
+ var _a;
127
+ return {
128
+ ...acc,
129
+ [curr.id]: {
130
+ type: 'success',
131
+ result: { ...curr, defaultProps: (_a = curr.defaultProps) !== null && _a !== void 0 ? _a : {} },
132
+ },
133
+ };
134
+ }, {}),
135
+ };
136
+ }, [compositions, resolvedConfigs]);
137
+ return ((0, jsx_runtime_1.jsx)(exports.ResolveCompositionContext.Provider, { value: resolvedConfigsIncludingStaticOnes, children: children }));
138
+ };
139
+ exports.ResolveCompositionConfig = ResolveCompositionConfig;
140
+ const needsResolution = (composition) => {
141
+ return Boolean(composition.calculateMetadata);
142
+ };
143
+ exports.needsResolution = needsResolution;
144
+ const useResolvedVideoConfig = (preferredCompositionId) => {
145
+ const context = (0, react_1.useContext)(exports.ResolveCompositionContext);
146
+ const { props: allEditorProps } = (0, react_1.useContext)(EditorProps_js_1.EditorPropsContext);
147
+ const { compositions, currentComposition, currentCompositionMetadata } = (0, react_1.useContext)(CompositionManagerContext_js_1.CompositionManager);
148
+ const compositionId = preferredCompositionId !== null && preferredCompositionId !== void 0 ? preferredCompositionId : currentComposition;
149
+ const composition = compositions.find((c) => c.id === compositionId);
150
+ const selectedEditorProps = (0, react_1.useMemo)(() => {
151
+ var _a;
152
+ return composition ? (_a = allEditorProps[composition.id]) !== null && _a !== void 0 ? _a : {} : {};
153
+ }, [allEditorProps, composition]);
154
+ return (0, react_1.useMemo)(() => {
155
+ var _a, _b, _c, _d;
156
+ if (!composition) {
157
+ return null;
158
+ }
159
+ if (currentCompositionMetadata) {
160
+ return {
161
+ type: 'success',
162
+ result: {
163
+ ...currentCompositionMetadata,
164
+ id: composition.id,
165
+ props: currentCompositionMetadata.props,
166
+ defaultProps: (_a = composition.defaultProps) !== null && _a !== void 0 ? _a : {},
167
+ },
168
+ };
169
+ }
170
+ if (!(0, exports.needsResolution)(composition)) {
171
+ return {
172
+ type: 'success',
173
+ result: {
174
+ width: composition.width,
175
+ height: composition.height,
176
+ fps: composition.fps,
177
+ id: composition.id,
178
+ durationInFrames: composition.durationInFrames,
179
+ defaultProps: (_b = composition.defaultProps) !== null && _b !== void 0 ? _b : {},
180
+ props: {
181
+ ...((_c = composition.defaultProps) !== null && _c !== void 0 ? _c : {}),
182
+ ...(selectedEditorProps !== null && selectedEditorProps !== void 0 ? selectedEditorProps : {}),
183
+ ...(typeof window === 'undefined' ||
184
+ (0, get_environment_js_1.getRemotionEnvironment)() === 'player-development' ||
185
+ (0, get_environment_js_1.getRemotionEnvironment)() === 'player-production'
186
+ ? {}
187
+ : (_d = (0, input_props_js_1.getInputProps)()) !== null && _d !== void 0 ? _d : {}),
188
+ },
189
+ },
190
+ };
191
+ }
192
+ if (!context[composition.id]) {
193
+ return null;
194
+ }
195
+ return context[composition.id];
196
+ }, [composition, context, currentCompositionMetadata, selectedEditorProps]);
197
+ };
198
+ exports.useResolvedVideoConfig = useResolvedVideoConfig;
@@ -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>>(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, "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "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>>;