remotion 3.2.21 → 3.2.23-ensure-ffmpeg.123

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 (254) hide show
  1. package/.turbo/turbo-build.log +4 -5
  2. package/LICENSE.md +8 -8
  3. package/dist/AbsoluteFill.d.ts +0 -0
  4. package/dist/AbsoluteFill.js +0 -0
  5. package/dist/CanUseRemotionHooks.d.ts +0 -0
  6. package/dist/CanUseRemotionHooks.js +0 -0
  7. package/dist/Composition.d.ts +0 -0
  8. package/dist/Composition.js +0 -0
  9. package/dist/CompositionManager.d.ts +0 -0
  10. package/dist/CompositionManager.js +0 -0
  11. package/dist/Folder.d.ts +0 -0
  12. package/dist/Folder.js +0 -0
  13. package/dist/IFrame.d.ts +0 -0
  14. package/dist/IFrame.js +0 -0
  15. package/dist/Img.d.ts +0 -0
  16. package/dist/Img.js +30 -24
  17. package/dist/RemotionRoot.d.ts +0 -0
  18. package/dist/RemotionRoot.js +7 -5
  19. package/dist/Sequence.d.ts +1 -1
  20. package/dist/Sequence.js +1 -1
  21. package/dist/Still.d.ts +0 -0
  22. package/dist/Still.js +0 -0
  23. package/dist/absolute-src.d.ts +0 -0
  24. package/dist/absolute-src.js +0 -0
  25. package/dist/asset-types.d.ts +0 -0
  26. package/dist/asset-types.js +0 -0
  27. package/dist/audio/Audio.d.ts +3 -2
  28. package/dist/audio/Audio.js +15 -2
  29. package/dist/audio/AudioForDevelopment.d.ts +3 -1
  30. package/dist/audio/AudioForDevelopment.js +34 -9
  31. package/dist/audio/AudioForRendering.d.ts +4 -1
  32. package/dist/audio/AudioForRendering.js +33 -1
  33. package/dist/audio/index.d.ts +0 -0
  34. package/dist/audio/index.js +0 -0
  35. package/dist/audio/props.d.ts +2 -1
  36. package/dist/audio/props.js +0 -0
  37. package/dist/audio/shared-audio-tags.d.ts +0 -0
  38. package/dist/audio/shared-audio-tags.js +0 -0
  39. package/dist/audio/use-audio-frame.d.ts +0 -0
  40. package/dist/audio/use-audio-frame.js +0 -0
  41. package/dist/bezier.d.ts +0 -0
  42. package/dist/bezier.js +0 -0
  43. package/dist/config/input-props.d.ts +0 -0
  44. package/dist/config/input-props.js +0 -0
  45. package/dist/config.d.ts +30 -0
  46. package/dist/config.js +0 -0
  47. package/dist/default-css.d.ts +0 -0
  48. package/dist/default-css.js +0 -0
  49. package/dist/delay-render.d.ts +0 -0
  50. package/dist/delay-render.js +0 -0
  51. package/dist/easing.d.ts +0 -0
  52. package/dist/easing.js +0 -0
  53. package/dist/freeze.d.ts +0 -0
  54. package/dist/freeze.js +0 -0
  55. package/dist/get-asset-file-name.d.ts +0 -0
  56. package/dist/get-asset-file-name.js +0 -0
  57. package/dist/get-environment.d.ts +0 -0
  58. package/dist/get-environment.js +1 -1
  59. package/dist/get-preview-dom-element.d.ts +0 -0
  60. package/dist/get-preview-dom-element.js +0 -0
  61. package/dist/get-timeline-clip-name.d.ts +0 -0
  62. package/dist/get-timeline-clip-name.js +0 -0
  63. package/dist/index.d.ts +2 -1
  64. package/dist/index.js +5 -2
  65. package/dist/internals.d.ts +6 -0
  66. package/dist/internals.js +4 -0
  67. package/dist/interpolate-colors.d.ts +0 -0
  68. package/dist/interpolate-colors.js +0 -0
  69. package/dist/interpolate.d.ts +0 -0
  70. package/dist/interpolate.js +0 -0
  71. package/dist/is-approximately-the-same.d.ts +0 -0
  72. package/dist/is-approximately-the-same.js +0 -0
  73. package/dist/loading-indicator.d.ts +0 -0
  74. package/dist/loading-indicator.js +0 -0
  75. package/dist/loop/index.d.ts +0 -0
  76. package/dist/loop/index.js +0 -0
  77. package/dist/multiple-versions-warning.d.ts +0 -0
  78. package/dist/multiple-versions-warning.js +0 -0
  79. package/dist/nonce.d.ts +0 -0
  80. package/dist/nonce.js +0 -0
  81. package/dist/play-and-handle-not-allowed-error.d.ts +0 -0
  82. package/dist/play-and-handle-not-allowed-error.js +4 -0
  83. package/dist/portal-node.d.ts +0 -0
  84. package/dist/portal-node.js +0 -0
  85. package/dist/prefetch-state.d.ts +8 -0
  86. package/dist/prefetch-state.js +27 -0
  87. package/dist/prefetch.d.ts +9 -0
  88. package/dist/prefetch.js +108 -0
  89. package/dist/random.d.ts +2 -1
  90. package/dist/random.js +0 -0
  91. package/dist/register-root.d.ts +0 -0
  92. package/dist/register-root.js +3 -0
  93. package/dist/series/flatten-children.d.ts +1 -1
  94. package/dist/series/flatten-children.js +0 -0
  95. package/dist/series/index.d.ts +0 -0
  96. package/dist/series/index.js +0 -0
  97. package/dist/setup-env-variables.d.ts +0 -0
  98. package/dist/setup-env-variables.js +0 -0
  99. package/dist/spring/index.d.ts +0 -0
  100. package/dist/spring/index.js +0 -0
  101. package/dist/spring/measure-spring.d.ts +0 -0
  102. package/dist/spring/measure-spring.js +0 -0
  103. package/dist/spring/spring-utils.d.ts +0 -0
  104. package/dist/spring/spring-utils.js +0 -0
  105. package/dist/static-file.d.ts +0 -0
  106. package/dist/static-file.js +0 -0
  107. package/dist/timeline-position-state.d.ts +0 -0
  108. package/dist/timeline-position-state.js +0 -0
  109. package/dist/truthy.d.ts +0 -0
  110. package/dist/truthy.js +0 -0
  111. package/dist/use-current-frame.d.ts +0 -0
  112. package/dist/use-current-frame.js +0 -0
  113. package/dist/use-lazy-component.d.ts +0 -0
  114. package/dist/use-lazy-component.js +0 -0
  115. package/dist/use-media-in-timeline.d.ts +0 -0
  116. package/dist/use-media-in-timeline.js +0 -0
  117. package/dist/use-media-playback.d.ts +3 -1
  118. package/dist/use-media-playback.js +5 -3
  119. package/dist/use-media-tag-volume.d.ts +0 -0
  120. package/dist/use-media-tag-volume.js +0 -0
  121. package/dist/use-sync-volume-with-media-tag.d.ts +0 -0
  122. package/dist/use-sync-volume-with-media-tag.js +0 -0
  123. package/dist/use-unsafe-video-config.d.ts +0 -0
  124. package/dist/use-unsafe-video-config.js +0 -0
  125. package/dist/use-video-config.d.ts +0 -0
  126. package/dist/use-video-config.js +0 -0
  127. package/dist/use-video.d.ts +0 -0
  128. package/dist/use-video.js +0 -0
  129. package/dist/validate-media-props.d.ts +0 -0
  130. package/dist/validate-media-props.js +0 -0
  131. package/dist/validate-start-from-props.d.ts +0 -0
  132. package/dist/validate-start-from-props.js +0 -0
  133. package/dist/validation/validate-composition-id.d.ts +0 -0
  134. package/dist/validation/validate-composition-id.js +0 -0
  135. package/dist/validation/validate-dimensions.d.ts +0 -0
  136. package/dist/validation/validate-dimensions.js +0 -0
  137. package/dist/validation/validate-duration-in-frames.d.ts +0 -0
  138. package/dist/validation/validate-duration-in-frames.js +0 -0
  139. package/dist/validation/validate-folder-name.d.ts +0 -0
  140. package/dist/validation/validate-folder-name.js +0 -0
  141. package/dist/validation/validate-fps.d.ts +0 -0
  142. package/dist/validation/validate-fps.js +0 -0
  143. package/dist/validation/validate-offthreadvideo-image-format.d.ts +0 -0
  144. package/dist/validation/validate-offthreadvideo-image-format.js +0 -0
  145. package/dist/validation/validation-spring-duration.d.ts +0 -0
  146. package/dist/validation/validation-spring-duration.js +0 -0
  147. package/dist/version.d.ts +1 -1
  148. package/dist/version.js +1 -1
  149. package/dist/video/OffthreadVideo.d.ts +1 -1
  150. package/dist/video/OffthreadVideo.js +3 -1
  151. package/dist/video/OffthreadVideoForRendering.d.ts +0 -0
  152. package/dist/video/OffthreadVideoForRendering.js +0 -0
  153. package/dist/video/Video.d.ts +3 -2
  154. package/dist/video/Video.js +14 -2
  155. package/dist/video/VideoForDevelopment.d.ts +3 -1
  156. package/dist/video/VideoForDevelopment.js +31 -7
  157. package/dist/video/VideoForRendering.d.ts +4 -1
  158. package/dist/video/VideoForRendering.js +33 -2
  159. package/dist/video/duration-state.d.ts +17 -0
  160. package/dist/video/duration-state.js +34 -0
  161. package/dist/video/get-current-time.d.ts +0 -0
  162. package/dist/video/get-current-time.js +0 -0
  163. package/dist/video/index.d.ts +0 -0
  164. package/dist/video/index.js +0 -0
  165. package/dist/video/props.d.ts +3 -1
  166. package/dist/video/props.js +0 -0
  167. package/dist/video-config.d.ts +0 -0
  168. package/dist/video-config.js +0 -0
  169. package/dist/volume-position-state.d.ts +0 -0
  170. package/dist/volume-position-state.js +0 -0
  171. package/dist/volume-prop.d.ts +0 -0
  172. package/dist/volume-prop.js +0 -0
  173. package/dist/warn-about-non-seekable-media.d.ts +0 -0
  174. package/dist/warn-about-non-seekable-media.js +0 -0
  175. package/dist/wrap-remotion-context.d.ts +0 -0
  176. package/dist/wrap-remotion-context.js +0 -0
  177. package/package.json +9 -8
  178. package/.turbo/turbo-lint.log +0 -11
  179. package/.turbo/turbo-test.log +0 -405
  180. package/dist/compress-assets.d.ts +0 -7
  181. package/dist/compress-assets.js +0 -25
  182. package/dist/config/browser-executable.d.ts +0 -3
  183. package/dist/config/browser-executable.js +0 -12
  184. package/dist/config/browser.d.ts +0 -4
  185. package/dist/config/browser.js +0 -19
  186. package/dist/config/chromium-flags.d.ts +0 -10
  187. package/dist/config/chromium-flags.js +0 -34
  188. package/dist/config/codec.d.ts +0 -16
  189. package/dist/config/codec.js +0 -109
  190. package/dist/config/concurrency.d.ts +0 -3
  191. package/dist/config/concurrency.js +0 -12
  192. package/dist/config/crf.d.ts +0 -9
  193. package/dist/config/crf.js +0 -83
  194. package/dist/config/env-file.d.ts +0 -2
  195. package/dist/config/env-file.js +0 -10
  196. package/dist/config/every-nth-frame.d.ts +0 -3
  197. package/dist/config/every-nth-frame.js +0 -20
  198. package/dist/config/ffmpeg-executable.d.ts +0 -5
  199. package/dist/config/ffmpeg-executable.js +0 -21
  200. package/dist/config/frame-range.d.ts +0 -5
  201. package/dist/config/frame-range.js +0 -80
  202. package/dist/config/image-format.d.ts +0 -8
  203. package/dist/config/image-format.js +0 -37
  204. package/dist/config/image-sequence.d.ts +0 -3
  205. package/dist/config/image-sequence.js +0 -15
  206. package/dist/config/index.d.ts +0 -178
  207. package/dist/config/index.js +0 -193
  208. package/dist/config/log.d.ts +0 -7
  209. package/dist/config/log.js +0 -25
  210. package/dist/config/max-timeline-tracks.d.ts +0 -2
  211. package/dist/config/max-timeline-tracks.js +0 -24
  212. package/dist/config/number-of-gif-loops.d.ts +0 -4
  213. package/dist/config/number-of-gif-loops.js +0 -21
  214. package/dist/config/override-webpack.d.ts +0 -6
  215. package/dist/config/override-webpack.js +0 -14
  216. package/dist/config/overwrite.d.ts +0 -3
  217. package/dist/config/overwrite.js +0 -14
  218. package/dist/config/pixel-format.d.ts +0 -8
  219. package/dist/config/pixel-format.js +0 -38
  220. package/dist/config/preview-server.d.ts +0 -2
  221. package/dist/config/preview-server.js +0 -20
  222. package/dist/config/prores-profile.d.ts +0 -7
  223. package/dist/config/prores-profile.js +0 -32
  224. package/dist/config/quality.d.ts +0 -2
  225. package/dist/config/quality.js +0 -17
  226. package/dist/config/scale.d.ts +0 -3
  227. package/dist/config/scale.js +0 -15
  228. package/dist/config/still-frame.d.ts +0 -2
  229. package/dist/config/still-frame.js +0 -12
  230. package/dist/config/timeout.d.ts +0 -2
  231. package/dist/config/timeout.js +0 -17
  232. package/dist/config/webpack-caching.d.ts +0 -3
  233. package/dist/config/webpack-caching.js +0 -16
  234. package/dist/feature-flags.d.ts +0 -1
  235. package/dist/feature-flags.js +0 -7
  236. package/dist/is-audio-codec.d.ts +0 -2
  237. package/dist/is-audio-codec.js +0 -7
  238. package/dist/perf/index.d.ts +0 -5
  239. package/dist/perf/index.js +0 -35
  240. package/dist/timeline-inout-position-state.d.ts +0 -12
  241. package/dist/timeline-inout-position-state.js +0 -23
  242. package/dist/timeout.d.ts +0 -2
  243. package/dist/timeout.js +0 -12
  244. package/dist/validation/validate-every-nth-frame.d.ts +0 -1
  245. package/dist/validation/validate-every-nth-frame.js +0 -21
  246. package/dist/validation/validate-frame.d.ts +0 -1
  247. package/dist/validation/validate-frame.js +0 -24
  248. package/dist/validation/validate-image-format.d.ts +0 -2
  249. package/dist/validation/validate-image-format.js +0 -9
  250. package/dist/validation/validate-opengl-renderer.d.ts +0 -4
  251. package/dist/validation/validate-opengl-renderer.js +0 -14
  252. package/dist/validation/validate-quality.d.ts +0 -1
  253. package/dist/validation/validate-quality.js +0 -21
  254. package/ensure-correct-version.js +0 -24
@@ -1,5 +1,4 @@
1
- remotion:build: cache hit, replaying output 038c93fe806f4b5d
2
- remotion:build: 
3
- remotion:build: > remotion@3.2.20 build /Users/jonathanburger/remotion/packages/core
4
- remotion:build: > tsc -d
5
- remotion:build: 
1
+
2
+ > remotion@3.2.44 build /Users/jonathanburger/remotion/packages/core
3
+ > tsc -d
4
+
package/LICENSE.md CHANGED
@@ -1,34 +1,34 @@
1
1
  # Remotion License
2
2
 
3
- Depending on the type of your legal entity, you are granted permission to use Remotion for your project. Individuals and small companies are allowed to use Remotion create videos for free (even commercial), while a company license is required for for-profit organisations of a certain size. This two-tier system was designed to ensure funding for this project while still allowing the source code to be available and the program to be free for most. Read below for the exact terms of use.
3
+ Depending on the type of your legal entity, you are granted permission to use Remotion for your project. Individuals and small companies are allowed to use Remotion to create videos for free (even commercial), while a company license is required for for-profit organizations of a certain size. This two-tier system was designed to ensure funding for this project while still allowing the source code to be available and the program to be free for most. Read below for the exact terms of use.
4
4
 
5
5
  - [Free license](#free-license)
6
6
  - [Company license](#company-license)
7
7
 
8
8
  ## Free license
9
9
 
10
- Copyright © 2022 [Jonny Burger](https://jonny.io)
10
+ Copyright © 2022 [Remotion](https://www.remotion.dev/)
11
11
 
12
12
  ### Eligibility
13
13
 
14
14
  You are eligible to use Remotion for free if you are:
15
15
 
16
16
  - an individual
17
- - a for-profit organisation with up to 3 employees
18
- - a non-profit or not-for-profit organisation
17
+ - a for-profit organization with up to 3 employees
18
+ - a non-profit or not-for-profit organization
19
19
  - evaluating whether Remotion is a good fit, and are not yet using it in a commercial way
20
20
 
21
21
  ### Allowed use cases
22
22
 
23
- Permission is hereby granted, free of charge, to any person eligible for the "Free license", to use the software non-commercially or commercially for the purpose of creating videos and images and to modify and the software to their own liking, for the purpose of fulfilling their custom use case or to contribute bug fixes or improvements back to Remotion.
23
+ Permission is hereby granted, free of charge, to any person eligible for the "Free license", to use the software non-commercially or commercially for the purpose of creating videos and images and to modify the software to their own liking, for the purpose of fulfilling their custom use case or to contribute bug fixes or improvements back to Remotion.
24
24
 
25
25
  ### Disallowed use cases
26
26
 
27
- It is not allowed to copy or modify Remotion code for the purpose of selling, renting, licensing, relicensing, sublicensing your own derivate of Remotion.
27
+ It is not allowed to copy or modify Remotion code for the purpose of selling, renting, licensing, relicensing, or sublicensing your own derivate of Remotion.
28
28
 
29
29
  ### Warranty notice
30
30
 
31
- The software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the author or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.
31
+ The software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, and non-infringement. In no event shall the author or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.
32
32
 
33
33
  ### Support
34
34
 
@@ -36,6 +36,6 @@ Support is provided on a best-we-can-do basis via GitHub Issues and Discord.
36
36
 
37
37
  ## Company license
38
38
 
39
- You are required to obtain a company license to use Remotion if you are not within the group of entities eligible for a free license. This license will enable you to use Remotion for the allowed use cases specified in the free license, and give you access to prioritized support.
39
+ You are required to obtain a company license to use Remotion if you are not within the group of entities eligible for a free license. This license will enable you to use Remotion for the allowed use cases specified in the free license, and give you access to prioritized support (read the [Support Policy](/docs/support)).
40
40
 
41
41
  Visit [companies.remotion.dev](https://companies.remotion.dev) for pricing and to buy a license.
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/dist/Folder.d.ts CHANGED
File without changes
package/dist/Folder.js CHANGED
File without changes
package/dist/IFrame.d.ts CHANGED
File without changes
package/dist/IFrame.js CHANGED
File without changes
package/dist/Img.d.ts CHANGED
File without changes
package/dist/Img.js CHANGED
@@ -4,11 +4,14 @@ exports.Img = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const delay_render_1 = require("./delay-render");
7
- const ImgRefForwarding = ({ onError, ...props }, ref) => {
7
+ const get_environment_1 = require("./get-environment");
8
+ const prefetch_1 = require("./prefetch");
9
+ const ImgRefForwarding = ({ onError, src, ...props }, ref) => {
8
10
  const imageRef = (0, react_1.useRef)(null);
9
11
  (0, react_1.useImperativeHandle)(ref, () => {
10
12
  return imageRef.current;
11
- });
13
+ }, []);
14
+ const actualSrc = (0, prefetch_1.usePreload)(src);
12
15
  const didGetError = (0, react_1.useCallback)((e) => {
13
16
  var _a;
14
17
  if (onError) {
@@ -19,27 +22,30 @@ const ImgRefForwarding = ({ onError, ...props }, ref) => {
19
22
  }
20
23
  }, [onError]);
21
24
  // If image source switches, make new handle
22
- (0, react_1.useLayoutEffect)(() => {
23
- if (process.env.NODE_ENV === 'test') {
24
- return;
25
- }
26
- const newHandle = (0, delay_render_1.delayRender)('Loading <Img> with src=' + props.src);
27
- const { current } = imageRef;
28
- const didLoad = () => {
29
- (0, delay_render_1.continueRender)(newHandle);
30
- };
31
- if (current === null || current === void 0 ? void 0 : current.complete) {
32
- (0, delay_render_1.continueRender)(newHandle);
33
- }
34
- else {
35
- current === null || current === void 0 ? void 0 : current.addEventListener('load', didLoad, { once: true });
36
- }
37
- // If tag gets unmounted, clear pending handles because image is not going to load
38
- return () => {
39
- current === null || current === void 0 ? void 0 : current.removeEventListener('load', didLoad);
40
- (0, delay_render_1.continueRender)(newHandle);
41
- };
42
- }, [props.src]);
43
- return (0, jsx_runtime_1.jsx)("img", { ...props, ref: imageRef, onError: didGetError });
25
+ if ((0, get_environment_1.getRemotionEnvironment)() === 'rendering') {
26
+ // eslint-disable-next-line react-hooks/rules-of-hooks
27
+ (0, react_1.useLayoutEffect)(() => {
28
+ if (process.env.NODE_ENV === 'test') {
29
+ return;
30
+ }
31
+ const newHandle = (0, delay_render_1.delayRender)('Loading <Img> with src=' + src);
32
+ const { current } = imageRef;
33
+ const didLoad = () => {
34
+ (0, delay_render_1.continueRender)(newHandle);
35
+ };
36
+ if (current === null || current === void 0 ? void 0 : current.complete) {
37
+ (0, delay_render_1.continueRender)(newHandle);
38
+ }
39
+ else {
40
+ current === null || current === void 0 ? void 0 : current.addEventListener('load', didLoad, { once: true });
41
+ }
42
+ // If tag gets unmounted, clear pending handles because image is not going to load
43
+ return () => {
44
+ current === null || current === void 0 ? void 0 : current.removeEventListener('load', didLoad);
45
+ (0, delay_render_1.continueRender)(newHandle);
46
+ };
47
+ }, [src]);
48
+ }
49
+ return ((0, jsx_runtime_1.jsx)("img", { ...props, ref: imageRef, src: actualSrc, onError: didGetError }));
44
50
  };
45
51
  exports.Img = (0, react_1.forwardRef)(ImgRefForwarding);
File without changes
@@ -7,8 +7,10 @@ const shared_audio_tags_1 = require("./audio/shared-audio-tags");
7
7
  const CompositionManager_1 = require("./CompositionManager");
8
8
  const delay_render_1 = require("./delay-render");
9
9
  const nonce_1 = require("./nonce");
10
+ const prefetch_state_1 = require("./prefetch-state");
10
11
  const random_1 = require("./random");
11
12
  const timeline_position_state_1 = require("./timeline-position-state");
13
+ const duration_state_1 = require("./video/duration-state");
12
14
  const RemotionRoot = ({ children }) => {
13
15
  var _a;
14
16
  const [remotionRootId] = (0, react_1.useState)(() => String((0, random_1.random)(null)));
@@ -61,10 +63,10 @@ const RemotionRoot = ({ children }) => {
61
63
  });
62
64
  }
63
65
  }, []);
64
- return ((0, jsx_runtime_1.jsx)(nonce_1.NonceContext.Provider, { value: nonceContext, children: (0, jsx_runtime_1.jsx)(timeline_position_state_1.TimelineContext.Provider, { value: timelineContextValue, children: (0, jsx_runtime_1.jsx)(timeline_position_state_1.SetTimelineContext.Provider, { value: setTimelineContextValue, children: (0, jsx_runtime_1.jsx)(CompositionManager_1.CompositionManagerProvider, { children: (0, jsx_runtime_1.jsx)(shared_audio_tags_1.SharedAudioContextProvider
65
- // In the preview, which is mostly played on Desktop, we opt out of the autoplay policy fix as described in https://github.com/remotion-dev/remotion/pull/554, as it mostly applies to mobile.
66
- , {
67
- // In the preview, which is mostly played on Desktop, we opt out of the autoplay policy fix as described in https://github.com/remotion-dev/remotion/pull/554, as it mostly applies to mobile.
68
- numberOfAudioTags: 0, children: children }) }) }) }) }));
66
+ return ((0, jsx_runtime_1.jsx)(nonce_1.NonceContext.Provider, { value: nonceContext, children: (0, jsx_runtime_1.jsx)(timeline_position_state_1.TimelineContext.Provider, { value: timelineContextValue, children: (0, jsx_runtime_1.jsx)(timeline_position_state_1.SetTimelineContext.Provider, { value: setTimelineContextValue, children: (0, jsx_runtime_1.jsx)(prefetch_state_1.PrefetchProvider, { children: (0, jsx_runtime_1.jsx)(CompositionManager_1.CompositionManagerProvider, { children: (0, jsx_runtime_1.jsx)(duration_state_1.DurationsContextProvider, { children: (0, jsx_runtime_1.jsx)(shared_audio_tags_1.SharedAudioContextProvider
67
+ // In the preview, which is mostly played on Desktop, we opt out of the autoplay policy fix as described in https://github.com/remotion-dev/remotion/pull/554, as it mostly applies to mobile.
68
+ , {
69
+ // In the preview, which is mostly played on Desktop, we opt out of the autoplay policy fix as described in https://github.com/remotion-dev/remotion/pull/554, as it mostly applies to mobile.
70
+ numberOfAudioTags: 0, children: children }) }) }) }) }) }) }));
69
71
  };
70
72
  exports.RemotionRoot = RemotionRoot;
@@ -15,7 +15,7 @@ declare type LayoutAndStyle = {
15
15
  };
16
16
  export declare type SequenceProps = {
17
17
  children: React.ReactNode;
18
- from: number;
18
+ from?: number;
19
19
  durationInFrames?: number;
20
20
  name?: string;
21
21
  showInTimeline?: boolean;
package/dist/Sequence.js CHANGED
@@ -11,7 +11,7 @@ const nonce_1 = require("./nonce");
11
11
  const timeline_position_state_1 = require("./timeline-position-state");
12
12
  const use_video_config_1 = require("./use-video-config");
13
13
  exports.SequenceContext = (0, react_1.createContext)(null);
14
- const SequenceRefForwardingFunction = ({ from, durationInFrames = Infinity, children, name, showInTimeline = true, showLoopTimesInTimeline, ...other }, ref) => {
14
+ const SequenceRefForwardingFunction = ({ from = 0, durationInFrames = Infinity, children, name, showInTimeline = true, showLoopTimesInTimeline, ...other }, ref) => {
15
15
  const { layout = 'absolute-fill' } = other;
16
16
  const [id] = (0, react_1.useState)(() => String(Math.random()));
17
17
  const parentSequence = (0, react_1.useContext)(exports.SequenceContext);
package/dist/Still.d.ts CHANGED
File without changes
package/dist/Still.js CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
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"> & {
3
+ export declare const Audio: React.ForwardRefExoticComponent<Pick<Omit<React.DetailedHTMLProps<React.AudioHTMLAttributes<HTMLAudioElement>, HTMLAudioElement>, "nonce" | "onEnded" | "autoPlay" | "controls"> & {
4
4
  volume?: import("../volume-prop").VolumeProp | undefined;
5
5
  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>>;
6
+ acceptableTimeShiftInSeconds?: number | undefined;
7
+ } & 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" | "loop" | "mediaGroup" | "muted" | "playsInline" | "preload" | "acceptableTimeShiftInSeconds" | keyof RemotionMainAudioProps> & React.RefAttributes<HTMLAudioElement>>;
@@ -4,19 +4,32 @@ exports.Audio = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const get_environment_1 = require("../get-environment");
7
+ const loop_1 = require("../loop");
7
8
  const Sequence_1 = require("../Sequence");
9
+ const use_video_config_1 = require("../use-video-config");
8
10
  const validate_media_props_1 = require("../validate-media-props");
9
11
  const validate_start_from_props_1 = require("../validate-start-from-props");
12
+ const duration_state_1 = require("../video/duration-state");
10
13
  const AudioForDevelopment_1 = require("./AudioForDevelopment");
11
14
  const AudioForRendering_1 = require("./AudioForRendering");
12
15
  const shared_audio_tags_1 = require("./shared-audio-tags");
13
16
  const AudioRefForwardingFunction = (props, ref) => {
14
17
  const audioContext = (0, react_1.useContext)(shared_audio_tags_1.SharedAudioContext);
15
18
  const { startFrom, endAt, ...otherProps } = props;
19
+ const { loop, ...propsOtherThanLoop } = props;
20
+ const { fps } = (0, use_video_config_1.useVideoConfig)();
21
+ const { durations, setDurations } = (0, react_1.useContext)(duration_state_1.DurationsContext);
16
22
  const onError = (0, react_1.useCallback)((e) => {
17
23
  console.log(e.currentTarget.error);
18
24
  throw new Error(`Could not play audio with src ${otherProps.src}: ${e.currentTarget.error}. See https://remotion.dev/docs/media-playback-error for help.`);
19
25
  }, [otherProps.src]);
26
+ const onDuration = (0, react_1.useCallback)((src, durationInSeconds) => {
27
+ setDurations({ type: 'got-duration', durationInSeconds, src });
28
+ }, [setDurations]);
29
+ if (loop && props.src && durations[props.src] !== undefined) {
30
+ const duration = Math.floor(durations[props.src] * fps);
31
+ return ((0, jsx_runtime_1.jsx)(loop_1.Loop, { layout: "none", durationInFrames: duration, children: (0, jsx_runtime_1.jsx)(exports.Audio, { ...propsOtherThanLoop, ref: ref }) }));
32
+ }
20
33
  if (typeof startFrom !== 'undefined' || typeof endAt !== 'undefined') {
21
34
  (0, validate_start_from_props_1.validateStartFromProps)(startFrom, endAt);
22
35
  const startFromFrameNo = startFrom !== null && startFrom !== void 0 ? startFrom : 0;
@@ -25,8 +38,8 @@ const AudioRefForwardingFunction = (props, ref) => {
25
38
  }
26
39
  (0, validate_media_props_1.validateMediaProps)(props, 'Audio');
27
40
  if ((0, get_environment_1.getRemotionEnvironment)() === 'rendering') {
28
- return (0, jsx_runtime_1.jsx)(AudioForRendering_1.AudioForRendering, { ...props, ref: ref, onError: onError });
41
+ return ((0, jsx_runtime_1.jsx)(AudioForRendering_1.AudioForRendering, { onDuration: onDuration, ...props, ref: ref, onError: onError }));
29
42
  }
30
- return ((0, jsx_runtime_1.jsx)(AudioForDevelopment_1.AudioForDevelopment, { shouldPreMountAudioTags: audioContext !== null && audioContext.numberOfAudioTags > 0, ...props, ref: ref, onError: onError }));
43
+ return ((0, jsx_runtime_1.jsx)(AudioForDevelopment_1.AudioForDevelopment, { shouldPreMountAudioTags: audioContext !== null && audioContext.numberOfAudioTags > 0, ...props, ref: ref, onError: onError, onDuration: onDuration }));
31
44
  };
32
45
  exports.Audio = (0, react_1.forwardRef)(AudioRefForwardingFunction);
@@ -1,8 +1,10 @@
1
1
  import type { ForwardRefExoticComponent, RefAttributes } from 'react';
2
2
  import React from 'react';
3
- export declare const AudioForDevelopment: ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.AudioHTMLAttributes<HTMLAudioElement>, HTMLAudioElement>, "onEnded" | "autoPlay" | "controls" | "loop"> & {
3
+ export declare const AudioForDevelopment: ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.AudioHTMLAttributes<HTMLAudioElement>, HTMLAudioElement>, "nonce" | "onEnded" | "autoPlay" | "controls"> & {
4
4
  volume?: import("../volume-prop").VolumeProp | undefined;
5
5
  playbackRate?: number | undefined;
6
+ acceptableTimeShiftInSeconds?: number | undefined;
6
7
  } & {
7
8
  shouldPreMountAudioTags: boolean;
9
+ onDuration: (src: string, durationInSeconds: number) => void;
8
10
  } & RefAttributes<HTMLAudioElement>>;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AudioForDevelopment = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
+ const prefetch_1 = require("../prefetch");
6
7
  const random_1 = require("../random");
7
8
  const Sequence_1 = require("../Sequence");
8
9
  const use_media_in_timeline_1 = require("../use-media-in-timeline");
@@ -20,20 +21,22 @@ const AudioForDevelopmentForwardRefFunction = (props, ref) => {
20
21
  const [mediaVolume] = (0, volume_position_state_1.useMediaVolumeState)();
21
22
  const [mediaMuted] = (0, volume_position_state_1.useMediaMutedState)();
22
23
  const volumePropFrame = (0, use_audio_frame_1.useFrameForVolumeProp)();
23
- const { volume, muted, playbackRate, shouldPreMountAudioTags, ...nativeProps } = props;
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_1.usePreload)(src);
24
29
  const propsToPass = (0, react_1.useMemo)(() => {
25
30
  return {
26
31
  muted: muted || mediaMuted,
32
+ src: preloadedSrc,
27
33
  ...nativeProps,
28
34
  };
29
- }, [mediaMuted, muted, nativeProps]);
35
+ }, [mediaMuted, muted, nativeProps, preloadedSrc]);
30
36
  const sequenceContext = (0, react_1.useContext)(Sequence_1.SequenceContext);
31
37
  // Generate a string that's as unique as possible for this asset
32
38
  // but at the same time deterministic. We use it to combat strict mode issues.
33
- const id = (0, react_1.useMemo)(() => {
34
- var _a;
35
- return `audio-${(0, random_1.random)((_a = props.src) !== null && _a !== void 0 ? _a : '')}-${sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.relativeFrom}-${sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.cumulatedFrom}-${sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.durationInFrames}-muted:${props.muted}`;
36
- }, [props.muted, props.src, sequenceContext]);
39
+ const id = (0, react_1.useMemo)(() => `audio-${(0, random_1.random)(src !== null && src !== void 0 ? src : '')}-${sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.relativeFrom}-${sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.cumulatedFrom}-${sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.durationInFrames}-muted:${props.muted}`, [props.muted, src, sequenceContext]);
37
40
  const audioRef = (0, shared_audio_tags_1.useSharedAudio)(propsToPass, id).el;
38
41
  const actualVolume = (0, use_media_tag_volume_1.useMediaTagVolume)(audioRef);
39
42
  (0, use_sync_volume_with_media_tag_1.useSyncVolumeWithMediaTag)({
@@ -47,19 +50,41 @@ const AudioForDevelopmentForwardRefFunction = (props, ref) => {
47
50
  volume,
48
51
  mediaVolume,
49
52
  mediaRef: audioRef,
50
- src: nativeProps.src,
53
+ src,
51
54
  mediaType: 'audio',
52
55
  });
53
56
  (0, use_media_playback_1.useMediaPlayback)({
54
57
  mediaRef: audioRef,
55
- src: nativeProps.src,
58
+ src,
56
59
  mediaType: 'audio',
57
60
  playbackRate: playbackRate !== null && playbackRate !== void 0 ? playbackRate : 1,
58
61
  onlyWarnForMediaSeekingError: false,
62
+ acceptableTimeshift: acceptableTimeShiftInSeconds !== null && acceptableTimeShiftInSeconds !== void 0 ? acceptableTimeShiftInSeconds : use_media_playback_1.DEFAULT_ACCEPTABLE_TIMESHIFT,
59
63
  });
60
64
  (0, react_1.useImperativeHandle)(ref, () => {
61
65
  return audioRef.current;
62
- });
66
+ }, [audioRef]);
67
+ const currentOnDurationCallback = (0, react_1.useRef)();
68
+ currentOnDurationCallback.current = onDuration;
69
+ (0, react_1.useEffect)(() => {
70
+ var _a;
71
+ const { current } = audioRef;
72
+ if (!current) {
73
+ return;
74
+ }
75
+ if (current.duration) {
76
+ (_a = currentOnDurationCallback.current) === null || _a === void 0 ? void 0 : _a.call(currentOnDurationCallback, src, current.duration);
77
+ return;
78
+ }
79
+ const onLoadedMetadata = () => {
80
+ var _a;
81
+ (_a = currentOnDurationCallback.current) === null || _a === void 0 ? void 0 : _a.call(currentOnDurationCallback, src, current.duration);
82
+ };
83
+ current.addEventListener('loadedmetadata', onLoadedMetadata);
84
+ return () => {
85
+ current.removeEventListener('loadedmetadata', onLoadedMetadata);
86
+ };
87
+ }, [audioRef, src]);
63
88
  if (initialShouldPreMountAudioElements) {
64
89
  return null;
65
90
  }
@@ -1,6 +1,9 @@
1
1
  import type { ForwardRefExoticComponent, RefAttributes } from 'react';
2
2
  import React from 'react';
3
- export declare const AudioForRendering: ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.AudioHTMLAttributes<HTMLAudioElement>, HTMLAudioElement>, "onEnded" | "autoPlay" | "controls" | "loop"> & {
3
+ export declare const AudioForRendering: ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.AudioHTMLAttributes<HTMLAudioElement>, HTMLAudioElement>, "nonce" | "onEnded" | "autoPlay" | "controls"> & {
4
4
  volume?: import("../volume-prop").VolumeProp | undefined;
5
5
  playbackRate?: number | undefined;
6
+ acceptableTimeShiftInSeconds?: number | undefined;
7
+ } & {
8
+ onDuration: (src: string, durationInSeconds: number) => void;
6
9
  } & RefAttributes<HTMLAudioElement>>;
@@ -5,6 +5,8 @@ const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const absolute_src_1 = require("../absolute-src");
7
7
  const CompositionManager_1 = require("../CompositionManager");
8
+ const delay_render_1 = require("../delay-render");
9
+ const get_environment_1 = require("../get-environment");
8
10
  const random_1 = require("../random");
9
11
  const Sequence_1 = require("../Sequence");
10
12
  const timeline_position_state_1 = require("../timeline-position-state");
@@ -32,7 +34,7 @@ const AudioForRenderingRefForwardingFunction = (props, ref) => {
32
34
  });
33
35
  (0, react_1.useImperativeHandle)(ref, () => {
34
36
  return audioRef.current;
35
- });
37
+ }, []);
36
38
  (0, react_1.useEffect)(() => {
37
39
  var _a;
38
40
  if (!props.src) {
@@ -70,6 +72,36 @@ const AudioForRenderingRefForwardingFunction = (props, ref) => {
70
72
  playbackRate,
71
73
  props.playbackRate,
72
74
  ]);
75
+ const { src, onDuration } = props;
76
+ // If audio source switches, make new handle
77
+ if ((0, get_environment_1.getRemotionEnvironment)() === 'rendering') {
78
+ // eslint-disable-next-line react-hooks/rules-of-hooks
79
+ (0, react_1.useLayoutEffect)(() => {
80
+ if (process.env.NODE_ENV === 'test') {
81
+ return;
82
+ }
83
+ const newHandle = (0, delay_render_1.delayRender)('Loading <Audio> duration with src=' + src);
84
+ const { current } = audioRef;
85
+ const didLoad = () => {
86
+ if (current) {
87
+ onDuration(src, current.duration);
88
+ }
89
+ (0, delay_render_1.continueRender)(newHandle);
90
+ };
91
+ if (current === null || current === void 0 ? void 0 : current.duration) {
92
+ onDuration(src, current.duration);
93
+ (0, delay_render_1.continueRender)(newHandle);
94
+ }
95
+ else {
96
+ current === null || current === void 0 ? void 0 : current.addEventListener('loadedmetadata', didLoad, { once: true });
97
+ }
98
+ // If tag gets unmounted, clear pending handles because video metadata is not going to load
99
+ return () => {
100
+ current === null || current === void 0 ? void 0 : current.removeEventListener('loadedmetadata', didLoad);
101
+ (0, delay_render_1.continueRender)(newHandle);
102
+ };
103
+ }, [src, onDuration]);
104
+ }
73
105
  return (0, jsx_runtime_1.jsx)("audio", { ref: audioRef, ...nativeProps });
74
106
  };
75
107
  exports.AudioForRendering = (0, react_1.forwardRef)(AudioForRenderingRefForwardingFunction);
File without changes
File without changes
@@ -4,7 +4,8 @@ export declare type RemotionMainAudioProps = {
4
4
  startFrom?: number;
5
5
  endAt?: number;
6
6
  };
7
- export declare type RemotionAudioProps = Omit<React.DetailedHTMLProps<React.AudioHTMLAttributes<HTMLAudioElement>, HTMLAudioElement>, 'autoPlay' | 'controls' | 'loop' | 'onEnded'> & {
7
+ export declare type RemotionAudioProps = Omit<React.DetailedHTMLProps<React.AudioHTMLAttributes<HTMLAudioElement>, HTMLAudioElement>, 'autoPlay' | 'controls' | 'onEnded' | 'nonce'> & {
8
8
  volume?: VolumeProp;
9
9
  playbackRate?: number;
10
+ acceptableTimeShiftInSeconds?: number;
10
11
  };
File without changes
File without changes
File without changes
File without changes
File without changes
package/dist/bezier.d.ts CHANGED
File without changes
package/dist/bezier.js CHANGED
File without changes
File without changes
File without changes
package/dist/config.d.ts CHANGED
@@ -28,6 +28,11 @@ export declare type ConfigType = {
28
28
  readonly setKeyboardShortcutsEnabled: (enableShortcuts: boolean) => void;
29
29
  };
30
30
  readonly Bundling: {
31
+ /**
32
+ * Specify the entry point so you don't have to specify it in the
33
+ * CLI command
34
+ */
35
+ readonly setEntryPoint: (src: string) => void;
31
36
  /**
32
37
  * Pass in a function which takes the current Webpack config
33
38
  * and return a modified Webpack configuration.
@@ -196,6 +201,14 @@ export declare type ConfigType = {
196
201
  * Set to true if don't want a video but an image sequence as the output.
197
202
  */
198
203
  readonly setImageSequence: (newImageSequence: boolean) => void;
204
+ /**
205
+ * Overrides the height of a composition
206
+ */
207
+ readonly overrideHeight: (newHeight: number) => void;
208
+ /**
209
+ * Overrides the width of a composition
210
+ */
211
+ readonly overrideWidth: (newWidth: number) => void;
199
212
  /**
200
213
  * Set the ProRes profile.
201
214
  * This method is only valid if the codec has been set to 'prores'.
@@ -203,6 +216,23 @@ export declare type ConfigType = {
203
216
  * See https://avpres.net/FFmpeg/im_ProRes.html for meaning of possible values.
204
217
  */
205
218
  readonly setProResProfile: (profile: '4444-xq' | '4444' | 'hq' | 'standard' | 'light' | 'proxy' | undefined) => void;
219
+ /**
220
+ * Override the arguments that Remotion passes to FFMPEG.
221
+ * Consult https://remotion.dev/docs/renderer/render-media#ffmpegoverride before using this feature.
222
+ */
223
+ readonly overrideFfmpegCommand: (command: (info: {
224
+ type: 'pre-stitcher' | 'stitcher';
225
+ args: string[];
226
+ }) => string[]) => void;
227
+ /**
228
+ * Set a target audio bitrate to be passed to FFMPEG.
229
+ */
230
+ readonly setAudioBitrate: (bitrate: string | null) => void;
231
+ /**
232
+ * Set a target video bitrate to be passed to FFMPEG.
233
+ * Mutually exclusive with setCrf().
234
+ */
235
+ readonly setVideoBitrate: (bitrate: string | null) => void;
206
236
  };
207
237
  };
208
238
  export type { Concurrency, WebpackConfiguration, WebpackOverrideFn };
package/dist/config.js CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
package/dist/easing.d.ts CHANGED
File without changes
package/dist/easing.js CHANGED
File without changes
package/dist/freeze.d.ts CHANGED
File without changes
package/dist/freeze.js CHANGED
File without changes
File without changes
File without changes
File without changes
@@ -8,7 +8,7 @@ const getRemotionEnvironment = () => {
8
8
  }
9
9
  return 'rendering';
10
10
  }
11
- // The Jest framework sets NODE_ENV as test.
11
+ // The Vitest framework sets NODE_ENV as test.
12
12
  // Right now we don't need to treat it in a special
13
13
  // way which is good - defaulting to `rendering`.
14
14
  if (process.env.NODE_ENV === 'test') {
File without changes