remotion 4.0.0-oops.3 → 4.0.0-prefetch.10

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 (191) hide show
  1. package/.turbo/turbo-build.log +5 -5
  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/Composition.d.ts +3 -6
  8. package/dist/Composition.js +40 -28
  9. package/dist/CompositionManager.d.ts +7 -12
  10. package/dist/CompositionManager.js +15 -5
  11. package/dist/Folder.d.ts +15 -0
  12. package/dist/Folder.js +33 -0
  13. package/dist/IFrame.js +1 -1
  14. package/dist/Img.js +33 -16
  15. package/dist/RemotionRoot.js +5 -4
  16. package/dist/{sequencing/index.d.ts → Sequence.d.ts} +13 -3
  17. package/dist/{sequencing/index.js → Sequence.js} +40 -34
  18. package/dist/Still.d.ts +1 -1
  19. package/dist/Still.js +1 -1
  20. package/dist/asset-types.d.ts +1 -4
  21. package/dist/audio/Audio.d.ts +2 -2
  22. package/dist/audio/Audio.js +5 -5
  23. package/dist/audio/AudioForDevelopment.d.ts +3 -2
  24. package/dist/audio/AudioForDevelopment.js +19 -6
  25. package/dist/audio/AudioForRendering.d.ts +5 -2
  26. package/dist/audio/AudioForRendering.js +15 -8
  27. package/dist/audio/index.js +5 -1
  28. package/dist/audio/props.d.ts +1 -1
  29. package/dist/audio/shared-audio-tags.d.ts +4 -3
  30. package/dist/audio/shared-audio-tags.js +115 -42
  31. package/dist/audio/use-audio-frame.js +4 -4
  32. package/dist/config/bundle-out-dir.d.ts +2 -0
  33. package/dist/config/bundle-out-dir.js +12 -0
  34. package/dist/config/input-props.js +12 -14
  35. package/dist/config/public-path.d.ts +2 -0
  36. package/dist/config/public-path.js +12 -0
  37. package/dist/{config/index.d.ts → config.d.ts} +70 -22
  38. package/dist/config.js +21 -0
  39. package/dist/default-css.d.ts +1 -0
  40. package/dist/default-css.js +9 -2
  41. package/dist/delay-render.d.ts +1 -1
  42. package/dist/delay-render.js +4 -4
  43. package/dist/freeze.d.ts +2 -2
  44. package/dist/freeze.js +2 -2
  45. package/dist/get-timeline-clip-name.js +2 -1
  46. package/dist/index.d.ts +23 -8
  47. package/dist/index.js +18 -8
  48. package/dist/internals.d.ts +35 -101
  49. package/dist/internals.js +18 -94
  50. package/dist/{interpolateColors.d.ts → interpolate-colors.d.ts} +0 -0
  51. package/dist/{interpolateColors.js → interpolate-colors.js} +0 -0
  52. package/dist/loading-indicator.d.ts +2 -0
  53. package/dist/loading-indicator.js +35 -0
  54. package/dist/loop/index.js +5 -4
  55. package/dist/multiple-versions-warning.js +18 -4
  56. package/dist/play-and-handle-not-allowed-error.d.ts +1 -1
  57. package/dist/portal-node.d.ts +1 -0
  58. package/dist/portal-node.js +23 -0
  59. package/dist/preload-state.d.ts +13 -0
  60. package/dist/preload-state.js +26 -0
  61. package/dist/preload.d.ts +7 -0
  62. package/dist/preload.js +83 -0
  63. package/dist/register-root.d.ts +2 -1
  64. package/dist/register-root.js +20 -5
  65. package/dist/series/index.d.ts +2 -2
  66. package/dist/series/index.js +4 -4
  67. package/dist/spring/index.d.ts +8 -4
  68. package/dist/spring/index.js +21 -6
  69. package/dist/spring/measure-spring.d.ts +1 -1
  70. package/dist/spring/measure-spring.js +1 -1
  71. package/dist/static-file.js +6 -0
  72. package/dist/timeline-position-state.d.ts +1 -1
  73. package/dist/{use-frame.d.ts → use-current-frame.d.ts} +0 -1
  74. package/dist/use-current-frame.js +28 -0
  75. package/dist/use-lazy-component.d.ts +3 -3
  76. package/dist/use-lazy-component.js +5 -1
  77. package/dist/use-media-in-timeline.d.ts +2 -2
  78. package/dist/use-media-in-timeline.js +10 -7
  79. package/dist/use-media-playback.d.ts +3 -2
  80. package/dist/use-media-playback.js +9 -6
  81. package/dist/use-media-tag-volume.d.ts +1 -1
  82. package/dist/use-sync-volume-with-media-tag.d.ts +2 -2
  83. package/dist/use-unsafe-video-config.d.ts +1 -1
  84. package/dist/use-unsafe-video-config.js +2 -2
  85. package/dist/use-video-config.d.ts +1 -1
  86. package/dist/use-video-config.js +6 -0
  87. package/dist/use-video.d.ts +13 -1
  88. package/dist/use-video.js +16 -3
  89. package/dist/validate-media-props.d.ts +4 -3
  90. package/dist/validation/validate-fps.d.ts +1 -1
  91. package/dist/validation/validate-fps.js +4 -1
  92. package/dist/validation/validate-offthreadvideo-image-format.d.ts +1 -0
  93. package/dist/validation/validate-offthreadvideo-image-format.js +15 -0
  94. package/dist/validation/validation-spring-duration.d.ts +1 -0
  95. package/dist/validation/validation-spring-duration.js +21 -0
  96. package/dist/version.d.ts +1 -0
  97. package/dist/version.js +5 -0
  98. package/dist/video/OffthreadVideo.d.ts +3 -0
  99. package/dist/video/OffthreadVideo.js +27 -0
  100. package/dist/video/OffthreadVideoForRendering.d.ts +3 -0
  101. package/dist/video/OffthreadVideoForRendering.js +101 -0
  102. package/dist/video/Video.d.ts +3 -3
  103. package/dist/video/Video.js +4 -4
  104. package/dist/video/VideoForDevelopment.d.ts +7 -2
  105. package/dist/video/VideoForDevelopment.js +28 -4
  106. package/dist/video/VideoForRendering.d.ts +5 -2
  107. package/dist/video/VideoForRendering.js +62 -40
  108. package/dist/video/get-current-time.d.ts +7 -1
  109. package/dist/video/get-current-time.js +17 -9
  110. package/dist/video/index.d.ts +3 -2
  111. package/dist/video/index.js +5 -12
  112. package/dist/video/props.d.ts +13 -2
  113. package/dist/volume-prop.js +1 -1
  114. package/dist/warn-about-non-seekable-media.d.ts +1 -1
  115. package/dist/warn-about-non-seekable-media.js +14 -2
  116. package/dist/wrap-remotion-context.d.ts +2 -1
  117. package/dist/wrap-remotion-context.js +12 -4
  118. package/ensure-correct-version.js +24 -0
  119. package/package.json +10 -11
  120. package/version.d.ts +1 -0
  121. package/version.js +1 -0
  122. package/dist/compress-assets.d.ts +0 -7
  123. package/dist/compress-assets.js +0 -25
  124. package/dist/config/browser-executable.d.ts +0 -3
  125. package/dist/config/browser-executable.js +0 -12
  126. package/dist/config/browser.d.ts +0 -4
  127. package/dist/config/browser.js +0 -19
  128. package/dist/config/chromium-flags.d.ts +0 -10
  129. package/dist/config/chromium-flags.js +0 -34
  130. package/dist/config/codec.d.ts +0 -17
  131. package/dist/config/codec.js +0 -103
  132. package/dist/config/concurrency.d.ts +0 -3
  133. package/dist/config/concurrency.js +0 -15
  134. package/dist/config/crf.d.ts +0 -9
  135. package/dist/config/crf.js +0 -83
  136. package/dist/config/env-file.d.ts +0 -2
  137. package/dist/config/env-file.js +0 -10
  138. package/dist/config/ffmpeg-executable.d.ts +0 -3
  139. package/dist/config/ffmpeg-executable.js +0 -12
  140. package/dist/config/frame-range.d.ts +0 -5
  141. package/dist/config/frame-range.js +0 -80
  142. package/dist/config/image-format.d.ts +0 -8
  143. package/dist/config/image-format.js +0 -37
  144. package/dist/config/image-sequence.d.ts +0 -3
  145. package/dist/config/image-sequence.js +0 -15
  146. package/dist/config/index.js +0 -175
  147. package/dist/config/log.d.ts +0 -7
  148. package/dist/config/log.js +0 -25
  149. package/dist/config/max-timeline-tracks.d.ts +0 -2
  150. package/dist/config/max-timeline-tracks.js +0 -24
  151. package/dist/config/override-webpack.d.ts +0 -12
  152. package/dist/config/override-webpack.js +0 -14
  153. package/dist/config/overwrite.d.ts +0 -3
  154. package/dist/config/overwrite.js +0 -14
  155. package/dist/config/pixel-format.d.ts +0 -8
  156. package/dist/config/pixel-format.js +0 -38
  157. package/dist/config/preview-server.d.ts +0 -2
  158. package/dist/config/preview-server.js +0 -20
  159. package/dist/config/prores-profile.d.ts +0 -7
  160. package/dist/config/prores-profile.js +0 -32
  161. package/dist/config/quality.d.ts +0 -2
  162. package/dist/config/quality.js +0 -17
  163. package/dist/config/scale.d.ts +0 -3
  164. package/dist/config/scale.js +0 -15
  165. package/dist/config/still-frame.d.ts +0 -2
  166. package/dist/config/still-frame.js +0 -12
  167. package/dist/config/timeout.d.ts +0 -2
  168. package/dist/config/timeout.js +0 -17
  169. package/dist/config/webpack-caching.d.ts +0 -3
  170. package/dist/config/webpack-caching.js +0 -16
  171. package/dist/feature-flags.d.ts +0 -1
  172. package/dist/feature-flags.js +0 -7
  173. package/dist/initial-frame.d.ts +0 -2
  174. package/dist/initial-frame.js +0 -12
  175. package/dist/is-audio-codec.d.ts +0 -2
  176. package/dist/is-audio-codec.js +0 -7
  177. package/dist/perf/index.d.ts +0 -5
  178. package/dist/perf/index.js +0 -33
  179. package/dist/timeline-inout-position-state.d.ts +0 -12
  180. package/dist/timeline-inout-position-state.js +0 -23
  181. package/dist/timeout.d.ts +0 -2
  182. package/dist/timeout.js +0 -12
  183. package/dist/use-frame.js +0 -25
  184. package/dist/validation/validate-frame.d.ts +0 -1
  185. package/dist/validation/validate-frame.js +0 -24
  186. package/dist/validation/validate-image-format.d.ts +0 -2
  187. package/dist/validation/validate-image-format.js +0 -9
  188. package/dist/validation/validate-opengl-renderer.d.ts +0 -4
  189. package/dist/validation/validate-opengl-renderer.js +0 -14
  190. package/dist/validation/validate-quality.d.ts +0 -1
  191. package/dist/validation/validate-quality.js +0 -21
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -23,9 +27,40 @@ exports.useSharedAudio = exports.SharedAudioContextProvider = exports.SharedAudi
23
27
  const jsx_runtime_1 = require("react/jsx-runtime");
24
28
  const react_1 = __importStar(require("react"));
25
29
  const EMPTY_AUDIO = 'data:audio/mp3;base64,/+MYxAAJcAV8AAgAABn//////+/gQ5BAMA+D4Pg+BAQBAEAwD4Pg+D4EBAEAQDAPg++hYBH///hUFQVBUFREDQNHmf///////+MYxBUGkAGIMAAAAP/29Xt6lUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV/+MYxDUAAANIAAAAAFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV';
30
+ const compareProps = (obj1, obj2) => {
31
+ const keysA = Object.keys(obj1).sort();
32
+ const keysB = Object.keys(obj2).sort();
33
+ if (keysA.length !== keysB.length) {
34
+ return false;
35
+ }
36
+ for (let i = 0; i < keysA.length; i++) {
37
+ // Not the same keys
38
+ if (keysA[i] !== keysB[i]) {
39
+ return false;
40
+ }
41
+ // Not the same values
42
+ if (obj1[keysA[i]] !== obj2[keysB[i]]) {
43
+ return false;
44
+ }
45
+ }
46
+ return true;
47
+ };
48
+ const didPropChange = (key, newProp, prevProp) => {
49
+ // /music.mp3 and http://localhost:3000/music.mp3 are the same
50
+ if (key === 'src' &&
51
+ !prevProp.startsWith('data:') &&
52
+ !newProp.startsWith('data:')) {
53
+ return (new URL(prevProp, window.location.origin).toString() !==
54
+ new URL(newProp, window.location.origin).toString());
55
+ }
56
+ if (prevProp === newProp) {
57
+ return false;
58
+ }
59
+ return true;
60
+ };
26
61
  exports.SharedAudioContext = (0, react_1.createContext)(null);
27
62
  const SharedAudioContextProvider = ({ children, numberOfAudioTags }) => {
28
- const [audios, setAudios] = (0, react_1.useState)([]);
63
+ const audios = (0, react_1.useRef)([]);
29
64
  const [initialNumberOfAudioTags] = (0, react_1.useState)(numberOfAudioTags);
30
65
  if (numberOfAudioTags !== initialNumberOfAudioTags) {
31
66
  throw new Error('The number of shared audio tags has changed dynamically. Once you have set this property, you cannot change it afterwards.');
@@ -36,7 +71,38 @@ const SharedAudioContextProvider = ({ children, numberOfAudioTags }) => {
36
71
  });
37
72
  }, [numberOfAudioTags]);
38
73
  const takenAudios = (0, react_1.useRef)(new Array(numberOfAudioTags).fill(false));
39
- const registerAudio = (0, react_1.useCallback)((aud) => {
74
+ const rerenderAudios = (0, react_1.useCallback)(() => {
75
+ refs.forEach(({ ref, id }) => {
76
+ var _a;
77
+ const data = (_a = audios.current) === null || _a === void 0 ? void 0 : _a.find((a) => a.id === id);
78
+ const { current } = ref;
79
+ if (!current) {
80
+ // Whole player has been unmounted, the refs don't exist anymore.
81
+ // It is not an error anymore though
82
+ return;
83
+ }
84
+ if (data === undefined) {
85
+ current.src = EMPTY_AUDIO;
86
+ return;
87
+ }
88
+ if (!data) {
89
+ throw new TypeError('Expected audio data to be there');
90
+ }
91
+ Object.keys(data.props).forEach((key) => {
92
+ // @ts-expect-error
93
+ if (didPropChange(key, data.props[key], current[key])) {
94
+ // @ts-expect-error
95
+ current[key] = data.props[key];
96
+ }
97
+ });
98
+ });
99
+ }, [refs]);
100
+ const registerAudio = (0, react_1.useCallback)((aud, audioId) => {
101
+ var _a, _b;
102
+ const found = (_a = audios.current) === null || _a === void 0 ? void 0 : _a.find((a) => a.audioId === audioId);
103
+ if (found) {
104
+ return found;
105
+ }
40
106
  const firstFreeAudio = takenAudios.current.findIndex((a) => a === false);
41
107
  if (firstFreeAudio === -1) {
42
108
  throw new Error(`Tried to simultaneously mount ${numberOfAudioTags + 1} <Audio /> tags at the same time. With the current settings, the maximum amount of <Audio /> tags is limited to ${numberOfAudioTags} at the same time. Remotion pre-mounts silent audio tags to help avoid browser autoplay restrictions. See https://remotion.dev/docs/player/autoplay#use-the-numberofsharedaudiotags-property for more information on how to increase this limit.`);
@@ -49,17 +115,14 @@ const SharedAudioContextProvider = ({ children, numberOfAudioTags }) => {
49
115
  props: aud,
50
116
  id,
51
117
  el: ref,
118
+ audioId,
52
119
  };
53
- // We need a timeout because this state setting is triggered by another state being set, causing React to throw an error.
54
- // By setting a timeout, we are bypassing the error and allowing the state
55
- // to be updated in the next tick.
56
- // This can lead to a tiny delay of audio playback, improvement ideas are welcome.
57
- setTimeout(() => {
58
- setAudios((prevAudios) => [...prevAudios, newElem]);
59
- }, 4);
120
+ (_b = audios.current) === null || _b === void 0 ? void 0 : _b.push(newElem);
121
+ rerenderAudios();
60
122
  return newElem;
61
- }, [numberOfAudioTags, refs]);
123
+ }, [numberOfAudioTags, refs, rerenderAudios]);
62
124
  const unregisterAudio = (0, react_1.useCallback)((id) => {
125
+ var _a;
63
126
  const cloned = [...takenAudios.current];
64
127
  const index = refs.findIndex((r) => r.id === id);
65
128
  if (index === -1) {
@@ -67,23 +130,30 @@ const SharedAudioContextProvider = ({ children, numberOfAudioTags }) => {
67
130
  }
68
131
  cloned[index] = false;
69
132
  takenAudios.current = cloned;
70
- setAudios((prevAudios) => {
71
- return prevAudios.filter((a) => a.id !== id);
72
- });
73
- }, [refs]);
133
+ audios.current = (_a = audios.current) === null || _a === void 0 ? void 0 : _a.filter((a) => a.id !== id);
134
+ rerenderAudios();
135
+ }, [refs, rerenderAudios]);
74
136
  const updateAudio = (0, react_1.useCallback)((id, aud) => {
75
- setAudios((prevAudios) => {
76
- return prevAudios.map((prevA) => {
77
- if (prevA.id === id) {
78
- return {
79
- ...prevA,
80
- props: aud,
81
- };
137
+ var _a;
138
+ let changed = false;
139
+ audios.current = (_a = audios.current) === null || _a === void 0 ? void 0 : _a.map((prevA) => {
140
+ if (prevA.id === id) {
141
+ const isTheSame = compareProps(aud, prevA.props);
142
+ if (isTheSame) {
143
+ return prevA;
82
144
  }
83
- return prevA;
84
- });
145
+ changed = true;
146
+ return {
147
+ ...prevA,
148
+ props: aud,
149
+ };
150
+ }
151
+ return prevA;
85
152
  });
86
- }, []);
153
+ if (changed) {
154
+ rerenderAudios();
155
+ }
156
+ }, [rerenderAudios]);
87
157
  const playAllAudios = (0, react_1.useCallback)(() => {
88
158
  refs.forEach((ref) => {
89
159
  var _a;
@@ -106,41 +176,44 @@ const SharedAudioContextProvider = ({ children, numberOfAudioTags }) => {
106
176
  updateAudio,
107
177
  ]);
108
178
  return ((0, jsx_runtime_1.jsxs)(exports.SharedAudioContext.Provider, { value: value, children: [refs.map(({ id, ref }) => {
109
- const data = audios.find((a) => a.id === id);
110
- if (data === undefined) {
111
- return (0, jsx_runtime_1.jsx)("audio", { ref: ref, src: EMPTY_AUDIO }, id);
112
- }
113
- if (!data) {
114
- throw new TypeError('Expected audio data to be there');
115
- }
116
- return (0, jsx_runtime_1.jsx)("audio", { ref: ref, ...data.props }, id);
117
- }), children] }, void 0));
179
+ return (0, jsx_runtime_1.jsx)("audio", { ref: ref, src: EMPTY_AUDIO }, id);
180
+ }), children] }));
118
181
  };
119
182
  exports.SharedAudioContextProvider = SharedAudioContextProvider;
120
- const useSharedAudio = (aud) => {
183
+ const useSharedAudio = (aud, audioId) => {
121
184
  const ctx = (0, react_1.useContext)(exports.SharedAudioContext);
185
+ /**
186
+ * We work around this in React 18 so an audio tag will only register itself once
187
+ */
122
188
  const [elem] = (0, react_1.useState)(() => {
123
189
  if (ctx && ctx.numberOfAudioTags > 0) {
124
- return ctx.registerAudio(aud);
190
+ return ctx.registerAudio(aud, audioId);
125
191
  }
126
192
  return {
127
193
  el: react_1.default.createRef(),
128
194
  id: Math.random(),
129
195
  props: aud,
196
+ audioId,
130
197
  };
131
198
  });
132
- (0, react_1.useEffect)(() => {
199
+ /**
200
+ * Effects in React 18 fire twice, and we are looking for a way to only fire it once.
201
+ * - useInsertionEffect only fires once. If it's available we are in React 18.
202
+ * - useLayoutEffect only fires once in React 17.
203
+ */
204
+ const effectToUse = react_1.useInsertionEffect !== null && react_1.useInsertionEffect !== void 0 ? react_1.useInsertionEffect : react_1.useLayoutEffect;
205
+ effectToUse(() => {
206
+ if (ctx && ctx.numberOfAudioTags > 0) {
207
+ ctx.updateAudio(elem.id, aud);
208
+ }
209
+ }, [aud, ctx, elem.id]);
210
+ effectToUse(() => {
133
211
  return () => {
134
212
  if (ctx && ctx.numberOfAudioTags > 0) {
135
213
  ctx.unregisterAudio(elem.id);
136
214
  }
137
215
  };
138
216
  }, [ctx, elem.id]);
139
- (0, react_1.useEffect)(() => {
140
- if (ctx && ctx.numberOfAudioTags > 0) {
141
- ctx.updateAudio(elem.id, aud);
142
- }
143
- }, [aud, ctx, elem.id]);
144
217
  return elem;
145
218
  };
146
219
  exports.useSharedAudio = useSharedAudio;
@@ -2,11 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useFrameForVolumeProp = exports.useMediaStartsAt = void 0;
4
4
  const react_1 = require("react");
5
- const sequencing_1 = require("../sequencing");
6
- const use_frame_1 = require("../use-frame");
5
+ const Sequence_1 = require("../Sequence");
6
+ const use_current_frame_1 = require("../use-current-frame");
7
7
  const useMediaStartsAt = () => {
8
8
  var _a;
9
- const parentSequence = (0, react_1.useContext)(sequencing_1.SequenceContext);
9
+ const parentSequence = (0, react_1.useContext)(Sequence_1.SequenceContext);
10
10
  const startsAt = Math.min(0, (_a = parentSequence === null || parentSequence === void 0 ? void 0 : parentSequence.relativeFrom) !== null && _a !== void 0 ? _a : 0);
11
11
  return startsAt;
12
12
  };
@@ -16,7 +16,7 @@ exports.useMediaStartsAt = useMediaStartsAt;
16
16
  * we calculate the way more intuitive value for currentFrame
17
17
  */
18
18
  const useFrameForVolumeProp = () => {
19
- const frame = (0, use_frame_1.useCurrentFrame)();
19
+ const frame = (0, use_current_frame_1.useCurrentFrame)();
20
20
  const startsAt = (0, exports.useMediaStartsAt)();
21
21
  return frame + startsAt;
22
22
  };
@@ -0,0 +1,2 @@
1
+ export declare const getBundleOutDir: () => string | null;
2
+ export declare const setBundleOutDir: (path: string) => void;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setBundleOutDir = exports.getBundleOutDir = void 0;
4
+ let bundleOutDir = null;
5
+ const getBundleOutDir = () => {
6
+ return bundleOutDir;
7
+ };
8
+ exports.getBundleOutDir = getBundleOutDir;
9
+ const setBundleOutDir = (path) => {
10
+ bundleOutDir = path;
11
+ };
12
+ exports.setBundleOutDir = setBundleOutDir;
@@ -13,21 +13,19 @@ const warnOnceSSRImport = () => {
13
13
  console.warn(" typeof window === 'undefined' ? {} : getInputProps()");
14
14
  };
15
15
  const getInputProps = () => {
16
- if ((0, get_environment_1.getRemotionEnvironment)() === 'rendering') {
17
- if (typeof window === 'undefined') {
18
- warnOnceSSRImport();
19
- return {};
20
- }
21
- const param = window.remotion_inputProps;
22
- if (!param) {
23
- return {};
24
- }
25
- const parsed = JSON.parse(param);
26
- return parsed;
16
+ if (typeof window === 'undefined') {
17
+ warnOnceSSRImport();
18
+ return {};
27
19
  }
28
- if ((0, get_environment_1.getRemotionEnvironment)() === 'preview') {
29
- return process.env.INPUT_PROPS;
20
+ if ((0, get_environment_1.getRemotionEnvironment)() === 'player-development' ||
21
+ (0, get_environment_1.getRemotionEnvironment)() === 'player-production') {
22
+ throw new Error('You cannot call `getInputProps()` from a <Player>. Instead, the props are available as React props from component that you passed as `component` prop.');
30
23
  }
31
- throw new Error('You cannot call `getInputProps()` from a <Player>. Instead, the props are available as React props from component that you passed as `component` prop.');
24
+ const param = window.remotion_inputProps;
25
+ if (!param) {
26
+ return {};
27
+ }
28
+ const parsed = JSON.parse(param);
29
+ return parsed;
32
30
  };
33
31
  exports.getInputProps = getInputProps;
@@ -0,0 +1,2 @@
1
+ export declare const getPublicPath: () => string | null;
2
+ export declare const setPublicPath: (path: string) => void;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setPublicPath = exports.getPublicPath = void 0;
4
+ let publicPath = null;
5
+ const getPublicPath = () => {
6
+ return publicPath;
7
+ };
8
+ exports.getPublicPath = getPublicPath;
9
+ const setPublicPath = (path) => {
10
+ publicPath = path;
11
+ };
12
+ exports.setPublicPath = setPublicPath;
@@ -1,14 +1,18 @@
1
- import { Browser } from './browser';
2
- import { BrowserExecutable } from './browser-executable';
3
- import { Codec } from './codec';
4
- import { Concurrency } from './concurrency';
5
- import { FfmpegExecutable } from './ffmpeg-executable';
6
- import { FrameRange } from './frame-range';
7
- import { ImageFormat, StillImageFormat } from './image-format';
8
- import { LogLevel } from './log';
9
- import { WebpackConfiguration, WebpackOverrideFn } from './override-webpack';
10
- import { PixelFormat } from './pixel-format';
11
- export declare const Config: {
1
+ /**
2
+ * The configuration has moved to @remotion/cli.
3
+ * For the moment the type definitions are going to stay here
4
+ */
5
+ declare type Concurrency = number | null;
6
+ import type { Configuration } from 'webpack';
7
+ declare type WebpackConfiguration = Configuration;
8
+ declare type WebpackOverrideFn = (currentConfiguration: WebpackConfiguration) => WebpackConfiguration;
9
+ declare type BrowserExecutable = string | null;
10
+ declare type FrameRange = number | [number, number];
11
+ declare type FfmpegExecutable = string | null;
12
+ declare type Loop = number | null;
13
+ declare type CodecOrUndefined = 'h264' | 'h265' | 'vp8' | 'vp9' | 'mp3' | 'aac' | 'wav' | 'prores' | 'h264-mkv' | 'gif' | undefined;
14
+ declare type Crf = number | undefined;
15
+ export declare type ConfigType = {
12
16
  readonly Preview: {
13
17
  /**
14
18
  * Change the maximum amount of tracks that are shown in the timeline.
@@ -16,6 +20,12 @@ export declare const Config: {
16
20
  * @default 15
17
21
  */
18
22
  readonly setMaxTimelineTracks: (maxTracks: number) => void;
23
+ /**
24
+ * Enable Keyboard shortcuts in the Remotion Preview.
25
+ * @param enabled Boolean whether to enable the keyboard shortcuts
26
+ * @default true
27
+ */
28
+ readonly setKeyboardShortcutsEnabled: (enableShortcuts: boolean) => void;
19
29
  };
20
30
  readonly Bundling: {
21
31
  /**
@@ -35,6 +45,12 @@ export declare const Config: {
35
45
  * If you specify a port, but it's not available, Remotion will throw an error.
36
46
  */
37
47
  readonly setPort: (port: number | undefined) => void;
48
+ /**
49
+ * Define the location of the public/ directory.
50
+ * By default it is a folder named "public" inside the current working directory.
51
+ * You can set an absolute path or a relative path that will be resolved from the closest package.json location.
52
+ */
53
+ readonly setPublicDir: (publicDir: string | null) => void;
38
54
  };
39
55
  readonly Log: {
40
56
  /**
@@ -44,7 +60,7 @@ export declare const Config: {
44
60
  *
45
61
  * Set this to 'verbose' to get browser logs and other IO.
46
62
  */
47
- readonly setLevel: (newLogLevel: "verbose" | "info" | "warn" | "error") => void;
63
+ readonly setLevel: (newLogLevel: 'verbose' | 'info' | 'warn' | 'error') => void;
48
64
  };
49
65
  readonly Puppeteer: {
50
66
  /**
@@ -73,10 +89,10 @@ export declare const Config: {
73
89
  */
74
90
  readonly setChromiumHeadlessMode: (should: boolean) => void;
75
91
  /**
76
- * Set the OpenGL rendering backend for Chrome. Possible values: 'egl', 'angle' and 'swiftshader'.
77
- * Default: 'swiftshader' in Lambda, 'angle' elsewhere.
92
+ * Set the OpenGL rendering backend for Chrome. Possible values: 'egl', 'angle', 'swiftshader' and 'swangle'.
93
+ * Default: 'swangle' in Lambda, null elsewhere.
78
94
  */
79
- readonly setChromiumOpenGlRenderer: (renderer: "angle" | "egl" | "swiftshader") => void;
95
+ readonly setChromiumOpenGlRenderer: (renderer: 'swangle' | 'angle' | 'egl' | 'swiftshader') => void;
80
96
  };
81
97
  readonly Rendering: {
82
98
  /**
@@ -99,7 +115,7 @@ export declare const Config: {
99
115
  /** Decide in which image format to render. Can be either 'jpeg' or 'png'.
100
116
  * PNG is slower, but supports transparency.
101
117
  */
102
- readonly setImageFormat: (format: "none" | "png" | "jpeg") => void;
118
+ readonly setImageFormat: (format: 'png' | 'jpeg' | 'none') => void;
103
119
  /**
104
120
  * Render only a subset of a video.
105
121
  * Pass in a tuple [20, 30] to only render frames 20-30 into a video.
@@ -112,13 +128,43 @@ export declare const Config: {
112
128
  * Default: null, which will use ffmpeg available in PATH.
113
129
  */
114
130
  readonly setFfmpegExecutable: (ffmpegPath: FfmpegExecutable) => void;
131
+ /**
132
+ * Specify local ffprobe executable.
133
+ * Default: null, which will use ffprobe available in PATH.
134
+ */
135
+ readonly setFfprobeExecutable: (ffprobePath: FfmpegExecutable) => void;
115
136
  /**
116
137
  * Scales the output dimensions by a factor.
117
138
  * Default: 1.
118
139
  */
119
140
  readonly setScale: (newScale: number) => void;
141
+ /**
142
+ * Specify which frames should be picked for rendering a GIF
143
+ * Default: 1, which means every frame
144
+ * https://remotion.dev/docs/render-as-gif
145
+ */
146
+ readonly setEveryNthFrame: (frame: number) => void;
147
+ /**
148
+ * Specify the number of Loop a GIF should have.
149
+ * Default: null (means GIF will loop infinite)
150
+ */
151
+ readonly setNumberOfGifLoops: (newLoop: Loop) => void;
152
+ /**
153
+ * Disable audio output.
154
+ * Default: false
155
+ */
156
+ readonly setMuted: (muted: boolean) => void;
157
+ /**
158
+ * Don't render an audio track if it would be silent.
159
+ * Default: true
160
+ */
161
+ readonly setEnforceAudioTrack: (enforceAudioTrack: boolean) => void;
120
162
  };
121
163
  readonly Output: {
164
+ /**
165
+ * Set the output file location string. Default: `out/{composition}.{codec}`
166
+ */
167
+ readonly setOutputLocation: (newOutputLocation: string) => void;
122
168
  /**
123
169
  * If the video file already exists, should Remotion overwrite
124
170
  * the output? Default: true
@@ -129,23 +175,23 @@ export declare const Config: {
129
175
  * See https://trac.ffmpeg.org/wiki/Chroma%20Subsampling for an explanation.
130
176
  * You can override this using the `--pixel-format` Cli flag.
131
177
  */
132
- readonly setPixelFormat: (format: "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le") => void;
178
+ readonly setPixelFormat: (format: 'yuv420p' | 'yuva420p' | 'yuv422p' | 'yuv444p' | 'yuv420p10le' | 'yuv422p10le' | 'yuv444p10le' | 'yuva444p10le') => void;
133
179
  /**
134
180
  * @deprecated Use setCodec() and setImageSequence() instead.
135
181
  * Specify what kind of output you, either `mp4` or `png-sequence`.
136
182
  */
137
- readonly setOutputFormat: (newLegacyFormat: "mp4" | "png-sequence") => void;
183
+ readonly setOutputFormat: (newLegacyFormat: 'mp4' | 'png-sequence') => void;
138
184
  /**
139
185
  * Specify the codec for stitching the frames into a video.
140
186
  * Can be `h264` (default), `h265`, `vp8` or `vp9`
141
187
  */
142
- readonly setCodec: (newCodec: import("./codec").CodecOrUndefined) => void;
188
+ readonly setCodec: (newCodec: CodecOrUndefined) => void;
143
189
  /**
144
190
  * Set the Constant Rate Factor to pass to FFMPEG.
145
191
  * Lower values mean better quality, but be aware that the ranges of
146
192
  * possible values greatly differs between codecs.
147
193
  */
148
- readonly setCrf: (newCrf: number | undefined) => void;
194
+ readonly setCrf: (newCrf: Crf) => void;
149
195
  /**
150
196
  * Set to true if don't want a video but an image sequence as the output.
151
197
  */
@@ -156,7 +202,9 @@ export declare const Config: {
156
202
  * Possible values: 4444-xq, 4444, hq, standard, light, proxy. Default: 'hq'
157
203
  * See https://avpres.net/FFmpeg/im_ProRes.html for meaning of possible values.
158
204
  */
159
- readonly setProResProfile: (profile: "light" | "4444-xq" | "4444" | "hq" | "standard" | "proxy" | undefined) => void;
205
+ readonly setProResProfile: (profile: '4444-xq' | '4444' | 'hq' | 'standard' | 'light' | 'proxy' | undefined) => void;
160
206
  };
161
207
  };
162
- export type { PixelFormat, Concurrency, WebpackConfiguration, WebpackOverrideFn, BrowserExecutable, FfmpegExecutable, ImageFormat, Codec, Browser, FrameRange, LogLevel, StillImageFormat, };
208
+ export type { Concurrency, WebpackConfiguration, WebpackOverrideFn };
209
+ export declare const Config: ConfigType;
210
+ export declare const enableLegacyRemotionConfig: () => void;
package/dist/config.js ADDED
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ /**
3
+ * The configuration has moved to @remotion/cli.
4
+ * For the moment the type definitions are going to stay here
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.enableLegacyRemotionConfig = exports.Config = void 0;
8
+ const conf = {};
9
+ let enabled = false;
10
+ exports.Config = new Proxy(conf, {
11
+ get(target, prop, receiver) {
12
+ if (!enabled) {
13
+ throw new Error('To use the Remotion config file, you need to have @remotion/cli installed.\n- Make sure that all versions of Remotion are the same.\n- Make sure that @remotion/cli is installed.\n- Make sure Config is imported from "@remotion/cli", not "remotion".');
14
+ }
15
+ return Reflect.get(target, prop, receiver);
16
+ },
17
+ });
18
+ const enableLegacyRemotionConfig = () => {
19
+ enabled = true;
20
+ };
21
+ exports.enableLegacyRemotionConfig = enableLegacyRemotionConfig;
@@ -1,2 +1,3 @@
1
1
  export declare const injectCSS: (css: string) => void;
2
+ export declare const OFFTHREAD_VIDEO_CLASS_NAME = "__remotion_offthreadvideo";
2
3
  export declare const makeDefaultCSS: (scope: string | null, backgroundColor: string) => string;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.makeDefaultCSS = exports.injectCSS = void 0;
3
+ exports.makeDefaultCSS = exports.OFFTHREAD_VIDEO_CLASS_NAME = exports.injectCSS = void 0;
4
4
  const injected = {};
5
5
  const injectCSS = (css) => {
6
6
  // Skip in node
@@ -13,10 +13,11 @@ const injectCSS = (css) => {
13
13
  const head = document.head || document.getElementsByTagName('head')[0];
14
14
  const style = document.createElement('style');
15
15
  style.appendChild(document.createTextNode(css));
16
- head.appendChild(style);
16
+ head.prepend(style);
17
17
  injected[css] = true;
18
18
  };
19
19
  exports.injectCSS = injectCSS;
20
+ exports.OFFTHREAD_VIDEO_CLASS_NAME = '__remotion_offthreadvideo';
20
21
  const makeDefaultCSS = (scope, backgroundColor) => {
21
22
  if (!scope) {
22
23
  return `
@@ -27,6 +28,9 @@ const makeDefaultCSS = (scope, backgroundColor) => {
27
28
  margin: 0;
28
29
  background-color: ${backgroundColor};
29
30
  }
31
+ .${exports.OFFTHREAD_VIDEO_CLASS_NAME} {
32
+ object-fit: contain;
33
+ }
30
34
  `;
31
35
  }
32
36
  return `
@@ -37,6 +41,9 @@ const makeDefaultCSS = (scope, backgroundColor) => {
37
41
  width: 100%;
38
42
  height: 100%;
39
43
  }
44
+ ${scope} .${exports.OFFTHREAD_VIDEO_CLASS_NAME} {
45
+ object-fit: contain;
46
+ }
40
47
  `;
41
48
  };
42
49
  exports.makeDefaultCSS = makeDefaultCSS;
@@ -5,7 +5,7 @@ export declare const DELAY_RENDER_CALLSTACK_TOKEN = "The delayRender was called:
5
5
  * @returns {number} An identifier to be passed to continueRender().
6
6
  * @link https://www.remotion.dev/docs/delay-render
7
7
  */
8
- export declare const delayRender: (label?: string | undefined) => number;
8
+ export declare const delayRender: (label?: string) => number;
9
9
  /**
10
10
  * Unblock a render that has been blocked by delayRender()
11
11
  * @param handle The return value of delayRender().
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.continueRender = exports.delayRender = exports.DELAY_RENDER_CALLSTACK_TOKEN = void 0;
4
4
  const get_environment_1 = require("./get-environment");
5
- const timeout_1 = require("./timeout");
6
5
  const truthy_1 = require("./truthy");
7
6
  if (typeof window !== 'undefined') {
8
7
  window.ready = false;
@@ -10,6 +9,7 @@ if (typeof window !== 'undefined') {
10
9
  let handles = [];
11
10
  const timeouts = {};
12
11
  exports.DELAY_RENDER_CALLSTACK_TOKEN = 'The delayRender was called:';
12
+ const defaultTimeout = 30000;
13
13
  /**
14
14
  * Call this function to tell Remotion to wait before capturing this frame until data has loaded. Use continueRender() to unblock the render.
15
15
  * @param label _optional_ A label to identify the call in case it does time out.
@@ -17,7 +17,7 @@ exports.DELAY_RENDER_CALLSTACK_TOKEN = 'The delayRender was called:';
17
17
  * @link https://www.remotion.dev/docs/delay-render
18
18
  */
19
19
  const delayRender = (label) => {
20
- var _a, _b;
20
+ var _a, _b, _c;
21
21
  if (typeof label !== 'string' && typeof label !== 'undefined') {
22
22
  throw new Error('The label parameter of delayRender() must be a string or undefined, got: ' +
23
23
  JSON.stringify(label));
@@ -27,8 +27,8 @@ const delayRender = (label) => {
27
27
  const called = (_b = (_a = Error().stack) === null || _a === void 0 ? void 0 : _a.replace(/^Error/g, '')) !== null && _b !== void 0 ? _b : '';
28
28
  if ((0, get_environment_1.getRemotionEnvironment)() === 'rendering') {
29
29
  const timeoutToUse = typeof window === 'undefined'
30
- ? timeout_1.DEFAULT_PUPPETEER_TIMEOUT
31
- : window.remotion_puppeteerTimeout - 2000;
30
+ ? defaultTimeout
31
+ : ((_c = window.remotion_puppeteerTimeout) !== null && _c !== void 0 ? _c : defaultTimeout) - 2000;
32
32
  timeouts[handle] = setTimeout(() => {
33
33
  const message = [
34
34
  `A delayRender()`,
package/dist/freeze.d.ts CHANGED
@@ -3,5 +3,5 @@ declare type FreezeProps = {
3
3
  frame: number;
4
4
  children: React.ReactNode;
5
5
  };
6
- declare const Freeze: React.FC<FreezeProps>;
7
- export { Freeze };
6
+ export declare const Freeze: React.FC<FreezeProps>;
7
+ export {};
package/dist/freeze.js CHANGED
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Freeze = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
- const sequencing_1 = require("./sequencing");
6
+ const Sequence_1 = require("./Sequence");
7
7
  const timeline_position_state_1 = require("./timeline-position-state");
8
8
  const Freeze = ({ frame, children }) => {
9
9
  if (typeof frame === 'undefined') {
@@ -29,6 +29,6 @@ const Freeze = ({ frame, children }) => {
29
29
  frame,
30
30
  };
31
31
  }, [context, frame]);
32
- return ((0, jsx_runtime_1.jsx)(timeline_position_state_1.TimelineContext.Provider, { value: value, children: (0, jsx_runtime_1.jsx)(sequencing_1.SequenceContext.Provider, { value: null, children: children }, void 0) }, void 0));
32
+ return ((0, jsx_runtime_1.jsx)(timeline_position_state_1.TimelineContext.Provider, { value: value, children: (0, jsx_runtime_1.jsx)(Sequence_1.SequenceContext.Provider, { value: null, children: children }) }));
33
33
  };
34
34
  exports.Freeze = Freeze;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getTimelineClipName = void 0;
4
4
  const react_1 = require("react");
5
+ const HIDDEN_NAMES = ['__WEBPACK_DEFAULT_EXPORT__'];
5
6
  const getTimelineClipName = (children) => {
6
7
  var _a;
7
8
  const tree = (_a = react_1.Children.map(children, (ch) => {
@@ -10,7 +11,7 @@ const getTimelineClipName = (children) => {
10
11
  }
11
12
  // Must be name, not ID
12
13
  const name = typeof ch.type !== 'string' && ch.type.name;
13
- if (name) {
14
+ if (name && !HIDDEN_NAMES.includes(name)) {
14
15
  return name;
15
16
  }
16
17
  if (ch.props.children) {