remotion 4.0.0-webhook.27 → 4.1.0-alpha1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (283) hide show
  1. package/LICENSE.md +8 -8
  2. package/README.md +7 -7
  3. package/dist/{AbsoluteFill.d.ts → cjs/AbsoluteFill.d.ts} +2 -2
  4. package/dist/{AbsoluteFill.js → cjs/AbsoluteFill.js} +2 -2
  5. package/dist/cjs/AssetManager.d.ts +11 -0
  6. package/dist/cjs/AssetManager.js +40 -0
  7. package/dist/{CanUseRemotionHooks.d.ts → cjs/CanUseRemotionHooks.d.ts} +0 -0
  8. package/dist/{CanUseRemotionHooks.js → cjs/CanUseRemotionHooks.js} +0 -0
  9. package/dist/cjs/Clipper.d.ts +7 -0
  10. package/dist/cjs/Clipper.js +24 -0
  11. package/dist/cjs/Composition.d.ts +41 -0
  12. package/dist/cjs/Composition.js +132 -0
  13. package/dist/cjs/CompositionManager.d.ts +75 -0
  14. package/dist/{CompositionManager.js → cjs/CompositionManager.js} +29 -66
  15. package/dist/cjs/CompositionManagerContext.d.ts +18 -0
  16. package/dist/cjs/CompositionManagerContext.js +16 -0
  17. package/dist/cjs/EditorProps.d.ts +15 -0
  18. package/dist/cjs/EditorProps.js +53 -0
  19. package/dist/{Folder.d.ts → cjs/Folder.d.ts} +6 -2
  20. package/dist/{Folder.js → cjs/Folder.js} +10 -6
  21. package/dist/{IFrame.d.ts → cjs/IFrame.d.ts} +4 -0
  22. package/dist/{IFrame.js → cjs/IFrame.js} +8 -4
  23. package/dist/cjs/Img.d.ts +9 -0
  24. package/dist/cjs/Img.js +100 -0
  25. package/dist/cjs/NativeLayers.d.ts +13 -0
  26. package/dist/cjs/NativeLayers.js +29 -0
  27. package/dist/cjs/Null.d.ts +2 -0
  28. package/dist/cjs/Null.js +25 -0
  29. package/dist/{RemotionRoot.d.ts → cjs/RemotionRoot.d.ts} +1 -0
  30. package/dist/cjs/RemotionRoot.js +72 -0
  31. package/dist/cjs/ResolveCompositionConfig.d.ts +24 -0
  32. package/dist/cjs/ResolveCompositionConfig.js +192 -0
  33. package/dist/cjs/Sequence.d.ts +22 -0
  34. package/dist/{Sequence.js → cjs/Sequence.js} +27 -29
  35. package/dist/cjs/SequenceContext.d.ts +9 -0
  36. package/dist/cjs/SequenceContext.js +5 -0
  37. package/dist/cjs/SequenceManager.d.ts +11 -0
  38. package/dist/cjs/SequenceManager.js +57 -0
  39. package/dist/cjs/Still.d.ts +8 -0
  40. package/dist/cjs/Still.js +22 -0
  41. package/dist/{absolute-src.d.ts → cjs/absolute-src.d.ts} +0 -0
  42. package/dist/{absolute-src.js → cjs/absolute-src.js} +0 -0
  43. package/dist/{asset-types.d.ts → cjs/asset-types.d.ts} +0 -0
  44. package/dist/{asset-types.js → cjs/asset-types.js} +0 -0
  45. package/dist/{audio → cjs/audio}/Audio.d.ts +10 -4
  46. package/dist/cjs/audio/Audio.js +58 -0
  47. package/dist/cjs/audio/AudioForDevelopment.d.ts +11 -0
  48. package/dist/cjs/audio/AudioForDevelopment.js +101 -0
  49. package/dist/cjs/audio/AudioForRendering.d.ts +10 -0
  50. package/dist/cjs/audio/AudioForRendering.js +111 -0
  51. package/dist/cjs/audio/index.d.ts +2 -0
  52. package/dist/{audio → cjs/audio}/index.js +2 -2
  53. package/dist/cjs/audio/props.d.ts +12 -0
  54. package/dist/{audio → cjs/audio}/props.js +0 -0
  55. package/dist/{audio → cjs/audio}/shared-audio-tags.d.ts +10 -4
  56. package/dist/{audio → cjs/audio}/shared-audio-tags.js +35 -13
  57. package/dist/{audio → cjs/audio}/use-audio-frame.d.ts +0 -0
  58. package/dist/{audio → cjs/audio}/use-audio-frame.js +4 -4
  59. package/dist/{bezier.d.ts → cjs/bezier.d.ts} +0 -0
  60. package/dist/{bezier.js → cjs/bezier.js} +0 -0
  61. package/dist/cjs/cancel-render.d.ts +5 -0
  62. package/dist/cjs/cancel-render.js +47 -0
  63. package/dist/{config → cjs/config}/input-props.d.ts +0 -0
  64. package/dist/{config → cjs/config}/input-props.js +3 -3
  65. package/dist/{default-css.d.ts → cjs/default-css.d.ts} +0 -0
  66. package/dist/{default-css.js → cjs/default-css.js} +0 -0
  67. package/dist/{delay-render.d.ts → cjs/delay-render.d.ts} +4 -4
  68. package/dist/{delay-render.js → cjs/delay-render.js} +12 -12
  69. package/dist/{easing.d.ts → cjs/easing.d.ts} +4 -0
  70. package/dist/{easing.js → cjs/easing.js} +6 -2
  71. package/dist/cjs/freeze.d.ts +11 -0
  72. package/dist/{freeze.js → cjs/freeze.js} +8 -4
  73. package/dist/{get-asset-file-name.d.ts → cjs/get-asset-file-name.d.ts} +0 -0
  74. package/dist/{get-asset-file-name.js → cjs/get-asset-file-name.js} +0 -0
  75. package/dist/cjs/get-environment.d.ts +3 -0
  76. package/dist/{get-environment.js → cjs/get-environment.js} +14 -2
  77. package/dist/cjs/get-preview-dom-element.d.ts +2 -0
  78. package/dist/cjs/get-preview-dom-element.js +8 -0
  79. package/dist/cjs/get-static-files.d.ts +21 -0
  80. package/dist/cjs/get-static-files.js +35 -0
  81. package/dist/{get-timeline-clip-name.d.ts → cjs/get-timeline-clip-name.d.ts} +0 -0
  82. package/dist/{get-timeline-clip-name.js → cjs/get-timeline-clip-name.js} +0 -0
  83. package/dist/cjs/index.d.ts +102 -0
  84. package/dist/cjs/index.js +105 -0
  85. package/dist/cjs/internals.d.ts +131 -0
  86. package/dist/cjs/internals.js +120 -0
  87. package/dist/{interpolate-colors.d.ts → cjs/interpolate-colors.d.ts} +5 -0
  88. package/dist/{interpolate-colors.js → cjs/interpolate-colors.js} +10 -10
  89. package/dist/{interpolate.d.ts → cjs/interpolate.d.ts} +11 -7
  90. package/dist/{interpolate.js → cjs/interpolate.js} +0 -0
  91. package/dist/{is-approximately-the-same.d.ts → cjs/is-approximately-the-same.d.ts} +0 -0
  92. package/dist/{is-approximately-the-same.js → cjs/is-approximately-the-same.js} +0 -0
  93. package/dist/cjs/is-player.d.ts +3 -0
  94. package/dist/cjs/is-player.js +14 -0
  95. package/dist/{loading-indicator.d.ts → cjs/loading-indicator.d.ts} +0 -0
  96. package/dist/{loading-indicator.js → cjs/loading-indicator.js} +4 -4
  97. package/dist/cjs/loop/index.d.ts +13 -0
  98. package/dist/cjs/loop/index.js +46 -0
  99. package/dist/{multiple-versions-warning.d.ts → cjs/multiple-versions-warning.d.ts} +0 -0
  100. package/dist/{multiple-versions-warning.js → cjs/multiple-versions-warning.js} +11 -6
  101. package/dist/{nonce.d.ts → cjs/nonce.d.ts} +1 -1
  102. package/dist/{nonce.js → cjs/nonce.js} +6 -0
  103. package/dist/{play-and-handle-not-allowed-error.d.ts → cjs/play-and-handle-not-allowed-error.d.ts} +0 -0
  104. package/dist/{play-and-handle-not-allowed-error.js → cjs/play-and-handle-not-allowed-error.js} +4 -0
  105. package/dist/{portal-node.d.ts → cjs/portal-node.d.ts} +0 -0
  106. package/dist/{portal-node.js → cjs/portal-node.js} +0 -0
  107. package/dist/cjs/prefetch-state.d.ts +8 -0
  108. package/dist/cjs/prefetch-state.js +27 -0
  109. package/dist/cjs/prefetch.d.ts +13 -0
  110. package/dist/{prefetch.js → cjs/prefetch.js} +43 -17
  111. package/dist/cjs/props-if-has-props.d.ts +10 -0
  112. package/dist/{video-config.js → cjs/props-if-has-props.js} +0 -0
  113. package/dist/cjs/random.d.ts +6 -0
  114. package/dist/{random.js → cjs/random.js} +3 -3
  115. package/dist/{register-root.d.ts → cjs/register-root.d.ts} +4 -0
  116. package/dist/{register-root.js → cjs/register-root.js} +4 -0
  117. package/dist/cjs/resolve-video-config.d.ts +8 -0
  118. package/dist/cjs/resolve-video-config.js +89 -0
  119. package/dist/cjs/series/flatten-children.d.ts +2 -0
  120. package/dist/{series → cjs/series}/flatten-children.js +0 -0
  121. package/dist/cjs/series/index.d.ts +17 -0
  122. package/dist/{series → cjs/series}/index.js +22 -8
  123. package/dist/cjs/setup-env-variables.d.ts +1 -0
  124. package/dist/{setup-env-variables.js → cjs/setup-env-variables.js} +7 -9
  125. package/dist/{spring → cjs/spring}/index.d.ts +10 -6
  126. package/dist/cjs/spring/index.js +75 -0
  127. package/dist/cjs/spring/measure-spring.d.ts +12 -0
  128. package/dist/{spring → cjs/spring}/measure-spring.js +8 -4
  129. package/dist/{spring → cjs/spring}/spring-utils.d.ts +2 -2
  130. package/dist/{spring → cjs/spring}/spring-utils.js +0 -0
  131. package/dist/cjs/static-file.d.ts +33 -0
  132. package/dist/cjs/static-file.js +87 -0
  133. package/dist/{timeline-position-state.d.ts → cjs/timeline-position-state.d.ts} +4 -4
  134. package/dist/{timeline-position-state.js → cjs/timeline-position-state.js} +9 -1
  135. package/dist/cjs/truthy.d.ts +3 -0
  136. package/dist/{truthy.js → cjs/truthy.js} +0 -0
  137. package/dist/cjs/use-current-frame.d.ts +5 -0
  138. package/dist/{use-current-frame.js → cjs/use-current-frame.js} +8 -9
  139. package/dist/cjs/use-lazy-component.d.ts +7 -0
  140. package/dist/{use-lazy-component.js → cjs/use-lazy-component.js} +0 -0
  141. package/dist/{use-media-in-timeline.d.ts → cjs/use-media-in-timeline.d.ts} +3 -2
  142. package/dist/{use-media-in-timeline.js → cjs/use-media-in-timeline.js} +29 -25
  143. package/dist/{use-media-playback.d.ts → cjs/use-media-playback.d.ts} +3 -1
  144. package/dist/cjs/use-media-playback.js +86 -0
  145. package/dist/{use-media-tag-volume.d.ts → cjs/use-media-tag-volume.d.ts} +0 -0
  146. package/dist/{use-media-tag-volume.js → cjs/use-media-tag-volume.js} +0 -0
  147. package/dist/{use-sync-volume-with-media-tag.d.ts → cjs/use-sync-volume-with-media-tag.d.ts} +2 -2
  148. package/dist/{use-sync-volume-with-media-tag.js → cjs/use-sync-volume-with-media-tag.js} +5 -4
  149. package/dist/{use-unsafe-video-config.d.ts → cjs/use-unsafe-video-config.d.ts} +1 -1
  150. package/dist/{use-unsafe-video-config.js → cjs/use-unsafe-video-config.js} +4 -4
  151. package/dist/cjs/use-video-config.d.ts +8 -0
  152. package/dist/cjs/use-video-config.js +34 -0
  153. package/dist/cjs/use-video.d.ts +7 -0
  154. package/dist/cjs/use-video.js +38 -0
  155. package/dist/cjs/validate-frame.d.ts +5 -0
  156. package/dist/cjs/validate-frame.js +24 -0
  157. package/dist/cjs/validate-media-props.d.ts +4 -0
  158. package/dist/{validate-media-props.js → cjs/validate-media-props.js} +0 -0
  159. package/dist/{validate-start-from-props.d.ts → cjs/validate-start-from-props.d.ts} +0 -0
  160. package/dist/{validate-start-from-props.js → cjs/validate-start-from-props.js} +0 -0
  161. package/dist/{validation → cjs/validation}/validate-composition-id.d.ts +0 -0
  162. package/dist/{validation → cjs/validation}/validate-composition-id.js +0 -0
  163. package/dist/cjs/validation/validate-default-props.d.ts +1 -0
  164. package/dist/cjs/validation/validate-default-props.js +15 -0
  165. package/dist/{validation → cjs/validation}/validate-dimensions.d.ts +0 -0
  166. package/dist/{validation → cjs/validation}/validate-dimensions.js +0 -0
  167. package/dist/cjs/validation/validate-duration-in-frames.d.ts +5 -0
  168. package/dist/{validation → cjs/validation}/validate-duration-in-frames.js +5 -2
  169. package/dist/{validation → cjs/validation}/validate-folder-name.d.ts +0 -0
  170. package/dist/{validation → cjs/validation}/validate-folder-name.js +0 -0
  171. package/dist/{validation → cjs/validation}/validate-fps.d.ts +0 -0
  172. package/dist/{validation → cjs/validation}/validate-fps.js +0 -0
  173. package/dist/{validation → cjs/validation}/validation-spring-duration.d.ts +0 -0
  174. package/dist/{validation → cjs/validation}/validation-spring-duration.js +0 -0
  175. package/dist/cjs/version.d.ts +1 -0
  176. package/dist/{version.js → cjs/version.js} +1 -1
  177. package/dist/cjs/video/OffthreadVideo.d.ts +7 -0
  178. package/dist/cjs/video/OffthreadVideo.js +38 -0
  179. package/dist/{video → cjs/video}/OffthreadVideoForRendering.d.ts +1 -1
  180. package/dist/cjs/video/OffthreadVideoForRendering.js +103 -0
  181. package/dist/cjs/video/Video.d.ts +12 -0
  182. package/dist/cjs/video/Video.js +55 -0
  183. package/dist/{video → cjs/video}/VideoForDevelopment.d.ts +5 -2
  184. package/dist/cjs/video/VideoForDevelopment.js +117 -0
  185. package/dist/cjs/video/VideoForRendering.d.ts +10 -0
  186. package/dist/cjs/video/VideoForRendering.js +208 -0
  187. package/dist/cjs/video/duration-state.d.ts +17 -0
  188. package/dist/cjs/video/duration-state.js +35 -0
  189. package/dist/{video → cjs/video}/get-current-time.d.ts +0 -0
  190. package/dist/{video → cjs/video}/get-current-time.js +12 -11
  191. package/dist/cjs/video/index.d.ts +3 -0
  192. package/dist/{video → cjs/video}/index.js +4 -4
  193. package/dist/cjs/video/props.d.ts +32 -0
  194. package/dist/cjs/video/props.js +2 -0
  195. package/dist/cjs/video/video-fragment.d.ts +12 -0
  196. package/dist/cjs/video/video-fragment.js +60 -0
  197. package/dist/{video-config.d.ts → cjs/video-config.d.ts} +2 -2
  198. package/dist/{video/props.js → cjs/video-config.js} +0 -0
  199. package/dist/{volume-position-state.d.ts → cjs/volume-position-state.d.ts} +4 -4
  200. package/dist/{volume-position-state.js → cjs/volume-position-state.js} +0 -0
  201. package/dist/{volume-prop.d.ts → cjs/volume-prop.d.ts} +3 -2
  202. package/dist/{volume-prop.js → cjs/volume-prop.js} +4 -3
  203. package/dist/{warn-about-non-seekable-media.d.ts → cjs/warn-about-non-seekable-media.d.ts} +0 -0
  204. package/dist/{warn-about-non-seekable-media.js → cjs/warn-about-non-seekable-media.js} +2 -2
  205. package/dist/cjs/wrap-remotion-context.d.ts +31 -0
  206. package/dist/cjs/wrap-remotion-context.js +85 -0
  207. package/dist/esm/index.mjs +4623 -0
  208. package/dist/esm/version.mjs +4 -0
  209. package/package.json +80 -57
  210. package/version.js +2 -1
  211. package/.prettierrc.js +0 -14
  212. package/.turbo/turbo-build.log +0 -5
  213. package/dist/Composition.d.ts +0 -22
  214. package/dist/Composition.js +0 -98
  215. package/dist/CompositionManager.d.ts +0 -79
  216. package/dist/Img.d.ts +0 -2
  217. package/dist/Img.js +0 -51
  218. package/dist/RemotionRoot.js +0 -71
  219. package/dist/Sequence.d.ts +0 -29
  220. package/dist/Still.d.ts +0 -3
  221. package/dist/Still.js +0 -9
  222. package/dist/audio/Audio.js +0 -32
  223. package/dist/audio/AudioForDevelopment.d.ts +0 -8
  224. package/dist/audio/AudioForDevelopment.js +0 -71
  225. package/dist/audio/AudioForRendering.d.ts +0 -6
  226. package/dist/audio/AudioForRendering.js +0 -75
  227. package/dist/audio/index.d.ts +0 -2
  228. package/dist/audio/props.d.ts +0 -10
  229. package/dist/config.d.ts +0 -218
  230. package/dist/config.js +0 -21
  231. package/dist/freeze.d.ts +0 -7
  232. package/dist/get-environment.d.ts +0 -2
  233. package/dist/get-preview-dom-element.d.ts +0 -1
  234. package/dist/get-preview-dom-element.js +0 -7
  235. package/dist/index.d.ts +0 -72
  236. package/dist/index.js +0 -58
  237. package/dist/internals.d.ts +0 -88
  238. package/dist/internals.js +0 -93
  239. package/dist/loop/index.d.ts +0 -9
  240. package/dist/loop/index.js +0 -28
  241. package/dist/prefetch-state.d.ts +0 -13
  242. package/dist/prefetch-state.js +0 -26
  243. package/dist/prefetch.d.ts +0 -7
  244. package/dist/random.d.ts +0 -6
  245. package/dist/series/flatten-children.d.ts +0 -2
  246. package/dist/series/index.d.ts +0 -13
  247. package/dist/setup-env-variables.d.ts +0 -2
  248. package/dist/spring/index.js +0 -51
  249. package/dist/spring/measure-spring.d.ts +0 -8
  250. package/dist/static-file.d.ts +0 -1
  251. package/dist/static-file.js +0 -29
  252. package/dist/truthy.d.ts +0 -3
  253. package/dist/use-current-frame.d.ts +0 -6
  254. package/dist/use-lazy-component.d.ts +0 -7
  255. package/dist/use-media-playback.js +0 -75
  256. package/dist/use-video-config.d.ts +0 -7
  257. package/dist/use-video-config.js +0 -26
  258. package/dist/use-video.d.ts +0 -13
  259. package/dist/use-video.js +0 -28
  260. package/dist/validate-media-props.d.ts +0 -4
  261. package/dist/validation/validate-duration-in-frames.d.ts +0 -1
  262. package/dist/validation/validate-offthreadvideo-image-format.d.ts +0 -1
  263. package/dist/validation/validate-offthreadvideo-image-format.js +0 -15
  264. package/dist/version.d.ts +0 -1
  265. package/dist/video/LoopedVideo.d.ts +0 -3
  266. package/dist/video/LoopedVideo.js +0 -16
  267. package/dist/video/OffthreadVideo.d.ts +0 -3
  268. package/dist/video/OffthreadVideo.js +0 -27
  269. package/dist/video/OffthreadVideoForRendering.js +0 -101
  270. package/dist/video/Video.d.ts +0 -6
  271. package/dist/video/Video.js +0 -29
  272. package/dist/video/VideoForDevelopment.js +0 -69
  273. package/dist/video/VideoForRendering.d.ts +0 -6
  274. package/dist/video/VideoForRendering.js +0 -168
  275. package/dist/video/duration-state.d.ts +0 -8
  276. package/dist/video/duration-state.js +0 -15
  277. package/dist/video/index.d.ts +0 -3
  278. package/dist/video/props.d.ts +0 -21
  279. package/dist/wrap-remotion-context.d.ts +0 -14
  280. package/dist/wrap-remotion-context.js +0 -65
  281. package/ensure-correct-version.js +0 -24
  282. package/tsconfig.json +0 -12
  283. package/version.d.ts +0 -1
@@ -2,13 +2,13 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useUnsafeVideoConfig = void 0;
4
4
  const react_1 = require("react");
5
- const Sequence_1 = require("./Sequence");
6
- const use_video_1 = require("./use-video");
5
+ const SequenceContext_js_1 = require("./SequenceContext.js");
6
+ const use_video_js_1 = require("./use-video.js");
7
7
  const useUnsafeVideoConfig = () => {
8
8
  var _a;
9
- const context = (0, react_1.useContext)(Sequence_1.SequenceContext);
9
+ const context = (0, react_1.useContext)(SequenceContext_js_1.SequenceContext);
10
10
  const ctxDuration = (_a = context === null || context === void 0 ? void 0 : context.durationInFrames) !== null && _a !== void 0 ? _a : null;
11
- const video = (0, use_video_1.useVideo)();
11
+ const video = (0, use_video_js_1.useVideo)();
12
12
  return (0, react_1.useMemo)(() => {
13
13
  if (!video) {
14
14
  return null;
@@ -0,0 +1,8 @@
1
+ import type { VideoConfig } from './video-config.js';
2
+ /**
3
+ * /**
4
+ * @description Get some info about the context of the video that you are making.
5
+ * @see [Documentation](https://www.remotion.dev/docs/use-video-config)
6
+ * @returns Returns an object containing `fps`, `width`, `height` and `durationInFrames`, all of type `number`.
7
+ */
8
+ export declare const useVideoConfig: () => VideoConfig;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useVideoConfig = void 0;
4
+ const react_1 = require("react");
5
+ const CanUseRemotionHooks_js_1 = require("./CanUseRemotionHooks.js");
6
+ const is_player_js_1 = require("./is-player.js");
7
+ const use_unsafe_video_config_js_1 = require("./use-unsafe-video-config.js");
8
+ /**
9
+ * /**
10
+ * @description Get some info about the context of the video that you are making.
11
+ * @see [Documentation](https://www.remotion.dev/docs/use-video-config)
12
+ * @returns Returns an object containing `fps`, `width`, `height` and `durationInFrames`, all of type `number`.
13
+ */
14
+ const useVideoConfig = () => {
15
+ const videoConfig = (0, use_unsafe_video_config_js_1.useUnsafeVideoConfig)();
16
+ const context = (0, react_1.useContext)(CanUseRemotionHooks_js_1.CanUseRemotionHooks);
17
+ const isPlayer = (0, is_player_js_1.useIsPlayer)();
18
+ if (!videoConfig) {
19
+ if ((typeof window !== 'undefined' && window.remotion_isPlayer) ||
20
+ isPlayer) {
21
+ throw new Error([
22
+ 'No video config found. Likely reasons:',
23
+ '- You are probably calling useVideoConfig() from outside the component passed to <Player />. See https://www.remotion.dev/docs/player/examples for how to set up the Player correctly.',
24
+ '- You have multiple versions of Remotion installed which causes the React context to get lost.',
25
+ ].join('-'));
26
+ }
27
+ throw new Error('No video config found. You are probably calling useVideoConfig() from a component which has not been registered as a <Composition />. See https://www.remotion.dev/docs/the-fundamentals#defining-compositions for more information.');
28
+ }
29
+ if (!context) {
30
+ throw new Error('Called useVideoConfig() outside a Remotion composition.');
31
+ }
32
+ return videoConfig;
33
+ };
34
+ exports.useVideoConfig = useVideoConfig;
@@ -0,0 +1,7 @@
1
+ import type { ComponentType, LazyExoticComponent } from 'react';
2
+ import type { VideoConfig } from './video-config.js';
3
+ type ReturnType = (VideoConfig & {
4
+ component: LazyExoticComponent<ComponentType<Record<string, unknown> | undefined>>;
5
+ }) | null;
6
+ export declare const useVideo: () => ReturnType;
7
+ export {};
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useVideo = void 0;
4
+ const react_1 = require("react");
5
+ const CompositionManagerContext_js_1 = require("./CompositionManagerContext.js");
6
+ const ResolveCompositionConfig_js_1 = require("./ResolveCompositionConfig.js");
7
+ const useVideo = () => {
8
+ const context = (0, react_1.useContext)(CompositionManagerContext_js_1.CompositionManager);
9
+ const selected = context.compositions.find((c) => {
10
+ return c.id === context.currentComposition;
11
+ });
12
+ const resolved = (0, ResolveCompositionConfig_js_1.useResolvedVideoConfig)(context.currentComposition);
13
+ return (0, react_1.useMemo)(() => {
14
+ var _a;
15
+ if (!resolved) {
16
+ return null;
17
+ }
18
+ if (resolved.type === 'error') {
19
+ return null;
20
+ }
21
+ if (resolved.type === 'loading') {
22
+ return null;
23
+ }
24
+ if (!selected) {
25
+ return null;
26
+ }
27
+ return {
28
+ ...resolved.result,
29
+ defaultProps: selected.defaultProps,
30
+ id: selected.id,
31
+ // We override the selected metadata with the metadata that was passed to renderMedia(),
32
+ // and don't allow it to be changed during render anymore
33
+ ...((_a = context.currentCompositionMetadata) !== null && _a !== void 0 ? _a : {}),
34
+ component: selected.component,
35
+ };
36
+ }, [context.currentCompositionMetadata, resolved, selected]);
37
+ };
38
+ exports.useVideo = useVideo;
@@ -0,0 +1,5 @@
1
+ export declare const validateFrame: ({ allowFloats, durationInFrames, frame, }: {
2
+ frame: number;
3
+ durationInFrames: number;
4
+ allowFloats: boolean;
5
+ }) => void;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateFrame = void 0;
4
+ const validateFrame = ({ allowFloats, durationInFrames, frame, }) => {
5
+ if (typeof frame === 'undefined') {
6
+ throw new TypeError(`Argument missing for parameter "frame"`);
7
+ }
8
+ if (typeof frame !== 'number') {
9
+ throw new TypeError(`Argument passed for "frame" is not a number: ${frame}`);
10
+ }
11
+ if (!Number.isFinite(frame)) {
12
+ throw new RangeError(`Frame ${frame} is not finite`);
13
+ }
14
+ if (frame % 1 !== 0 && !allowFloats) {
15
+ throw new RangeError(`Argument for frame must be an integer, but got ${frame}`);
16
+ }
17
+ if (frame < 0 && frame < -durationInFrames) {
18
+ throw new RangeError(`Cannot use frame ${frame}: Duration of composition is ${durationInFrames}, therefore the lowest frame that can be rendered is ${-durationInFrames}`);
19
+ }
20
+ if (frame > durationInFrames - 1) {
21
+ throw new RangeError(`Cannot use frame ${frame}: Duration of composition is ${durationInFrames}, therefore the highest frame that can be rendered is ${durationInFrames - 1}`);
22
+ }
23
+ };
24
+ exports.validateFrame = validateFrame;
@@ -0,0 +1,4 @@
1
+ import type { RemotionAudioProps } from './audio/index.js';
2
+ import type { RemotionVideoProps } from './video/index.js';
3
+ import type { OffthreadVideoProps } from './video/props.js';
4
+ export declare const validateMediaProps: (props: RemotionVideoProps | RemotionAudioProps | OffthreadVideoProps, component: 'Video' | 'Audio') => void;
@@ -0,0 +1 @@
1
+ export declare const validateDefaultAndInputProps: (defaultProps: unknown, name: 'defaultProps' | 'inputProps', compositionId: string | null) => void;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateDefaultAndInputProps = void 0;
4
+ const validateDefaultAndInputProps = (defaultProps, name, compositionId) => {
5
+ if (!defaultProps) {
6
+ return;
7
+ }
8
+ if (typeof defaultProps !== 'object') {
9
+ throw new Error(`"${name}" must be an object, but you passed a value of type ${typeof defaultProps}`);
10
+ }
11
+ if (Array.isArray(defaultProps)) {
12
+ throw new Error(`"${name}" must be an object, an array was passed ${compositionId ? `for composition "${compositionId}"` : ''}`);
13
+ }
14
+ };
15
+ exports.validateDefaultAndInputProps = validateDefaultAndInputProps;
@@ -0,0 +1,5 @@
1
+ export declare const validateDurationInFrames: ({ allowFloats, component, durationInFrames, }: {
2
+ durationInFrames: number;
3
+ component: string;
4
+ allowFloats: boolean;
5
+ }) => void;
@@ -1,15 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.validateDurationInFrames = void 0;
4
- const validateDurationInFrames = (durationInFrames, component) => {
4
+ const validateDurationInFrames = ({ allowFloats, component, durationInFrames, }) => {
5
5
  if (typeof durationInFrames !== 'number') {
6
6
  throw new Error(`The "durationInFrames" prop ${component} must be a number, but you passed a value of type ${typeof durationInFrames}`);
7
7
  }
8
8
  if (durationInFrames <= 0) {
9
9
  throw new TypeError(`The "durationInFrames" prop ${component} must be positive, but got ${durationInFrames}.`);
10
10
  }
11
- if (durationInFrames % 1 !== 0) {
11
+ if (!allowFloats && durationInFrames % 1 !== 0) {
12
12
  throw new TypeError(`The "durationInFrames" prop ${component} must be an integer, but got ${durationInFrames}.`);
13
13
  }
14
+ if (!Number.isFinite(durationInFrames)) {
15
+ throw new TypeError(`The "durationInFrames" prop ${component} must be finite, but got ${durationInFrames}.`);
16
+ }
14
17
  };
15
18
  exports.validateDurationInFrames = validateDurationInFrames;
@@ -0,0 +1 @@
1
+ export declare const VERSION = "4.1.0-alpha1";
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
4
  // Automatically generated on publish
5
- exports.VERSION = '4.0.0-webhook.27+eb81308ee';
5
+ exports.VERSION = '4.1.0-alpha1';
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import type { OffthreadVideoProps, RemotionMainVideoProps } from './props.js';
3
+ /**
4
+ * @description This method imports and displays a video, similar to <Video />. During rendering, it extracts the exact frame from the video and displays it in an <img> tag
5
+ * @see [Documentation](https://www.remotion.dev/docs/offthreadvideo)
6
+ */
7
+ export declare const OffthreadVideo: React.FC<Omit<OffthreadVideoProps & RemotionMainVideoProps, 'loop'>>;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OffthreadVideo = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const get_environment_js_1 = require("../get-environment.js");
7
+ const Sequence_js_1 = require("../Sequence.js");
8
+ const validate_media_props_js_1 = require("../validate-media-props.js");
9
+ const validate_start_from_props_js_1 = require("../validate-start-from-props.js");
10
+ const OffthreadVideoForRendering_js_1 = require("./OffthreadVideoForRendering.js");
11
+ const VideoForDevelopment_js_1 = require("./VideoForDevelopment.js");
12
+ /**
13
+ * @description This method imports and displays a video, similar to <Video />. During rendering, it extracts the exact frame from the video and displays it in an <img> tag
14
+ * @see [Documentation](https://www.remotion.dev/docs/offthreadvideo)
15
+ */
16
+ const OffthreadVideo = (props) => {
17
+ const { startFrom, endAt, imageFormat, ...otherProps } = props;
18
+ const environment = (0, get_environment_js_1.useRemotionEnvironment)();
19
+ const onDuration = (0, react_1.useCallback)(() => undefined, []);
20
+ if (typeof props.src !== 'string') {
21
+ throw new TypeError(`The \`<OffthreadVideo>\` tag requires a string for \`src\`, but got ${JSON.stringify(props.src)} instead.`);
22
+ }
23
+ if (props.imageFormat) {
24
+ throw new TypeError(`The \`<OffthreadVideo>\` tag does no longer accept \`imageFormat\`. Use the \`transparent\` prop if you want to render a transparent video.`);
25
+ }
26
+ if (typeof startFrom !== 'undefined' || typeof endAt !== 'undefined') {
27
+ (0, validate_start_from_props_js_1.validateStartFromProps)(startFrom, endAt);
28
+ const startFromFrameNo = startFrom !== null && startFrom !== void 0 ? startFrom : 0;
29
+ const endAtFrameNo = endAt !== null && endAt !== void 0 ? endAt : Infinity;
30
+ 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.OffthreadVideo, { ...otherProps }) }));
31
+ }
32
+ (0, validate_media_props_js_1.validateMediaProps)(props, 'Video');
33
+ if (environment === 'rendering') {
34
+ return ((0, jsx_runtime_1.jsx)(OffthreadVideoForRendering_js_1.OffthreadVideoForRendering, { imageFormat: imageFormat, ...otherProps }));
35
+ }
36
+ return ((0, jsx_runtime_1.jsx)(VideoForDevelopment_js_1.VideoForDevelopment, { onDuration: onDuration, onlyWarnForMediaSeekingError: true, ...otherProps }));
37
+ };
38
+ exports.OffthreadVideo = OffthreadVideo;
@@ -1,3 +1,3 @@
1
1
  import React from 'react';
2
- import type { OffthreadVideoProps } from './props';
2
+ import type { OffthreadVideoProps } from './props.js';
3
3
  export declare const OffthreadVideoForRendering: React.FC<OffthreadVideoProps>;
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OffthreadVideoForRendering = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const absolute_src_js_1 = require("../absolute-src.js");
7
+ const AssetManager_js_1 = require("../AssetManager.js");
8
+ const use_audio_frame_js_1 = require("../audio/use-audio-frame.js");
9
+ const default_css_js_1 = require("../default-css.js");
10
+ const Img_js_1 = require("../Img.js");
11
+ const random_js_1 = require("../random.js");
12
+ const SequenceContext_js_1 = require("../SequenceContext.js");
13
+ const timeline_position_state_js_1 = require("../timeline-position-state.js");
14
+ const truthy_js_1 = require("../truthy.js");
15
+ const use_current_frame_js_1 = require("../use-current-frame.js");
16
+ const use_unsafe_video_config_js_1 = require("../use-unsafe-video-config.js");
17
+ const volume_prop_js_1 = require("../volume-prop.js");
18
+ const get_current_time_js_1 = require("./get-current-time.js");
19
+ const OffthreadVideoForRendering = ({ onError, volume: volumeProp, playbackRate, src, muted, allowAmplificationDuringRender, transparent = false, ...props }) => {
20
+ const absoluteFrame = (0, timeline_position_state_js_1.useTimelinePosition)();
21
+ const frame = (0, use_current_frame_js_1.useCurrentFrame)();
22
+ const volumePropsFrame = (0, use_audio_frame_js_1.useFrameForVolumeProp)();
23
+ const videoConfig = (0, use_unsafe_video_config_js_1.useUnsafeVideoConfig)();
24
+ const sequenceContext = (0, react_1.useContext)(SequenceContext_js_1.SequenceContext);
25
+ const mediaStartsAt = (0, use_audio_frame_js_1.useMediaStartsAt)();
26
+ const { registerAsset, unregisterAsset } = (0, react_1.useContext)(AssetManager_js_1.AssetManager);
27
+ if (!src) {
28
+ throw new TypeError('No `src` was passed to <OffthreadVideo>.');
29
+ }
30
+ // Generate a string that's as unique as possible for this asset
31
+ // but at the same time the same on all threads
32
+ const id = (0, react_1.useMemo)(() => `offthreadvideo-${(0, random_js_1.random)(src !== null && src !== void 0 ? src : '')}-${sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.cumulatedFrom}-${sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.relativeFrom}-${sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.durationInFrames}`, [
33
+ src,
34
+ sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.cumulatedFrom,
35
+ sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.relativeFrom,
36
+ sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.durationInFrames,
37
+ ]);
38
+ if (!videoConfig) {
39
+ throw new Error('No video config found');
40
+ }
41
+ const volume = (0, volume_prop_js_1.evaluateVolume)({
42
+ volume: volumeProp,
43
+ frame: volumePropsFrame,
44
+ mediaVolume: 1,
45
+ allowAmplificationDuringRender: allowAmplificationDuringRender !== null && allowAmplificationDuringRender !== void 0 ? allowAmplificationDuringRender : false,
46
+ });
47
+ (0, react_1.useEffect)(() => {
48
+ if (!src) {
49
+ throw new Error('No src passed');
50
+ }
51
+ if (!window.remotion_audioEnabled) {
52
+ return;
53
+ }
54
+ if (muted) {
55
+ return;
56
+ }
57
+ if (volume <= 0) {
58
+ return;
59
+ }
60
+ registerAsset({
61
+ type: 'video',
62
+ src: (0, absolute_src_js_1.getAbsoluteSrc)(src),
63
+ id,
64
+ frame: absoluteFrame,
65
+ volume,
66
+ mediaFrame: frame,
67
+ playbackRate: playbackRate !== null && playbackRate !== void 0 ? playbackRate : 1,
68
+ allowAmplificationDuringRender: allowAmplificationDuringRender !== null && allowAmplificationDuringRender !== void 0 ? allowAmplificationDuringRender : false,
69
+ });
70
+ return () => unregisterAsset(id);
71
+ }, [
72
+ muted,
73
+ src,
74
+ registerAsset,
75
+ id,
76
+ unregisterAsset,
77
+ volume,
78
+ frame,
79
+ absoluteFrame,
80
+ playbackRate,
81
+ allowAmplificationDuringRender,
82
+ ]);
83
+ const currentTime = (0, react_1.useMemo)(() => {
84
+ return ((0, get_current_time_js_1.getExpectedMediaFrameUncorrected)({
85
+ frame,
86
+ playbackRate: playbackRate || 1,
87
+ startFrom: -mediaStartsAt,
88
+ }) / videoConfig.fps);
89
+ }, [frame, mediaStartsAt, playbackRate, videoConfig.fps]);
90
+ const actualSrc = (0, react_1.useMemo)(() => {
91
+ return `http://localhost:${window.remotion_proxyPort}/proxy?src=${encodeURIComponent((0, absolute_src_js_1.getAbsoluteSrc)(src))}&time=${encodeURIComponent(currentTime)}&transparent=${String(transparent)}`;
92
+ }, [currentTime, src, transparent]);
93
+ const onErr = (0, react_1.useCallback)((e) => {
94
+ onError === null || onError === void 0 ? void 0 : onError(e);
95
+ }, [onError]);
96
+ const className = (0, react_1.useMemo)(() => {
97
+ return [default_css_js_1.OFFTHREAD_VIDEO_CLASS_NAME, props.className]
98
+ .filter(truthy_js_1.truthy)
99
+ .join(' ');
100
+ }, [props.className]);
101
+ return ((0, jsx_runtime_1.jsx)(Img_js_1.Img, { src: actualSrc, className: className, ...props, onError: onErr }));
102
+ };
103
+ exports.OffthreadVideoForRendering = OffthreadVideoForRendering;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import type { RemotionMainVideoProps } from './props.js';
3
+ /**
4
+ * @description allows you to include a video file in your Remotion project. It wraps the native HTMLVideoElement.
5
+ * @see [Documentation](https://www.remotion.dev/docs/video)
6
+ */
7
+ export declare const Video: (props: Omit<React.DetailedHTMLProps<React.VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>, "nonce" | "onEnded" | "autoPlay" | "controls"> & {
8
+ volume?: import("../volume-prop.js").VolumeProp | undefined;
9
+ playbackRate?: number | undefined;
10
+ acceptableTimeShiftInSeconds?: number | undefined;
11
+ allowAmplificationDuringRender?: boolean | undefined;
12
+ } & RemotionMainVideoProps & React.RefAttributes<HTMLVideoElement | null>) => React.ReactElement | null;
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Video = 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 get_environment_js_1 = require("../get-environment.js");
8
+ const index_js_1 = require("../loop/index.js");
9
+ const Sequence_js_1 = require("../Sequence.js");
10
+ const use_video_config_js_1 = require("../use-video-config.js");
11
+ const validate_media_props_js_1 = require("../validate-media-props.js");
12
+ const validate_start_from_props_js_1 = require("../validate-start-from-props.js");
13
+ const duration_state_js_1 = require("./duration-state.js");
14
+ const VideoForDevelopment_js_1 = require("./VideoForDevelopment.js");
15
+ const VideoForRendering_js_1 = require("./VideoForRendering.js");
16
+ const VideoForwardingFunction = (props, ref) => {
17
+ var _a;
18
+ const { startFrom, endAt, ...otherProps } = props;
19
+ const { loop, ...propsOtherThanLoop } = props;
20
+ const { fps } = (0, use_video_config_js_1.useVideoConfig)();
21
+ const environment = (0, get_environment_js_1.useRemotionEnvironment)();
22
+ const { durations, setDurations } = (0, react_1.useContext)(duration_state_js_1.DurationsContext);
23
+ if (typeof ref === 'string') {
24
+ throw new Error('string refs are not supported');
25
+ }
26
+ if (typeof props.src !== 'string') {
27
+ throw new TypeError(`The \`<Video>\` tag requires a string for \`src\`, but got ${JSON.stringify(props.src)} instead.`);
28
+ }
29
+ const onDuration = (0, react_1.useCallback)((src, durationInSeconds) => {
30
+ setDurations({ type: 'got-duration', durationInSeconds, src });
31
+ }, [setDurations]);
32
+ if (loop && props.src && durations[(0, absolute_src_js_1.getAbsoluteSrc)(props.src)] !== undefined) {
33
+ const naturalDuration = durations[(0, absolute_src_js_1.getAbsoluteSrc)(props.src)] * fps;
34
+ const playbackRate = (_a = props.playbackRate) !== null && _a !== void 0 ? _a : 1;
35
+ const durationInFrames = Math.floor(naturalDuration / playbackRate);
36
+ return ((0, jsx_runtime_1.jsx)(index_js_1.Loop, { durationInFrames: durationInFrames, children: (0, jsx_runtime_1.jsx)(exports.Video, { ...propsOtherThanLoop, ref: ref }) }));
37
+ }
38
+ if (typeof startFrom !== 'undefined' || typeof endAt !== 'undefined') {
39
+ (0, validate_start_from_props_js_1.validateStartFromProps)(startFrom, endAt);
40
+ const startFromFrameNo = startFrom !== null && startFrom !== void 0 ? startFrom : 0;
41
+ const endAtFrameNo = endAt !== null && endAt !== void 0 ? endAt : Infinity;
42
+ 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.Video, { ...otherProps, ref: ref }) }));
43
+ }
44
+ (0, validate_media_props_js_1.validateMediaProps)(props, 'Video');
45
+ if (environment === 'rendering') {
46
+ return ((0, jsx_runtime_1.jsx)(VideoForRendering_js_1.VideoForRendering, { onDuration: onDuration, ...otherProps, ref: ref }));
47
+ }
48
+ return ((0, jsx_runtime_1.jsx)(VideoForDevelopment_js_1.VideoForDevelopment, { onlyWarnForMediaSeekingError: false, ...otherProps, ref: ref, onDuration: onDuration }));
49
+ };
50
+ const forward = react_1.forwardRef;
51
+ /**
52
+ * @description allows you to include a video file in your Remotion project. It wraps the native HTMLVideoElement.
53
+ * @see [Documentation](https://www.remotion.dev/docs/video)
54
+ */
55
+ exports.Video = forward(VideoForwardingFunction);
@@ -1,8 +1,11 @@
1
1
  import type { ForwardRefExoticComponent, RefAttributes } from 'react';
2
2
  import React from 'react';
3
- export declare const VideoForDevelopment: ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>, "onEnded" | "autoPlay" | "controls" | "loop"> & {
4
- volume?: import("../volume-prop").VolumeProp | undefined;
3
+ export declare const VideoForDevelopment: ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>, "nonce" | "onEnded" | "autoPlay" | "controls"> & {
4
+ volume?: import("../volume-prop.js").VolumeProp | undefined;
5
5
  playbackRate?: number | undefined;
6
+ acceptableTimeShiftInSeconds?: number | undefined;
7
+ allowAmplificationDuringRender?: boolean | undefined;
6
8
  } & {
7
9
  onlyWarnForMediaSeekingError: boolean;
10
+ onDuration: (src: string, durationInSeconds: number) => void;
8
11
  } & RefAttributes<HTMLVideoElement>>;
@@ -0,0 +1,117 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VideoForDevelopment = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const use_audio_frame_js_1 = require("../audio/use-audio-frame.js");
7
+ const prefetch_js_1 = require("../prefetch.js");
8
+ const SequenceContext_js_1 = require("../SequenceContext.js");
9
+ const use_media_in_timeline_js_1 = require("../use-media-in-timeline.js");
10
+ const use_media_playback_js_1 = require("../use-media-playback.js");
11
+ const use_media_tag_volume_js_1 = require("../use-media-tag-volume.js");
12
+ const use_sync_volume_with_media_tag_js_1 = require("../use-sync-volume-with-media-tag.js");
13
+ const use_video_config_js_1 = require("../use-video-config.js");
14
+ const volume_position_state_js_1 = require("../volume-position-state.js");
15
+ const video_fragment_js_1 = require("./video-fragment.js");
16
+ const VideoForDevelopmentRefForwardingFunction = (props, ref) => {
17
+ var _a, _b;
18
+ const videoRef = (0, react_1.useRef)(null);
19
+ const volumePropFrame = (0, use_audio_frame_js_1.useFrameForVolumeProp)();
20
+ const { fps, durationInFrames } = (0, use_video_config_js_1.useVideoConfig)();
21
+ const parentSequence = (0, react_1.useContext)(SequenceContext_js_1.SequenceContext);
22
+ const { volume, muted, playbackRate, onlyWarnForMediaSeekingError, src, onDuration,
23
+ // @ts-expect-error
24
+ acceptableTimeShift, acceptableTimeShiftInSeconds, ...nativeProps } = props;
25
+ if (typeof acceptableTimeShift !== 'undefined') {
26
+ throw new Error('acceptableTimeShift has been removed. Use acceptableTimeShiftInSeconds instead.');
27
+ }
28
+ const actualVolume = (0, use_media_tag_volume_js_1.useMediaTagVolume)(videoRef);
29
+ const [mediaVolume] = (0, volume_position_state_js_1.useMediaVolumeState)();
30
+ const [mediaMuted] = (0, volume_position_state_js_1.useMediaMutedState)();
31
+ (0, use_media_in_timeline_js_1.useMediaInTimeline)({
32
+ mediaRef: videoRef,
33
+ volume,
34
+ mediaVolume,
35
+ mediaType: 'video',
36
+ src,
37
+ playbackRate: (_a = props.playbackRate) !== null && _a !== void 0 ? _a : 1,
38
+ });
39
+ (0, use_sync_volume_with_media_tag_js_1.useSyncVolumeWithMediaTag)({
40
+ volumePropFrame,
41
+ actualVolume,
42
+ volume,
43
+ mediaVolume,
44
+ mediaRef: videoRef,
45
+ });
46
+ (0, use_media_playback_js_1.useMediaPlayback)({
47
+ mediaRef: videoRef,
48
+ src,
49
+ mediaType: 'video',
50
+ playbackRate: (_b = props.playbackRate) !== null && _b !== void 0 ? _b : 1,
51
+ onlyWarnForMediaSeekingError,
52
+ acceptableTimeshift: acceptableTimeShiftInSeconds !== null && acceptableTimeShiftInSeconds !== void 0 ? acceptableTimeShiftInSeconds : use_media_playback_js_1.DEFAULT_ACCEPTABLE_TIMESHIFT,
53
+ });
54
+ const actualFrom = parentSequence
55
+ ? parentSequence.relativeFrom + parentSequence.cumulatedFrom
56
+ : 0;
57
+ const duration = parentSequence
58
+ ? Math.min(parentSequence.durationInFrames, durationInFrames)
59
+ : durationInFrames;
60
+ const actualSrc = (0, video_fragment_js_1.useAppendVideoFragment)({
61
+ actualSrc: (0, prefetch_js_1.usePreload)(src),
62
+ actualFrom,
63
+ duration,
64
+ fps,
65
+ });
66
+ (0, react_1.useImperativeHandle)(ref, () => {
67
+ return videoRef.current;
68
+ }, []);
69
+ (0, react_1.useEffect)(() => {
70
+ const { current } = videoRef;
71
+ if (!current) {
72
+ return;
73
+ }
74
+ const errorHandler = () => {
75
+ var _a;
76
+ if (current === null || current === void 0 ? void 0 : current.error) {
77
+ console.error('Error occurred in video', current === null || current === void 0 ? void 0 : current.error);
78
+ // If user is handling the error, we don't cause an unhandled exception
79
+ if (props.onError) {
80
+ return;
81
+ }
82
+ throw new Error(`The browser threw an error while playing the video ${src}: Code ${current.error.code} - ${(_a = current === null || current === void 0 ? void 0 : current.error) === null || _a === void 0 ? void 0 : _a.message}. See https://remotion.dev/docs/media-playback-error for help. Pass an onError() prop to handle the error.`);
83
+ }
84
+ else {
85
+ throw new Error('The browser threw an error');
86
+ }
87
+ };
88
+ current.addEventListener('error', errorHandler, { once: true });
89
+ return () => {
90
+ current.removeEventListener('error', errorHandler);
91
+ };
92
+ }, [props.onError, src]);
93
+ const currentOnDurationCallback = (0, react_1.useRef)();
94
+ currentOnDurationCallback.current = onDuration;
95
+ (0, react_1.useEffect)(() => {
96
+ var _a;
97
+ const { current } = videoRef;
98
+ if (!current) {
99
+ return;
100
+ }
101
+ if (current.duration) {
102
+ (_a = currentOnDurationCallback.current) === null || _a === void 0 ? void 0 : _a.call(currentOnDurationCallback, src, current.duration);
103
+ return;
104
+ }
105
+ const onLoadedMetadata = () => {
106
+ var _a;
107
+ (_a = currentOnDurationCallback.current) === null || _a === void 0 ? void 0 : _a.call(currentOnDurationCallback, src, current.duration);
108
+ };
109
+ current.addEventListener('loadedmetadata', onLoadedMetadata);
110
+ return () => {
111
+ current.removeEventListener('loadedmetadata', onLoadedMetadata);
112
+ };
113
+ }, [src]);
114
+ return ((0, jsx_runtime_1.jsx)("video", { ref: videoRef, muted: muted || mediaMuted, playsInline: true, src: actualSrc, ...nativeProps }));
115
+ };
116
+ // Copy types from forwardRef but not necessary to remove ref
117
+ exports.VideoForDevelopment = (0, react_1.forwardRef)(VideoForDevelopmentRefForwardingFunction);
@@ -0,0 +1,10 @@
1
+ import type { ForwardRefExoticComponent, RefAttributes } from 'react';
2
+ import React from 'react';
3
+ export declare const VideoForRendering: ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>, "nonce" | "onEnded" | "autoPlay" | "controls"> & {
4
+ volume?: import("../volume-prop.js").VolumeProp | undefined;
5
+ playbackRate?: number | undefined;
6
+ acceptableTimeShiftInSeconds?: number | undefined;
7
+ allowAmplificationDuringRender?: boolean | undefined;
8
+ } & {
9
+ onDuration: (src: string, durationInSeconds: number) => void;
10
+ } & RefAttributes<HTMLVideoElement>>;