remotion 4.0.0-lambda.3 → 4.0.0-newpaths.13

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 (499) hide show
  1. package/LICENSE.md +8 -8
  2. package/README.md +30 -19
  3. package/dist/AbsoluteFill.d.ts +6 -2
  4. package/dist/AbsoluteFill.js +7 -3
  5. package/dist/CanUseRemotionHooks.d.ts +5 -0
  6. package/dist/CanUseRemotionHooks.js +10 -0
  7. package/dist/Clipper.d.ts +7 -0
  8. package/dist/Clipper.js +24 -0
  9. package/dist/Composition.d.ts +3 -5
  10. package/dist/Composition.js +36 -38
  11. package/dist/CompositionManager.d.ts +9 -11
  12. package/dist/CompositionManager.js +9 -3
  13. package/dist/Folder.d.ts +15 -0
  14. package/dist/Folder.js +33 -0
  15. package/dist/IFrame.d.ts +0 -0
  16. package/dist/IFrame.js +0 -0
  17. package/dist/Img.d.ts +0 -0
  18. package/dist/Img.js +31 -21
  19. package/dist/LayerMaster.d.ts +8 -0
  20. package/dist/LayerMaster.js +39 -0
  21. package/dist/NativeLayers.d.ts +13 -0
  22. package/dist/NativeLayers.js +29 -0
  23. package/dist/Null.d.ts +2 -0
  24. package/dist/Null.js +25 -0
  25. package/dist/RemotionRoot.d.ts +1 -0
  26. package/dist/RemotionRoot.js +9 -6
  27. package/dist/{sequencing/index.d.ts → Sequence.d.ts} +13 -4
  28. package/dist/{sequencing/index.js → Sequence.js} +42 -34
  29. package/dist/Still.d.ts +1 -1
  30. package/dist/Still.js +0 -0
  31. package/dist/absolute-src.d.ts +0 -0
  32. package/dist/absolute-src.js +0 -0
  33. package/dist/asset-types.d.ts +1 -4
  34. package/dist/asset-types.js +0 -0
  35. package/dist/audio/Audio.d.ts +5 -3
  36. package/dist/audio/Audio.js +26 -6
  37. package/dist/audio/AudioForDevelopment.d.ts +6 -2
  38. package/dist/audio/AudioForDevelopment.js +42 -6
  39. package/dist/audio/AudioForRendering.d.ts +9 -2
  40. package/dist/audio/AudioForRendering.js +52 -9
  41. package/dist/audio/index.d.ts +0 -0
  42. package/dist/audio/index.js +0 -0
  43. package/dist/audio/props.d.ts +4 -2
  44. package/dist/audio/props.js +0 -0
  45. package/dist/audio/shared-audio-tags.d.ts +9 -4
  46. package/dist/audio/shared-audio-tags.js +117 -45
  47. package/dist/audio/use-audio-frame.d.ts +0 -0
  48. package/dist/audio/use-audio-frame.js +4 -4
  49. package/dist/bezier.d.ts +0 -0
  50. package/dist/bezier.js +0 -0
  51. package/dist/config/input-props.d.ts +0 -0
  52. package/dist/config/input-props.js +12 -14
  53. package/dist/config.d.ts +285 -0
  54. package/dist/config.js +21 -0
  55. package/dist/default-css.d.ts +1 -0
  56. package/dist/default-css.js +9 -2
  57. package/dist/delay-render.d.ts +0 -0
  58. package/dist/delay-render.js +4 -4
  59. package/dist/easing.d.ts +0 -0
  60. package/dist/easing.js +0 -0
  61. package/dist/freeze.d.ts +2 -2
  62. package/dist/freeze.js +2 -2
  63. package/dist/get-asset-file-name.d.ts +0 -0
  64. package/dist/get-asset-file-name.js +0 -0
  65. package/dist/get-compositions-from-markup.d.ts +3 -0
  66. package/dist/get-compositions-from-markup.js +19 -0
  67. package/dist/get-environment.d.ts +1 -0
  68. package/dist/get-environment.js +14 -2
  69. package/dist/get-preview-dom-element.d.ts +0 -0
  70. package/dist/get-preview-dom-element.js +0 -0
  71. package/dist/get-static-files.d.ts +17 -0
  72. package/dist/get-static-files.js +31 -0
  73. package/dist/get-timeline-clip-name.d.ts +0 -0
  74. package/dist/get-timeline-clip-name.js +2 -1
  75. package/dist/index.d.ts +38 -9
  76. package/dist/index.js +25 -9
  77. package/dist/internals.d.ts +50 -102
  78. package/dist/internals.js +18 -93
  79. package/dist/{interpolateColors.d.ts → interpolate-colors.d.ts} +0 -0
  80. package/dist/{interpolateColors.js → interpolate-colors.js} +0 -0
  81. package/dist/interpolate.d.ts +0 -0
  82. package/dist/interpolate.js +0 -0
  83. package/dist/is-approximately-the-same.d.ts +0 -0
  84. package/dist/is-approximately-the-same.js +0 -0
  85. package/dist/is-player.d.ts +3 -0
  86. package/dist/is-player.js +14 -0
  87. package/dist/layers.d.ts +24 -0
  88. package/dist/layers.js +149 -0
  89. package/dist/loading-indicator.d.ts +0 -0
  90. package/dist/loading-indicator.js +0 -0
  91. package/dist/loop/index.d.ts +2 -2
  92. package/dist/loop/index.js +7 -5
  93. package/dist/multiple-versions-warning.d.ts +0 -0
  94. package/dist/multiple-versions-warning.js +23 -4
  95. package/dist/nonce.d.ts +0 -0
  96. package/dist/nonce.js +0 -0
  97. package/dist/play-and-handle-not-allowed-error.d.ts +1 -1
  98. package/dist/play-and-handle-not-allowed-error.js +4 -0
  99. package/dist/portal-node.d.ts +0 -0
  100. package/dist/portal-node.js +0 -0
  101. package/dist/prefetch-state.d.ts +8 -0
  102. package/dist/prefetch-state.js +27 -0
  103. package/dist/prefetch.d.ts +9 -0
  104. package/dist/prefetch.js +108 -0
  105. package/dist/random.d.ts +2 -1
  106. package/dist/random.js +0 -0
  107. package/dist/register-root.d.ts +1 -1
  108. package/dist/register-root.js +3 -0
  109. package/dist/series/flatten-children.d.ts +1 -1
  110. package/dist/series/flatten-children.js +0 -0
  111. package/dist/series/index.d.ts +4 -4
  112. package/dist/series/index.js +5 -3
  113. package/dist/setup-env-variables.d.ts +0 -0
  114. package/dist/setup-env-variables.js +0 -0
  115. package/dist/spring/index.d.ts +8 -4
  116. package/dist/spring/index.js +21 -6
  117. package/dist/spring/measure-spring.d.ts +1 -1
  118. package/dist/spring/measure-spring.js +1 -1
  119. package/dist/spring/spring-utils.d.ts +0 -0
  120. package/dist/spring/spring-utils.js +0 -0
  121. package/dist/static-file.d.ts +4 -0
  122. package/dist/static-file.js +10 -0
  123. package/dist/timeline-position-state.d.ts +1 -1
  124. package/dist/timeline-position-state.js +0 -0
  125. package/dist/truthy.d.ts +0 -0
  126. package/dist/truthy.js +0 -0
  127. package/dist/{use-frame.d.ts → use-current-frame.d.ts} +0 -1
  128. package/dist/use-current-frame.js +28 -0
  129. package/dist/use-lazy-component.d.ts +3 -3
  130. package/dist/use-lazy-component.js +0 -0
  131. package/dist/use-media-in-timeline.d.ts +4 -3
  132. package/dist/use-media-in-timeline.js +15 -8
  133. package/dist/use-media-playback.d.ts +5 -2
  134. package/dist/use-media-playback.js +13 -8
  135. package/dist/use-media-tag-volume.d.ts +1 -1
  136. package/dist/use-media-tag-volume.js +0 -0
  137. package/dist/use-sync-volume-with-media-tag.d.ts +2 -2
  138. package/dist/use-sync-volume-with-media-tag.js +1 -0
  139. package/dist/use-unsafe-video-config.d.ts +1 -1
  140. package/dist/use-unsafe-video-config.js +2 -2
  141. package/dist/use-video-config.d.ts +1 -1
  142. package/dist/use-video-config.js +10 -1
  143. package/dist/use-video.d.ts +13 -1
  144. package/dist/use-video.js +16 -3
  145. package/dist/validate-media-props.d.ts +3 -3
  146. package/dist/validate-media-props.js +0 -0
  147. package/dist/validate-start-from-props.d.ts +0 -0
  148. package/dist/validate-start-from-props.js +0 -0
  149. package/dist/validation/validate-composition-id.d.ts +0 -0
  150. package/dist/validation/validate-composition-id.js +0 -0
  151. package/dist/validation/validate-dimensions.d.ts +0 -0
  152. package/dist/validation/validate-dimensions.js +0 -0
  153. package/dist/validation/validate-duration-in-frames.d.ts +0 -0
  154. package/dist/validation/validate-duration-in-frames.js +0 -0
  155. package/dist/validation/validate-folder-name.d.ts +0 -0
  156. package/dist/validation/validate-folder-name.js +0 -0
  157. package/dist/validation/validate-fps.d.ts +1 -1
  158. package/dist/validation/validate-fps.js +4 -1
  159. package/dist/validation/validate-offthreadvideo-image-format.d.ts +1 -0
  160. package/dist/validation/validate-offthreadvideo-image-format.js +15 -0
  161. package/dist/validation/validation-spring-duration.d.ts +1 -0
  162. package/dist/validation/validation-spring-duration.js +21 -0
  163. package/dist/version.d.ts +1 -0
  164. package/dist/version.js +5 -0
  165. package/dist/video/NativeVideo.d.ts +5 -0
  166. package/dist/video/NativeVideo.js +33 -0
  167. package/dist/video/NativeVideoForRendering.d.ts +8 -0
  168. package/dist/video/NativeVideoForRendering.js +14 -0
  169. package/dist/video/OffthreadVideo.d.ts +2 -2
  170. package/dist/video/OffthreadVideo.js +12 -4
  171. package/dist/video/OffthreadVideoForRendering.d.ts +1 -1
  172. package/dist/video/OffthreadVideoForRendering.js +28 -17
  173. package/dist/video/Video.d.ts +5 -3
  174. package/dist/video/Video.js +27 -6
  175. package/dist/video/VideoForDevelopment.d.ts +10 -2
  176. package/dist/video/VideoForDevelopment.js +75 -7
  177. package/dist/video/VideoForRendering.d.ts +9 -2
  178. package/dist/video/VideoForRendering.js +84 -27
  179. package/dist/video/duration-state.d.ts +17 -0
  180. package/dist/video/duration-state.js +34 -0
  181. package/dist/video/get-current-time.d.ts +2 -1
  182. package/dist/video/get-current-time.js +7 -7
  183. package/dist/video/index.d.ts +1 -1
  184. package/dist/video/index.js +0 -0
  185. package/dist/video/props.d.ts +9 -3
  186. package/dist/video/props.js +0 -0
  187. package/dist/video/video-fragment.d.ts +12 -0
  188. package/dist/video/video-fragment.js +60 -0
  189. package/dist/video-config.d.ts +0 -0
  190. package/dist/video-config.js +0 -0
  191. package/dist/volume-position-state.d.ts +0 -0
  192. package/dist/volume-position-state.js +0 -0
  193. package/dist/volume-prop.d.ts +2 -1
  194. package/dist/volume-prop.js +4 -3
  195. package/dist/warn-about-non-seekable-media.d.ts +1 -1
  196. package/dist/warn-about-non-seekable-media.js +14 -2
  197. package/dist/wrap-remotion-context.d.ts +6 -1
  198. package/dist/wrap-remotion-context.js +15 -3
  199. package/package.json +26 -16
  200. package/.turbo/turbo-build.log +0 -5
  201. package/dist/AbsoluteFill.d.ts.map +0 -1
  202. package/dist/AbsoluteFill.js.map +0 -1
  203. package/dist/Composition.d.ts.map +0 -1
  204. package/dist/Composition.js.map +0 -1
  205. package/dist/CompositionManager.d.ts.map +0 -1
  206. package/dist/CompositionManager.js.map +0 -1
  207. package/dist/IFrame.d.ts.map +0 -1
  208. package/dist/IFrame.js.map +0 -1
  209. package/dist/Img.d.ts.map +0 -1
  210. package/dist/Img.js.map +0 -1
  211. package/dist/RemotionRoot.d.ts.map +0 -1
  212. package/dist/RemotionRoot.js.map +0 -1
  213. package/dist/Still.d.ts.map +0 -1
  214. package/dist/Still.js.map +0 -1
  215. package/dist/absolute-src.d.ts.map +0 -1
  216. package/dist/absolute-src.js.map +0 -1
  217. package/dist/asset-types.d.ts.map +0 -1
  218. package/dist/asset-types.js.map +0 -1
  219. package/dist/audio/Audio.d.ts.map +0 -1
  220. package/dist/audio/Audio.js.map +0 -1
  221. package/dist/audio/AudioForDevelopment.d.ts.map +0 -1
  222. package/dist/audio/AudioForDevelopment.js.map +0 -1
  223. package/dist/audio/AudioForRendering.d.ts.map +0 -1
  224. package/dist/audio/AudioForRendering.js.map +0 -1
  225. package/dist/audio/index.d.ts.map +0 -1
  226. package/dist/audio/index.js.map +0 -1
  227. package/dist/audio/props.d.ts.map +0 -1
  228. package/dist/audio/props.js.map +0 -1
  229. package/dist/audio/shared-audio-tags.d.ts.map +0 -1
  230. package/dist/audio/shared-audio-tags.js.map +0 -1
  231. package/dist/audio/use-audio-frame.d.ts.map +0 -1
  232. package/dist/audio/use-audio-frame.js.map +0 -1
  233. package/dist/bezier.d.ts.map +0 -1
  234. package/dist/bezier.js.map +0 -1
  235. package/dist/compress-assets.d.ts +0 -7
  236. package/dist/compress-assets.d.ts.map +0 -1
  237. package/dist/compress-assets.js +0 -25
  238. package/dist/compress-assets.js.map +0 -1
  239. package/dist/config/browser-executable.d.ts +0 -3
  240. package/dist/config/browser-executable.d.ts.map +0 -1
  241. package/dist/config/browser-executable.js +0 -12
  242. package/dist/config/browser-executable.js.map +0 -1
  243. package/dist/config/browser.d.ts +0 -4
  244. package/dist/config/browser.d.ts.map +0 -1
  245. package/dist/config/browser.js +0 -19
  246. package/dist/config/browser.js.map +0 -1
  247. package/dist/config/bundle-out-dir.d.ts +0 -2
  248. package/dist/config/bundle-out-dir.js +0 -12
  249. package/dist/config/chromium-flags.d.ts +0 -10
  250. package/dist/config/chromium-flags.d.ts.map +0 -1
  251. package/dist/config/chromium-flags.js +0 -34
  252. package/dist/config/chromium-flags.js.map +0 -1
  253. package/dist/config/codec.d.ts +0 -17
  254. package/dist/config/codec.d.ts.map +0 -1
  255. package/dist/config/codec.js +0 -103
  256. package/dist/config/codec.js.map +0 -1
  257. package/dist/config/concurrency.d.ts +0 -3
  258. package/dist/config/concurrency.d.ts.map +0 -1
  259. package/dist/config/concurrency.js +0 -15
  260. package/dist/config/concurrency.js.map +0 -1
  261. package/dist/config/crf.d.ts +0 -9
  262. package/dist/config/crf.d.ts.map +0 -1
  263. package/dist/config/crf.js +0 -83
  264. package/dist/config/crf.js.map +0 -1
  265. package/dist/config/env-file.d.ts +0 -2
  266. package/dist/config/env-file.d.ts.map +0 -1
  267. package/dist/config/env-file.js +0 -10
  268. package/dist/config/env-file.js.map +0 -1
  269. package/dist/config/every-nth-file.d.ts +0 -2
  270. package/dist/config/every-nth-file.js +0 -12
  271. package/dist/config/ffmpeg-executable.d.ts +0 -5
  272. package/dist/config/ffmpeg-executable.d.ts.map +0 -1
  273. package/dist/config/ffmpeg-executable.js +0 -21
  274. package/dist/config/ffmpeg-executable.js.map +0 -1
  275. package/dist/config/frame-range.d.ts +0 -5
  276. package/dist/config/frame-range.d.ts.map +0 -1
  277. package/dist/config/frame-range.js +0 -80
  278. package/dist/config/frame-range.js.map +0 -1
  279. package/dist/config/image-format.d.ts +0 -8
  280. package/dist/config/image-format.d.ts.map +0 -1
  281. package/dist/config/image-format.js +0 -37
  282. package/dist/config/image-format.js.map +0 -1
  283. package/dist/config/image-sequence.d.ts +0 -3
  284. package/dist/config/image-sequence.d.ts.map +0 -1
  285. package/dist/config/image-sequence.js +0 -15
  286. package/dist/config/image-sequence.js.map +0 -1
  287. package/dist/config/index.d.ts +0 -167
  288. package/dist/config/index.d.ts.map +0 -1
  289. package/dist/config/index.js +0 -180
  290. package/dist/config/index.js.map +0 -1
  291. package/dist/config/input-props.d.ts.map +0 -1
  292. package/dist/config/input-props.js.map +0 -1
  293. package/dist/config/log.d.ts +0 -7
  294. package/dist/config/log.d.ts.map +0 -1
  295. package/dist/config/log.js +0 -25
  296. package/dist/config/log.js.map +0 -1
  297. package/dist/config/loop.d.ts +0 -3
  298. package/dist/config/loop.js +0 -15
  299. package/dist/config/max-timeline-tracks.d.ts +0 -2
  300. package/dist/config/max-timeline-tracks.d.ts.map +0 -1
  301. package/dist/config/max-timeline-tracks.js +0 -24
  302. package/dist/config/max-timeline-tracks.js.map +0 -1
  303. package/dist/config/override-webpack.d.ts +0 -6
  304. package/dist/config/override-webpack.d.ts.map +0 -1
  305. package/dist/config/override-webpack.js +0 -14
  306. package/dist/config/override-webpack.js.map +0 -1
  307. package/dist/config/overwrite.d.ts +0 -3
  308. package/dist/config/overwrite.d.ts.map +0 -1
  309. package/dist/config/overwrite.js +0 -14
  310. package/dist/config/overwrite.js.map +0 -1
  311. package/dist/config/pixel-format.d.ts +0 -8
  312. package/dist/config/pixel-format.d.ts.map +0 -1
  313. package/dist/config/pixel-format.js +0 -38
  314. package/dist/config/pixel-format.js.map +0 -1
  315. package/dist/config/preview-server.d.ts +0 -2
  316. package/dist/config/preview-server.d.ts.map +0 -1
  317. package/dist/config/preview-server.js +0 -20
  318. package/dist/config/preview-server.js.map +0 -1
  319. package/dist/config/prores-profile.d.ts +0 -7
  320. package/dist/config/prores-profile.d.ts.map +0 -1
  321. package/dist/config/prores-profile.js +0 -32
  322. package/dist/config/prores-profile.js.map +0 -1
  323. package/dist/config/public-path.d.ts +0 -2
  324. package/dist/config/public-path.js +0 -12
  325. package/dist/config/quality.d.ts +0 -2
  326. package/dist/config/quality.d.ts.map +0 -1
  327. package/dist/config/quality.js +0 -17
  328. package/dist/config/quality.js.map +0 -1
  329. package/dist/config/scale.d.ts +0 -3
  330. package/dist/config/scale.d.ts.map +0 -1
  331. package/dist/config/scale.js +0 -15
  332. package/dist/config/scale.js.map +0 -1
  333. package/dist/config/still-frame.d.ts +0 -2
  334. package/dist/config/still-frame.d.ts.map +0 -1
  335. package/dist/config/still-frame.js +0 -12
  336. package/dist/config/still-frame.js.map +0 -1
  337. package/dist/config/timeout.d.ts +0 -2
  338. package/dist/config/timeout.d.ts.map +0 -1
  339. package/dist/config/timeout.js +0 -17
  340. package/dist/config/timeout.js.map +0 -1
  341. package/dist/config/webpack-caching.d.ts +0 -3
  342. package/dist/config/webpack-caching.d.ts.map +0 -1
  343. package/dist/config/webpack-caching.js +0 -16
  344. package/dist/config/webpack-caching.js.map +0 -1
  345. package/dist/default-css.d.ts.map +0 -1
  346. package/dist/default-css.js.map +0 -1
  347. package/dist/delay-render.d.ts.map +0 -1
  348. package/dist/delay-render.js.map +0 -1
  349. package/dist/easing.d.ts.map +0 -1
  350. package/dist/easing.js.map +0 -1
  351. package/dist/feature-flags.d.ts +0 -1
  352. package/dist/feature-flags.d.ts.map +0 -1
  353. package/dist/feature-flags.js +0 -7
  354. package/dist/feature-flags.js.map +0 -1
  355. package/dist/freeze.d.ts.map +0 -1
  356. package/dist/freeze.js.map +0 -1
  357. package/dist/get-asset-file-name.d.ts.map +0 -1
  358. package/dist/get-asset-file-name.js.map +0 -1
  359. package/dist/get-environment.d.ts.map +0 -1
  360. package/dist/get-environment.js.map +0 -1
  361. package/dist/get-preview-dom-element.d.ts.map +0 -1
  362. package/dist/get-preview-dom-element.js.map +0 -1
  363. package/dist/get-timeline-clip-name.d.ts.map +0 -1
  364. package/dist/get-timeline-clip-name.js.map +0 -1
  365. package/dist/index.d.ts.map +0 -1
  366. package/dist/index.js.map +0 -1
  367. package/dist/initial-frame.d.ts +0 -2
  368. package/dist/initial-frame.d.ts.map +0 -1
  369. package/dist/initial-frame.js +0 -12
  370. package/dist/initial-frame.js.map +0 -1
  371. package/dist/internals.d.ts.map +0 -1
  372. package/dist/internals.js.map +0 -1
  373. package/dist/interpolate.d.ts.map +0 -1
  374. package/dist/interpolate.js.map +0 -1
  375. package/dist/interpolateColors.d.ts.map +0 -1
  376. package/dist/interpolateColors.js.map +0 -1
  377. package/dist/is-approximately-the-same.d.ts.map +0 -1
  378. package/dist/is-approximately-the-same.js.map +0 -1
  379. package/dist/is-audio-codec.d.ts +0 -2
  380. package/dist/is-audio-codec.d.ts.map +0 -1
  381. package/dist/is-audio-codec.js +0 -7
  382. package/dist/is-audio-codec.js.map +0 -1
  383. package/dist/loop/index.d.ts.map +0 -1
  384. package/dist/loop/index.js.map +0 -1
  385. package/dist/multiple-versions-warning.d.ts.map +0 -1
  386. package/dist/multiple-versions-warning.js.map +0 -1
  387. package/dist/nonce.d.ts.map +0 -1
  388. package/dist/nonce.js.map +0 -1
  389. package/dist/perf/index.d.ts +0 -5
  390. package/dist/perf/index.d.ts.map +0 -1
  391. package/dist/perf/index.js +0 -35
  392. package/dist/perf/index.js.map +0 -1
  393. package/dist/play-and-handle-not-allowed-error.d.ts.map +0 -1
  394. package/dist/play-and-handle-not-allowed-error.js.map +0 -1
  395. package/dist/random.d.ts.map +0 -1
  396. package/dist/random.js.map +0 -1
  397. package/dist/register-root.d.ts.map +0 -1
  398. package/dist/register-root.js.map +0 -1
  399. package/dist/sequencing/index.d.ts.map +0 -1
  400. package/dist/sequencing/index.js.map +0 -1
  401. package/dist/series/flatten-children.d.ts.map +0 -1
  402. package/dist/series/flatten-children.js.map +0 -1
  403. package/dist/series/index.d.ts.map +0 -1
  404. package/dist/series/index.js.map +0 -1
  405. package/dist/setup-env-variables.d.ts.map +0 -1
  406. package/dist/setup-env-variables.js.map +0 -1
  407. package/dist/spring/index.d.ts.map +0 -1
  408. package/dist/spring/index.js.map +0 -1
  409. package/dist/spring/measure-spring.d.ts.map +0 -1
  410. package/dist/spring/measure-spring.js.map +0 -1
  411. package/dist/spring/spring-utils.d.ts.map +0 -1
  412. package/dist/spring/spring-utils.js.map +0 -1
  413. package/dist/static-file.d.ts.map +0 -1
  414. package/dist/static-file.js.map +0 -1
  415. package/dist/timeline-inout-position-state.d.ts +0 -12
  416. package/dist/timeline-inout-position-state.d.ts.map +0 -1
  417. package/dist/timeline-inout-position-state.js +0 -23
  418. package/dist/timeline-inout-position-state.js.map +0 -1
  419. package/dist/timeline-position-state.d.ts.map +0 -1
  420. package/dist/timeline-position-state.js.map +0 -1
  421. package/dist/timeout.d.ts +0 -2
  422. package/dist/timeout.d.ts.map +0 -1
  423. package/dist/timeout.js +0 -12
  424. package/dist/timeout.js.map +0 -1
  425. package/dist/truthy.d.ts.map +0 -1
  426. package/dist/truthy.js.map +0 -1
  427. package/dist/use-frame.d.ts.map +0 -1
  428. package/dist/use-frame.js +0 -25
  429. package/dist/use-frame.js.map +0 -1
  430. package/dist/use-lazy-component.d.ts.map +0 -1
  431. package/dist/use-lazy-component.js.map +0 -1
  432. package/dist/use-media-in-timeline.d.ts.map +0 -1
  433. package/dist/use-media-in-timeline.js.map +0 -1
  434. package/dist/use-media-playback.d.ts.map +0 -1
  435. package/dist/use-media-playback.js.map +0 -1
  436. package/dist/use-media-tag-volume.d.ts.map +0 -1
  437. package/dist/use-media-tag-volume.js.map +0 -1
  438. package/dist/use-sync-volume-with-media-tag.d.ts.map +0 -1
  439. package/dist/use-sync-volume-with-media-tag.js.map +0 -1
  440. package/dist/use-unsafe-video-config.d.ts.map +0 -1
  441. package/dist/use-unsafe-video-config.js.map +0 -1
  442. package/dist/use-video-config.d.ts.map +0 -1
  443. package/dist/use-video-config.js.map +0 -1
  444. package/dist/use-video.d.ts.map +0 -1
  445. package/dist/use-video.js.map +0 -1
  446. package/dist/validate-media-props.d.ts.map +0 -1
  447. package/dist/validate-media-props.js.map +0 -1
  448. package/dist/validate-start-from-props.d.ts.map +0 -1
  449. package/dist/validate-start-from-props.js.map +0 -1
  450. package/dist/validation/validate-composition-id.d.ts.map +0 -1
  451. package/dist/validation/validate-composition-id.js.map +0 -1
  452. package/dist/validation/validate-dimensions.d.ts.map +0 -1
  453. package/dist/validation/validate-dimensions.js.map +0 -1
  454. package/dist/validation/validate-duration-in-frames.d.ts.map +0 -1
  455. package/dist/validation/validate-duration-in-frames.js.map +0 -1
  456. package/dist/validation/validate-every-nth-frame.d.ts +0 -1
  457. package/dist/validation/validate-every-nth-frame.js +0 -21
  458. package/dist/validation/validate-folder-name.d.ts.map +0 -1
  459. package/dist/validation/validate-folder-name.js.map +0 -1
  460. package/dist/validation/validate-fps.d.ts.map +0 -1
  461. package/dist/validation/validate-fps.js.map +0 -1
  462. package/dist/validation/validate-frame.d.ts +0 -1
  463. package/dist/validation/validate-frame.d.ts.map +0 -1
  464. package/dist/validation/validate-frame.js +0 -24
  465. package/dist/validation/validate-frame.js.map +0 -1
  466. package/dist/validation/validate-image-format.d.ts +0 -2
  467. package/dist/validation/validate-image-format.d.ts.map +0 -1
  468. package/dist/validation/validate-image-format.js +0 -9
  469. package/dist/validation/validate-image-format.js.map +0 -1
  470. package/dist/validation/validate-opengl-renderer.d.ts +0 -4
  471. package/dist/validation/validate-opengl-renderer.d.ts.map +0 -1
  472. package/dist/validation/validate-opengl-renderer.js +0 -14
  473. package/dist/validation/validate-opengl-renderer.js.map +0 -1
  474. package/dist/validation/validate-quality.d.ts +0 -1
  475. package/dist/validation/validate-quality.d.ts.map +0 -1
  476. package/dist/validation/validate-quality.js +0 -21
  477. package/dist/validation/validate-quality.js.map +0 -1
  478. package/dist/video/Video.d.ts.map +0 -1
  479. package/dist/video/Video.js.map +0 -1
  480. package/dist/video/VideoForDevelopment.d.ts.map +0 -1
  481. package/dist/video/VideoForDevelopment.js.map +0 -1
  482. package/dist/video/VideoForRendering.d.ts.map +0 -1
  483. package/dist/video/VideoForRendering.js.map +0 -1
  484. package/dist/video/get-current-time.d.ts.map +0 -1
  485. package/dist/video/get-current-time.js.map +0 -1
  486. package/dist/video/index.d.ts.map +0 -1
  487. package/dist/video/index.js.map +0 -1
  488. package/dist/video/props.d.ts.map +0 -1
  489. package/dist/video/props.js.map +0 -1
  490. package/dist/video-config.d.ts.map +0 -1
  491. package/dist/video-config.js.map +0 -1
  492. package/dist/volume-position-state.d.ts.map +0 -1
  493. package/dist/volume-position-state.js.map +0 -1
  494. package/dist/volume-prop.d.ts.map +0 -1
  495. package/dist/volume-prop.js.map +0 -1
  496. package/dist/warn-about-non-seekable-media.d.ts.map +0 -1
  497. package/dist/warn-about-non-seekable-media.js.map +0 -1
  498. package/dist/wrap-remotion-context.d.ts.map +0 -1
  499. package/dist/wrap-remotion-context.js.map +0 -1
@@ -6,19 +6,23 @@ const react_1 = require("react");
6
6
  const absolute_src_1 = require("../absolute-src");
7
7
  const use_audio_frame_1 = require("../audio/use-audio-frame");
8
8
  const CompositionManager_1 = require("../CompositionManager");
9
+ const default_css_1 = require("../default-css");
9
10
  const Img_1 = require("../Img");
11
+ const internals_1 = require("../internals");
10
12
  const random_1 = require("../random");
11
- const sequencing_1 = require("../sequencing");
12
- const use_frame_1 = require("../use-frame");
13
+ const Sequence_1 = require("../Sequence");
14
+ const timeline_position_state_1 = require("../timeline-position-state");
15
+ const use_current_frame_1 = require("../use-current-frame");
13
16
  const use_unsafe_video_config_1 = require("../use-unsafe-video-config");
14
17
  const volume_prop_1 = require("../volume-prop");
15
18
  const get_current_time_1 = require("./get-current-time");
16
- const OffthreadVideoForRendering = ({ onError, volume: volumeProp, playbackRate, src, muted, style, ...props }) => {
17
- const absoluteFrame = (0, use_frame_1.useAbsoluteCurrentFrame)();
18
- const frame = (0, use_frame_1.useCurrentFrame)();
19
+ const DEFAULT_IMAGE_FORMAT = 'jpeg';
20
+ const OffthreadVideoForRendering = ({ onError, volume: volumeProp, playbackRate, src, muted, imageFormat, allowAmplificationDuringRender, ...props }) => {
21
+ const absoluteFrame = (0, timeline_position_state_1.useTimelinePosition)();
22
+ const frame = (0, use_current_frame_1.useCurrentFrame)();
19
23
  const volumePropsFrame = (0, use_audio_frame_1.useFrameForVolumeProp)();
20
24
  const videoConfig = (0, use_unsafe_video_config_1.useUnsafeVideoConfig)();
21
- const sequenceContext = (0, react_1.useContext)(sequencing_1.SequenceContext);
25
+ const sequenceContext = (0, react_1.useContext)(Sequence_1.SequenceContext);
22
26
  const mediaStartsAt = (0, use_audio_frame_1.useMediaStartsAt)();
23
27
  const { registerAsset, unregisterAsset } = (0, react_1.useContext)(CompositionManager_1.CompositionManager);
24
28
  if (!src) {
@@ -26,9 +30,8 @@ const OffthreadVideoForRendering = ({ onError, volume: volumeProp, playbackRate,
26
30
  }
27
31
  // Generate a string that's as unique as possible for this asset
28
32
  // but at the same time the same on all threads
29
- const id = (0, react_1.useMemo)(() => `video-${(0, random_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}-muted:${muted}`, [
33
+ const id = (0, react_1.useMemo)(() => `offthreadvideo-${(0, random_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}`, [
30
34
  src,
31
- muted,
32
35
  sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.cumulatedFrom,
33
36
  sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.relativeFrom,
34
37
  sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.durationInFrames,
@@ -40,14 +43,21 @@ const OffthreadVideoForRendering = ({ onError, volume: volumeProp, playbackRate,
40
43
  volume: volumeProp,
41
44
  frame: volumePropsFrame,
42
45
  mediaVolume: 1,
46
+ allowAmplificationDuringRender: allowAmplificationDuringRender !== null && allowAmplificationDuringRender !== void 0 ? allowAmplificationDuringRender : false,
43
47
  });
44
48
  (0, react_1.useEffect)(() => {
45
49
  if (!src) {
46
50
  throw new Error('No src passed');
47
51
  }
52
+ if (!window.remotion_videoEnabled) {
53
+ return;
54
+ }
48
55
  if (muted) {
49
56
  return;
50
57
  }
58
+ if (volume <= 0) {
59
+ return;
60
+ }
51
61
  registerAsset({
52
62
  type: 'video',
53
63
  src: (0, absolute_src_1.getAbsoluteSrc)(src),
@@ -56,6 +66,7 @@ const OffthreadVideoForRendering = ({ onError, volume: volumeProp, playbackRate,
56
66
  volume,
57
67
  mediaFrame: frame,
58
68
  playbackRate: playbackRate !== null && playbackRate !== void 0 ? playbackRate : 1,
69
+ allowAmplificationDuringRender: allowAmplificationDuringRender !== null && allowAmplificationDuringRender !== void 0 ? allowAmplificationDuringRender : false,
59
70
  });
60
71
  return () => unregisterAsset(id);
61
72
  }, [
@@ -68,6 +79,7 @@ const OffthreadVideoForRendering = ({ onError, volume: volumeProp, playbackRate,
68
79
  frame,
69
80
  absoluteFrame,
70
81
  playbackRate,
82
+ allowAmplificationDuringRender,
71
83
  ]);
72
84
  const currentTime = (0, react_1.useMemo)(() => {
73
85
  return ((0, get_current_time_1.getExpectedMediaFrameUncorrected)({
@@ -77,17 +89,16 @@ const OffthreadVideoForRendering = ({ onError, volume: volumeProp, playbackRate,
77
89
  }) / videoConfig.fps);
78
90
  }, [frame, mediaStartsAt, playbackRate, videoConfig.fps]);
79
91
  const actualSrc = (0, react_1.useMemo)(() => {
80
- return `http://localhost:${window.remotion_proxyPort}/proxy?src=${encodeURIComponent((0, absolute_src_1.getAbsoluteSrc)(src))}&time=${encodeURIComponent(currentTime)}`;
81
- }, [currentTime, src]);
92
+ return `http://localhost:${window.remotion_proxyPort}/proxy?src=${encodeURIComponent((0, absolute_src_1.getAbsoluteSrc)(src))}&time=${encodeURIComponent(currentTime)}&imageFormat=${imageFormat !== null && imageFormat !== void 0 ? imageFormat : DEFAULT_IMAGE_FORMAT}`;
93
+ }, [currentTime, imageFormat, src]);
82
94
  const onErr = (0, react_1.useCallback)((e) => {
83
95
  onError === null || onError === void 0 ? void 0 : onError(e);
84
96
  }, [onError]);
85
- const actualStyle = (0, react_1.useMemo)(() => {
86
- return {
87
- objectFit: 'contain',
88
- ...(style !== null && style !== void 0 ? style : {}),
89
- };
90
- }, [style]);
91
- return (0, jsx_runtime_1.jsx)(Img_1.Img, { src: actualSrc, style: actualStyle, ...props, onError: onErr });
97
+ const className = (0, react_1.useMemo)(() => {
98
+ return [default_css_1.OFFTHREAD_VIDEO_CLASS_NAME, props.className]
99
+ .filter(internals_1.Internals.truthy)
100
+ .join(' ');
101
+ }, [props.className]);
102
+ return ((0, jsx_runtime_1.jsx)(Img_1.Img, { src: actualSrc, className: className, ...props, onError: onErr }));
92
103
  };
93
104
  exports.OffthreadVideoForRendering = OffthreadVideoForRendering;
@@ -1,6 +1,8 @@
1
1
  import React from 'react';
2
- import { RemotionMainVideoProps } from './props';
3
- export declare const Video: React.ForwardRefExoticComponent<Pick<Omit<React.DetailedHTMLProps<React.VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>, "onEnded" | "autoPlay" | "controls" | "loop"> & {
2
+ import type { RemotionMainVideoProps } from './props';
3
+ export declare const Video: (props: Omit<React.DetailedHTMLProps<React.VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>, "nonce" | "onEnded" | "autoPlay" | "controls"> & {
4
4
  volume?: import("../volume-prop").VolumeProp | undefined;
5
5
  playbackRate?: number | undefined;
6
- } & RemotionMainVideoProps, "style" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "height" | "width" | "src" | "volume" | "playbackRate" | "controlsList" | "crossOrigin" | "mediaGroup" | "muted" | "playsInline" | "preload" | "key" | "poster" | "disablePictureInPicture" | "disableRemotePlayback" | keyof RemotionMainVideoProps> & React.RefAttributes<HTMLVideoElement>>;
6
+ acceptableTimeShiftInSeconds?: number | undefined;
7
+ allowAmplificationDuringRender?: boolean | undefined;
8
+ } & RemotionMainVideoProps & React.RefAttributes<HTMLVideoElement | null>) => React.ReactElement | null;
@@ -4,26 +4,47 @@ exports.Video = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const get_environment_1 = require("../get-environment");
7
- const sequencing_1 = require("../sequencing");
7
+ const loop_1 = require("../loop");
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("./duration-state");
10
13
  const VideoForDevelopment_1 = require("./VideoForDevelopment");
11
14
  const VideoForRendering_1 = require("./VideoForRendering");
12
15
  const VideoForwardingFunction = (props, ref) => {
16
+ var _a;
13
17
  const { startFrom, endAt, ...otherProps } = props;
18
+ const { loop, ...propsOtherThanLoop } = props;
19
+ const { fps } = (0, use_video_config_1.useVideoConfig)();
20
+ const environment = (0, get_environment_1.useRemotionEnvironment)();
21
+ const { durations, setDurations } = (0, react_1.useContext)(duration_state_1.DurationsContext);
14
22
  if (typeof ref === 'string') {
15
23
  throw new Error('string refs are not supported');
16
24
  }
25
+ if (typeof props.src !== 'string') {
26
+ throw new TypeError(`The \`<Video>\` tag requires a string for \`src\`, but got ${JSON.stringify(props.src)} instead.`);
27
+ }
28
+ const onDuration = (0, react_1.useCallback)((src, durationInSeconds) => {
29
+ setDurations({ type: 'got-duration', durationInSeconds, src });
30
+ }, [setDurations]);
31
+ if (loop && props.src && durations[props.src] !== undefined) {
32
+ const naturalDuration = durations[props.src] * fps;
33
+ const playbackRate = (_a = props.playbackRate) !== null && _a !== void 0 ? _a : 1;
34
+ const durationInFrames = Math.floor(naturalDuration / playbackRate);
35
+ return ((0, jsx_runtime_1.jsx)(loop_1.Loop, { durationInFrames: durationInFrames, children: (0, jsx_runtime_1.jsx)(exports.Video, { ...propsOtherThanLoop, ref: ref }) }));
36
+ }
17
37
  if (typeof startFrom !== 'undefined' || typeof endAt !== 'undefined') {
18
38
  (0, validate_start_from_props_1.validateStartFromProps)(startFrom, endAt);
19
39
  const startFromFrameNo = startFrom !== null && startFrom !== void 0 ? startFrom : 0;
20
40
  const endAtFrameNo = endAt !== null && endAt !== void 0 ? endAt : Infinity;
21
- return ((0, jsx_runtime_1.jsx)(sequencing_1.Sequence, { layout: "none", from: 0 - startFromFrameNo, showInTimeline: false, durationInFrames: endAtFrameNo, children: (0, jsx_runtime_1.jsx)(exports.Video, { ...otherProps, ref: ref }) }));
41
+ return ((0, jsx_runtime_1.jsx)(Sequence_1.Sequence, { layout: "none", from: 0 - startFromFrameNo, showInTimeline: false, durationInFrames: endAtFrameNo, children: (0, jsx_runtime_1.jsx)(exports.Video, { ...otherProps, ref: ref }) }));
22
42
  }
23
43
  (0, validate_media_props_1.validateMediaProps)(props, 'Video');
24
- if ((0, get_environment_1.getRemotionEnvironment)() === 'rendering') {
25
- return (0, jsx_runtime_1.jsx)(VideoForRendering_1.VideoForRendering, { ...otherProps, ref: ref });
44
+ if (environment === 'rendering') {
45
+ return ((0, jsx_runtime_1.jsx)(VideoForRendering_1.VideoForRendering, { onDuration: onDuration, ...otherProps, ref: ref }));
26
46
  }
27
- return (0, jsx_runtime_1.jsx)(VideoForDevelopment_1.VideoForDevelopment, { ...otherProps, ref: ref });
47
+ return ((0, jsx_runtime_1.jsx)(VideoForDevelopment_1.VideoForDevelopment, { onlyWarnForMediaSeekingError: false, ...otherProps, ref: ref, onDuration: onDuration }));
28
48
  };
29
- exports.Video = (0, react_1.forwardRef)(VideoForwardingFunction);
49
+ const forward = react_1.forwardRef;
50
+ exports.Video = forward(VideoForwardingFunction);
@@ -1,3 +1,11 @@
1
+ import type { ForwardRefExoticComponent, RefAttributes } from 'react';
1
2
  import React from 'react';
2
- import { RemotionVideoProps } from './props';
3
- export declare const VideoForDevelopment: React.ForwardRefExoticComponent<Pick<RemotionVideoProps, "style" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "height" | "width" | "src" | "volume" | "playbackRate" | "controlsList" | "crossOrigin" | "mediaGroup" | "muted" | "playsInline" | "preload" | "key" | "poster" | "disablePictureInPicture" | "disableRemotePlayback"> & React.RefAttributes<HTMLVideoElement>>;
3
+ export declare const VideoForDevelopment: ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>, "nonce" | "onEnded" | "autoPlay" | "controls"> & {
4
+ volume?: import("../volume-prop").VolumeProp | undefined;
5
+ playbackRate?: number | undefined;
6
+ acceptableTimeShiftInSeconds?: number | undefined;
7
+ allowAmplificationDuringRender?: boolean | undefined;
8
+ } & {
9
+ onlyWarnForMediaSeekingError: boolean;
10
+ onDuration: (src: string, durationInSeconds: number) => void;
11
+ } & RefAttributes<HTMLVideoElement>>;
@@ -4,16 +4,27 @@ exports.VideoForDevelopment = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const use_audio_frame_1 = require("../audio/use-audio-frame");
7
+ const prefetch_1 = require("../prefetch");
8
+ const Sequence_1 = require("../Sequence");
7
9
  const use_media_in_timeline_1 = require("../use-media-in-timeline");
8
10
  const use_media_playback_1 = require("../use-media-playback");
9
11
  const use_media_tag_volume_1 = require("../use-media-tag-volume");
10
12
  const use_sync_volume_with_media_tag_1 = require("../use-sync-volume-with-media-tag");
13
+ const use_video_config_1 = require("../use-video-config");
11
14
  const volume_position_state_1 = require("../volume-position-state");
15
+ const video_fragment_1 = require("./video-fragment");
12
16
  const VideoForDevelopmentRefForwardingFunction = (props, ref) => {
13
- var _a;
17
+ var _a, _b;
14
18
  const videoRef = (0, react_1.useRef)(null);
15
19
  const volumePropFrame = (0, use_audio_frame_1.useFrameForVolumeProp)();
16
- const { volume, muted, playbackRate, ...nativeProps } = props;
20
+ const { fps, durationInFrames } = (0, use_video_config_1.useVideoConfig)();
21
+ const parentSequence = (0, react_1.useContext)(Sequence_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
+ }
17
28
  const actualVolume = (0, use_media_tag_volume_1.useMediaTagVolume)(videoRef);
18
29
  const [mediaVolume] = (0, volume_position_state_1.useMediaVolumeState)();
19
30
  const [mediaMuted] = (0, volume_position_state_1.useMediaMutedState)();
@@ -22,7 +33,8 @@ const VideoForDevelopmentRefForwardingFunction = (props, ref) => {
22
33
  volume,
23
34
  mediaVolume,
24
35
  mediaType: 'video',
25
- src: nativeProps.src,
36
+ src,
37
+ playbackRate: (_a = props.playbackRate) !== null && _a !== void 0 ? _a : 1,
26
38
  });
27
39
  (0, use_sync_volume_with_media_tag_1.useSyncVolumeWithMediaTag)({
28
40
  volumePropFrame,
@@ -33,13 +45,69 @@ const VideoForDevelopmentRefForwardingFunction = (props, ref) => {
33
45
  });
34
46
  (0, use_media_playback_1.useMediaPlayback)({
35
47
  mediaRef: videoRef,
36
- src: nativeProps.src,
48
+ src,
37
49
  mediaType: 'video',
38
- playbackRate: (_a = props.playbackRate) !== null && _a !== void 0 ? _a : 1,
50
+ playbackRate: (_b = props.playbackRate) !== null && _b !== void 0 ? _b : 1,
51
+ onlyWarnForMediaSeekingError,
52
+ acceptableTimeshift: acceptableTimeShiftInSeconds !== null && acceptableTimeShiftInSeconds !== void 0 ? acceptableTimeShiftInSeconds : use_media_playback_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_1.useAppendVideoFragment)({
61
+ actualSrc: (0, prefetch_1.usePreload)(src),
62
+ actualFrom,
63
+ duration,
64
+ fps,
39
65
  });
40
66
  (0, react_1.useImperativeHandle)(ref, () => {
41
67
  return videoRef.current;
42
- });
43
- return ((0, jsx_runtime_1.jsx)("video", { ref: videoRef, muted: muted || mediaMuted, playsInline: true, ...nativeProps }));
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
+ 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`);
79
+ }
80
+ else {
81
+ throw new Error('The browser threw an error');
82
+ }
83
+ };
84
+ current.addEventListener('error', errorHandler, { once: true });
85
+ return () => {
86
+ current.removeEventListener('error', errorHandler);
87
+ };
88
+ }, [src]);
89
+ const currentOnDurationCallback = (0, react_1.useRef)();
90
+ currentOnDurationCallback.current = onDuration;
91
+ (0, react_1.useEffect)(() => {
92
+ var _a;
93
+ const { current } = videoRef;
94
+ if (!current) {
95
+ return;
96
+ }
97
+ if (current.duration) {
98
+ (_a = currentOnDurationCallback.current) === null || _a === void 0 ? void 0 : _a.call(currentOnDurationCallback, src, current.duration);
99
+ return;
100
+ }
101
+ const onLoadedMetadata = () => {
102
+ var _a;
103
+ (_a = currentOnDurationCallback.current) === null || _a === void 0 ? void 0 : _a.call(currentOnDurationCallback, src, current.duration);
104
+ };
105
+ current.addEventListener('loadedmetadata', onLoadedMetadata);
106
+ return () => {
107
+ current.removeEventListener('loadedmetadata', onLoadedMetadata);
108
+ };
109
+ }, [src]);
110
+ return ((0, jsx_runtime_1.jsx)("video", { ref: videoRef, muted: muted || mediaMuted, playsInline: true, src: actualSrc, ...nativeProps }));
44
111
  };
112
+ // Copy types from forwardRef but not necessary to remove ref
45
113
  exports.VideoForDevelopment = (0, react_1.forwardRef)(VideoForDevelopmentRefForwardingFunction);
@@ -1,3 +1,10 @@
1
+ import type { ForwardRefExoticComponent, RefAttributes } from 'react';
1
2
  import React from 'react';
2
- import { RemotionVideoProps } from './props';
3
- export declare const VideoForRendering: React.ForwardRefExoticComponent<Pick<RemotionVideoProps, "style" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "height" | "width" | "src" | "volume" | "playbackRate" | "controlsList" | "crossOrigin" | "mediaGroup" | "muted" | "playsInline" | "preload" | "key" | "poster" | "disablePictureInPicture" | "disableRemotePlayback"> & React.RefAttributes<HTMLVideoElement>>;
3
+ export declare const VideoForRendering: ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>, "nonce" | "onEnded" | "autoPlay" | "controls"> & {
4
+ volume?: import("../volume-prop").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>>;
@@ -7,30 +7,33 @@ const absolute_src_1 = require("../absolute-src");
7
7
  const use_audio_frame_1 = require("../audio/use-audio-frame");
8
8
  const CompositionManager_1 = require("../CompositionManager");
9
9
  const delay_render_1 = require("../delay-render");
10
+ const get_environment_1 = require("../get-environment");
10
11
  const is_approximately_the_same_1 = require("../is-approximately-the-same");
11
12
  const random_1 = require("../random");
12
- const sequencing_1 = require("../sequencing");
13
- const use_frame_1 = require("../use-frame");
13
+ const Sequence_1 = require("../Sequence");
14
+ const timeline_position_state_1 = require("../timeline-position-state");
15
+ const use_current_frame_1 = require("../use-current-frame");
14
16
  const use_unsafe_video_config_1 = require("../use-unsafe-video-config");
15
17
  const volume_prop_1 = require("../volume-prop");
18
+ const warn_about_non_seekable_media_1 = require("../warn-about-non-seekable-media");
16
19
  const get_current_time_1 = require("./get-current-time");
17
- const VideoForRenderingForwardFunction = ({ onError, volume: volumeProp, playbackRate, ...props }, ref) => {
18
- const absoluteFrame = (0, use_frame_1.useAbsoluteCurrentFrame)();
19
- const frame = (0, use_frame_1.useCurrentFrame)();
20
+ const VideoForRenderingForwardFunction = ({ onError, volume: volumeProp, allowAmplificationDuringRender, playbackRate, onDuration, ...props }, ref) => {
21
+ const absoluteFrame = (0, timeline_position_state_1.useTimelinePosition)();
22
+ const frame = (0, use_current_frame_1.useCurrentFrame)();
20
23
  const volumePropsFrame = (0, use_audio_frame_1.useFrameForVolumeProp)();
21
24
  const videoConfig = (0, use_unsafe_video_config_1.useUnsafeVideoConfig)();
22
25
  const videoRef = (0, react_1.useRef)(null);
23
- const sequenceContext = (0, react_1.useContext)(sequencing_1.SequenceContext);
26
+ const sequenceContext = (0, react_1.useContext)(Sequence_1.SequenceContext);
24
27
  const mediaStartsAt = (0, use_audio_frame_1.useMediaStartsAt)();
28
+ const environment = (0, get_environment_1.useRemotionEnvironment)();
25
29
  const { registerAsset, unregisterAsset } = (0, react_1.useContext)(CompositionManager_1.CompositionManager);
26
30
  // Generate a string that's as unique as possible for this asset
27
31
  // but at the same time the same on all threads
28
32
  const id = (0, react_1.useMemo)(() => {
29
33
  var _a;
30
- return `video-${(0, random_1.random)((_a = props.src) !== null && _a !== void 0 ? _a : '')}-${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}-muted:${props.muted}`;
34
+ return `video-${(0, random_1.random)((_a = props.src) !== null && _a !== void 0 ? _a : '')}-${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}`;
31
35
  }, [
32
36
  props.src,
33
- props.muted,
34
37
  sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.cumulatedFrom,
35
38
  sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.relativeFrom,
36
39
  sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.durationInFrames,
@@ -42,6 +45,7 @@ const VideoForRenderingForwardFunction = ({ onError, volume: volumeProp, playbac
42
45
  volume: volumeProp,
43
46
  frame: volumePropsFrame,
44
47
  mediaVolume: 1,
48
+ allowAmplificationDuringRender: allowAmplificationDuringRender !== null && allowAmplificationDuringRender !== void 0 ? allowAmplificationDuringRender : false,
45
49
  });
46
50
  (0, react_1.useEffect)(() => {
47
51
  if (!props.src) {
@@ -50,6 +54,12 @@ const VideoForRenderingForwardFunction = ({ onError, volume: volumeProp, playbac
50
54
  if (props.muted) {
51
55
  return;
52
56
  }
57
+ if (volume <= 0) {
58
+ return;
59
+ }
60
+ if (!window.remotion_audioEnabled) {
61
+ return;
62
+ }
53
63
  registerAsset({
54
64
  type: 'video',
55
65
  src: (0, absolute_src_1.getAbsoluteSrc)(props.src),
@@ -58,6 +68,7 @@ const VideoForRenderingForwardFunction = ({ onError, volume: volumeProp, playbac
58
68
  volume,
59
69
  mediaFrame: frame,
60
70
  playbackRate: playbackRate !== null && playbackRate !== void 0 ? playbackRate : 1,
71
+ allowAmplificationDuringRender: allowAmplificationDuringRender !== null && allowAmplificationDuringRender !== void 0 ? allowAmplificationDuringRender : false,
61
72
  });
62
73
  return () => unregisterAsset(id);
63
74
  }, [
@@ -70,12 +81,17 @@ const VideoForRenderingForwardFunction = ({ onError, volume: volumeProp, playbac
70
81
  frame,
71
82
  absoluteFrame,
72
83
  playbackRate,
84
+ allowAmplificationDuringRender,
73
85
  ]);
74
86
  (0, react_1.useImperativeHandle)(ref, () => {
75
87
  return videoRef.current;
76
- });
88
+ }, []);
77
89
  (0, react_1.useEffect)(() => {
78
- if (!videoRef.current) {
90
+ if (!window.remotion_videoEnabled) {
91
+ return;
92
+ }
93
+ const { current } = videoRef;
94
+ if (!current) {
79
95
  return;
80
96
  }
81
97
  const currentTime = (() => {
@@ -85,6 +101,7 @@ const VideoForRenderingForwardFunction = ({ onError, volume: volumeProp, playbac
85
101
  src: props.src,
86
102
  playbackRate: playbackRate || 1,
87
103
  startFrom: -mediaStartsAt,
104
+ mediaType: 'video',
88
105
  });
89
106
  })();
90
107
  const handle = (0, delay_render_1.delayRender)(`Rendering <Video /> with src="${props.src}"`);
@@ -92,18 +109,22 @@ const VideoForRenderingForwardFunction = ({ onError, volume: volumeProp, playbac
92
109
  (0, delay_render_1.continueRender)(handle);
93
110
  return;
94
111
  }
95
- if ((0, is_approximately_the_same_1.isApproximatelyTheSame)(videoRef.current.currentTime, currentTime)) {
96
- if (videoRef.current.readyState >= 2) {
112
+ if ((0, is_approximately_the_same_1.isApproximatelyTheSame)(current.currentTime, currentTime)) {
113
+ if (current.readyState >= 2) {
97
114
  (0, delay_render_1.continueRender)(handle);
98
115
  return;
99
116
  }
100
- videoRef.current.addEventListener('loadeddata', () => {
117
+ const loadedDataHandler = () => {
101
118
  (0, delay_render_1.continueRender)(handle);
102
- }, { once: true });
103
- return;
119
+ };
120
+ current.addEventListener('loadeddata', loadedDataHandler, { once: true });
121
+ return () => {
122
+ current.removeEventListener('loadeddata', loadedDataHandler);
123
+ };
104
124
  }
105
- videoRef.current.currentTime = currentTime;
106
- videoRef.current.addEventListener('seeked', () => {
125
+ current.currentTime = currentTime;
126
+ const seekedHandler = () => {
127
+ (0, warn_about_non_seekable_media_1.warnAboutNonSeekableMedia)(current, 'exception');
107
128
  if (window.navigator.platform.startsWith('Mac')) {
108
129
  // Improve me: This is ensures frame perfectness but slows down render.
109
130
  // Please see this issue for context: https://github.com/remotion-dev/remotion/issues/200
@@ -115,22 +136,28 @@ const VideoForRenderingForwardFunction = ({ onError, volume: volumeProp, playbac
115
136
  else {
116
137
  (0, delay_render_1.continueRender)(handle);
117
138
  }
118
- }, { once: true });
119
- videoRef.current.addEventListener('ended', () => {
139
+ };
140
+ current.addEventListener('seeked', seekedHandler, { once: true });
141
+ const endedHandler = () => {
120
142
  (0, delay_render_1.continueRender)(handle);
121
- }, { once: true });
122
- videoRef.current.addEventListener('error', () => {
123
- var _a, _b, _c, _d;
124
- if ((_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.error) {
125
- console.error('Error occurred in video', (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.error);
126
- throw new Error(`The browser threw an error while playing the video: ${(_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.error) === null || _d === void 0 ? void 0 : _d.message}`);
143
+ };
144
+ current.addEventListener('ended', endedHandler, { once: true });
145
+ const errorHandler = () => {
146
+ var _a;
147
+ if (current === null || current === void 0 ? void 0 : current.error) {
148
+ console.error('Error occurred in video', current === null || current === void 0 ? void 0 : current.error);
149
+ throw new Error(`The browser threw an error while playing the video ${props.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`);
127
150
  }
128
151
  else {
129
- throw new Error('The browser threw an errir');
152
+ throw new Error('The browser threw an error');
130
153
  }
131
- }, { once: true });
154
+ };
155
+ current.addEventListener('error', errorHandler, { once: true });
132
156
  // If video skips to another frame or unmounts, we clear the created handle
133
157
  return () => {
158
+ current.removeEventListener('ended', endedHandler);
159
+ current.removeEventListener('error', errorHandler);
160
+ current.removeEventListener('seeked', seekedHandler);
134
161
  (0, delay_render_1.continueRender)(handle);
135
162
  };
136
163
  }, [
@@ -141,6 +168,36 @@ const VideoForRenderingForwardFunction = ({ onError, volume: volumeProp, playbac
141
168
  frame,
142
169
  mediaStartsAt,
143
170
  ]);
171
+ const { src } = props;
172
+ // If video source switches, make new handle
173
+ if (environment === 'rendering') {
174
+ // eslint-disable-next-line react-hooks/rules-of-hooks
175
+ (0, react_1.useLayoutEffect)(() => {
176
+ if (process.env.NODE_ENV === 'test') {
177
+ return;
178
+ }
179
+ const newHandle = (0, delay_render_1.delayRender)('Loading <Video> duration with src=' + src);
180
+ const { current } = videoRef;
181
+ const didLoad = () => {
182
+ if (current === null || current === void 0 ? void 0 : current.duration) {
183
+ onDuration(src, current.duration);
184
+ }
185
+ (0, delay_render_1.continueRender)(newHandle);
186
+ };
187
+ if (current === null || current === void 0 ? void 0 : current.duration) {
188
+ onDuration(src, current.duration);
189
+ (0, delay_render_1.continueRender)(newHandle);
190
+ }
191
+ else {
192
+ current === null || current === void 0 ? void 0 : current.addEventListener('loadedmetadata', didLoad, { once: true });
193
+ }
194
+ // If tag gets unmounted, clear pending handles because video metadata is not going to load
195
+ return () => {
196
+ current === null || current === void 0 ? void 0 : current.removeEventListener('loadedmetadata', didLoad);
197
+ (0, delay_render_1.continueRender)(newHandle);
198
+ };
199
+ }, [src, onDuration]);
200
+ }
144
201
  return (0, jsx_runtime_1.jsx)("video", { ref: videoRef, ...props, onError: onError });
145
202
  };
146
203
  exports.VideoForRendering = (0, react_1.forwardRef)(VideoForRenderingForwardFunction);
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ declare type DurationState = Record<string, number>;
3
+ declare type DurationAction = {
4
+ type: 'got-duration';
5
+ src: string;
6
+ durationInSeconds: number;
7
+ };
8
+ export declare const durationReducer: (state: DurationState, action: DurationAction) => DurationState;
9
+ declare type TDurationsContext = {
10
+ durations: DurationState;
11
+ setDurations: React.Dispatch<DurationAction>;
12
+ };
13
+ export declare const DurationsContext: React.Context<TDurationsContext>;
14
+ export declare const DurationsContextProvider: React.FC<{
15
+ children: React.ReactNode;
16
+ }>;
17
+ export {};
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DurationsContextProvider = exports.DurationsContext = exports.durationReducer = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const durationReducer = (state, action) => {
7
+ switch (action.type) {
8
+ case 'got-duration':
9
+ return {
10
+ ...state,
11
+ [action.src]: action.durationInSeconds,
12
+ };
13
+ default:
14
+ return state;
15
+ }
16
+ };
17
+ exports.durationReducer = durationReducer;
18
+ exports.DurationsContext = (0, react_1.createContext)({
19
+ durations: {},
20
+ setDurations: () => {
21
+ throw new Error('context missing');
22
+ },
23
+ });
24
+ const DurationsContextProvider = ({ children }) => {
25
+ const [durations, setDurations] = (0, react_1.useReducer)(exports.durationReducer, {});
26
+ const value = (0, react_1.useMemo)(() => {
27
+ return {
28
+ durations,
29
+ setDurations,
30
+ };
31
+ }, [durations]);
32
+ return ((0, jsx_runtime_1.jsx)(exports.DurationsContext.Provider, { value: value, children: children }));
33
+ };
34
+ exports.DurationsContextProvider = DurationsContextProvider;
@@ -3,10 +3,11 @@ export declare const getExpectedMediaFrameUncorrected: ({ frame, playbackRate, s
3
3
  playbackRate: number;
4
4
  startFrom: number;
5
5
  }) => number;
6
- export declare const getMediaTime: ({ fps, frame, src, playbackRate, startFrom, }: {
6
+ export declare const getMediaTime: ({ fps, frame, src, playbackRate, startFrom, mediaType, }: {
7
7
  fps: number;
8
8
  frame: number;
9
9
  src: string;
10
10
  playbackRate: number;
11
11
  startFrom: number;
12
+ mediaType: 'video' | 'audio';
12
13
  }) => number;