remotion 4.1.0-alpha1 → 4.1.0-alpha11

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 (49) hide show
  1. package/dist/cjs/Composition.d.ts +26 -10
  2. package/dist/cjs/Composition.js +8 -18
  3. package/dist/cjs/CompositionManager.d.ts +11 -12
  4. package/dist/cjs/CompositionManagerContext.d.ts +4 -3
  5. package/dist/cjs/Img.d.ts +1 -1
  6. package/dist/cjs/Img.js +2 -2
  7. package/dist/cjs/NativeLayers.js +5 -4
  8. package/dist/cjs/RemotionRoot.js +6 -4
  9. package/dist/cjs/ResolveCompositionConfig.js +24 -7
  10. package/dist/cjs/Still.d.ts +1 -1
  11. package/dist/cjs/audio/AudioForDevelopment.js +1 -1
  12. package/dist/cjs/audio/shared-audio-tags.d.ts +1 -1
  13. package/dist/cjs/audio/shared-audio-tags.js +5 -1
  14. package/dist/cjs/config/input-props.d.ts +1 -1
  15. package/dist/cjs/config/input-props.js +2 -1
  16. package/dist/cjs/delay-render.js +22 -14
  17. package/dist/cjs/freeze.js +6 -2
  18. package/dist/cjs/index.d.ts +17 -7
  19. package/dist/cjs/index.js +1 -1
  20. package/dist/cjs/input-props-serialization.d.ts +15 -0
  21. package/dist/cjs/input-props-serialization.js +49 -0
  22. package/dist/cjs/internals.d.ts +80 -62
  23. package/dist/cjs/internals.js +13 -0
  24. package/dist/cjs/loop/index.js +1 -2
  25. package/dist/cjs/props-if-has-props.d.ts +2 -2
  26. package/dist/cjs/resolve-video-config.d.ts +3 -2
  27. package/dist/cjs/resolve-video-config.js +23 -33
  28. package/dist/cjs/series/index.js +2 -3
  29. package/dist/cjs/spring/index.js +1 -1
  30. package/dist/cjs/static-file.js +11 -2
  31. package/dist/cjs/timeline-position-state.d.ts +5 -3
  32. package/dist/cjs/timeline-position-state.js +25 -7
  33. package/dist/cjs/use-unsafe-video-config.js +2 -1
  34. package/dist/cjs/use-video.d.ts +1 -1
  35. package/dist/cjs/use-video.js +3 -3
  36. package/dist/cjs/validation/validate-dimensions.d.ts +1 -1
  37. package/dist/cjs/validation/validate-dimensions.js +2 -2
  38. package/dist/cjs/validation/validate-duration-in-frames.d.ts +2 -3
  39. package/dist/cjs/validation/validate-duration-in-frames.js +6 -2
  40. package/dist/cjs/validation/validate-fps.d.ts +1 -1
  41. package/dist/cjs/validation/validate-fps.js +2 -2
  42. package/dist/cjs/version.d.ts +1 -1
  43. package/dist/cjs/version.js +1 -1
  44. package/dist/cjs/video/OffthreadVideo.js +6 -3
  45. package/dist/cjs/video/OffthreadVideoForRendering.js +8 -2
  46. package/dist/cjs/video-config.d.ts +2 -1
  47. package/dist/esm/index.mjs +323 -214
  48. package/dist/esm/version.mjs +1 -1
  49. package/package.json +2 -2
@@ -1 +1 @@
1
- export declare const validateDimension: (amount: number, nameOfProp: string, location: string) => void;
1
+ export declare function validateDimension(amount: unknown, nameOfProp: string, location: string): asserts amount is number;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.validateDimension = void 0;
4
- const validateDimension = (amount, nameOfProp, location) => {
4
+ function validateDimension(amount, nameOfProp, location) {
5
5
  if (typeof amount !== 'number') {
6
6
  throw new Error(`The "${nameOfProp}" prop ${location} must be a number, but you passed a value of type ${typeof amount}`);
7
7
  }
@@ -17,5 +17,5 @@ const validateDimension = (amount, nameOfProp, location) => {
17
17
  if (amount <= 0) {
18
18
  throw new TypeError(`The "${nameOfProp}" prop ${location} must be positive, but got ${amount}.`);
19
19
  }
20
- };
20
+ }
21
21
  exports.validateDimension = validateDimension;
@@ -1,5 +1,4 @@
1
- export declare const validateDurationInFrames: ({ allowFloats, component, durationInFrames, }: {
2
- durationInFrames: number;
1
+ export declare function validateDurationInFrames(durationInFrames: unknown, options: {
3
2
  component: string;
4
3
  allowFloats: boolean;
5
- }) => void;
4
+ }): asserts durationInFrames is number;
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.validateDurationInFrames = void 0;
4
- const validateDurationInFrames = ({ allowFloats, component, durationInFrames, }) => {
4
+ function validateDurationInFrames(durationInFrames, options) {
5
+ const { allowFloats, component } = options;
6
+ if (typeof durationInFrames === 'undefined') {
7
+ throw new Error(`The "durationInFrames" prop ${component} is missing.`);
8
+ }
5
9
  if (typeof durationInFrames !== 'number') {
6
10
  throw new Error(`The "durationInFrames" prop ${component} must be a number, but you passed a value of type ${typeof durationInFrames}`);
7
11
  }
@@ -14,5 +18,5 @@ const validateDurationInFrames = ({ allowFloats, component, durationInFrames, })
14
18
  if (!Number.isFinite(durationInFrames)) {
15
19
  throw new TypeError(`The "durationInFrames" prop ${component} must be finite, but got ${durationInFrames}.`);
16
20
  }
17
- };
21
+ }
18
22
  exports.validateDurationInFrames = validateDurationInFrames;
@@ -1 +1 @@
1
- export declare const validateFps: (fps: number, location: string, isGif: boolean) => void;
1
+ export declare function validateFps(fps: unknown, location: string, isGif: boolean): asserts fps is number;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.validateFps = void 0;
4
- const validateFps = (fps, location, isGif) => {
4
+ function validateFps(fps, location, isGif) {
5
5
  if (typeof fps !== 'number') {
6
6
  throw new Error(`"fps" must be a number, but you passed a value of type ${typeof fps} ${location}`);
7
7
  }
@@ -17,5 +17,5 @@ const validateFps = (fps, location, isGif) => {
17
17
  if (isGif && fps > 50) {
18
18
  throw new TypeError(`The FPS for a GIF cannot be higher than 50. Use the --every-nth-frame option to lower the FPS: https://remotion.dev/docs/render-as-gif`);
19
19
  }
20
- };
20
+ }
21
21
  exports.validateFps = validateFps;
@@ -1 +1 @@
1
- export declare const VERSION = "4.1.0-alpha1";
1
+ export declare const VERSION = "4.1.0-alpha11";
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
4
  // Automatically generated on publish
5
- exports.VERSION = '4.1.0-alpha1';
5
+ exports.VERSION = '4.1.0-alpha11';
@@ -14,7 +14,9 @@ const VideoForDevelopment_js_1 = require("./VideoForDevelopment.js");
14
14
  * @see [Documentation](https://www.remotion.dev/docs/offthreadvideo)
15
15
  */
16
16
  const OffthreadVideo = (props) => {
17
- const { startFrom, endAt, imageFormat, ...otherProps } = props;
17
+ // Should only destruct `startFrom` and `endAt` from props,
18
+ // rest gets drilled down
19
+ const { startFrom, endAt, ...otherProps } = props;
18
20
  const environment = (0, get_environment_js_1.useRemotionEnvironment)();
19
21
  const onDuration = (0, react_1.useCallback)(() => undefined, []);
20
22
  if (typeof props.src !== 'string') {
@@ -31,8 +33,9 @@ const OffthreadVideo = (props) => {
31
33
  }
32
34
  (0, validate_media_props_js_1.validateMediaProps)(props, 'Video');
33
35
  if (environment === 'rendering') {
34
- return ((0, jsx_runtime_1.jsx)(OffthreadVideoForRendering_js_1.OffthreadVideoForRendering, { imageFormat: imageFormat, ...otherProps }));
36
+ return (0, jsx_runtime_1.jsx)(OffthreadVideoForRendering_js_1.OffthreadVideoForRendering, { ...otherProps });
35
37
  }
36
- return ((0, jsx_runtime_1.jsx)(VideoForDevelopment_js_1.VideoForDevelopment, { onDuration: onDuration, onlyWarnForMediaSeekingError: true, ...otherProps }));
38
+ const { transparent, ...withoutTransparent } = otherProps;
39
+ return ((0, jsx_runtime_1.jsx)(VideoForDevelopment_js_1.VideoForDevelopment, { onDuration: onDuration, onlyWarnForMediaSeekingError: true, ...withoutTransparent }));
37
40
  };
38
41
  exports.OffthreadVideo = OffthreadVideo;
@@ -6,6 +6,7 @@ const react_1 = require("react");
6
6
  const absolute_src_js_1 = require("../absolute-src.js");
7
7
  const AssetManager_js_1 = require("../AssetManager.js");
8
8
  const use_audio_frame_js_1 = require("../audio/use-audio-frame.js");
9
+ const cancel_render_js_1 = require("../cancel-render.js");
9
10
  const default_css_js_1 = require("../default-css.js");
10
11
  const Img_js_1 = require("../Img.js");
11
12
  const random_js_1 = require("../random.js");
@@ -91,8 +92,13 @@ const OffthreadVideoForRendering = ({ onError, volume: volumeProp, playbackRate,
91
92
  return `http://localhost:${window.remotion_proxyPort}/proxy?src=${encodeURIComponent((0, absolute_src_js_1.getAbsoluteSrc)(src))}&time=${encodeURIComponent(currentTime)}&transparent=${String(transparent)}`;
92
93
  }, [currentTime, src, transparent]);
93
94
  const onErr = (0, react_1.useCallback)((e) => {
94
- onError === null || onError === void 0 ? void 0 : onError(e);
95
- }, [onError]);
95
+ if (onError) {
96
+ onError === null || onError === void 0 ? void 0 : onError(e);
97
+ }
98
+ else {
99
+ (0, cancel_render_js_1.cancelRender)('Failed to load image with src ' + actualSrc);
100
+ }
101
+ }, [actualSrc, onError]);
96
102
  const className = (0, react_1.useMemo)(() => {
97
103
  return [default_css_js_1.OFFTHREAD_VIDEO_CLASS_NAME, props.className]
98
104
  .filter(truthy_js_1.truthy)
@@ -4,5 +4,6 @@ export type VideoConfig = {
4
4
  fps: number;
5
5
  durationInFrames: number;
6
6
  id: string;
7
- defaultProps: Record<string, unknown> | undefined;
7
+ defaultProps: Record<string, unknown>;
8
+ props: Record<string, unknown>;
8
9
  };