remotion 4.0.51 → 4.0.53

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.
@@ -1,6 +1,7 @@
1
1
  import type { ComponentType, PropsWithChildren } from 'react';
2
2
  import React from 'react';
3
3
  import type { AnyZodObject } from 'zod';
4
+ import type { Codec } from './codec.js';
4
5
  import type { InferProps, PropsIfHasProps } from './props-if-has-props.js';
5
6
  type LooseComponentType<T> = ComponentType<T> | ((props: T) => React.ReactNode);
6
7
  export type CompProps<Props> = {
@@ -16,6 +17,7 @@ export type CalcMetadataReturnType<T extends Record<string, unknown>> = {
16
17
  width?: number;
17
18
  height?: number;
18
19
  props?: T;
20
+ defaultCodec?: Codec;
19
21
  };
20
22
  export type CalculateMetadataFunction<T extends Record<string, unknown>> = (options: {
21
23
  defaultProps: T;
@@ -3,7 +3,7 @@ import type { AnyZodObject } from 'zod';
3
3
  import type { AnyComposition, TComposition } from './CompositionManager.js';
4
4
  import type { TFolder } from './Folder.js';
5
5
  import type { VideoConfig } from './video-config.js';
6
- export type BaseMetadata = Pick<VideoConfig, 'durationInFrames' | 'fps' | 'props' | 'height' | 'width'>;
6
+ export type BaseMetadata = Pick<VideoConfig, 'durationInFrames' | 'fps' | 'props' | 'height' | 'width' | 'defaultCodec'>;
7
7
  export type CanvasContent = {
8
8
  type: 'composition';
9
9
  compositionId: string;
@@ -177,6 +177,7 @@ const useResolvedVideoConfig = (preferredCompositionId) => {
177
177
  id: composition.id,
178
178
  props: currentCompositionMetadata.props,
179
179
  defaultProps: (_a = composition.defaultProps) !== null && _a !== void 0 ? _a : {},
180
+ defaultCodec: currentCompositionMetadata.defaultCodec,
180
181
  },
181
182
  };
182
183
  }
@@ -198,6 +199,7 @@ const useResolvedVideoConfig = (preferredCompositionId) => {
198
199
  ? {}
199
200
  : (_d = (0, input_props_js_1.getInputProps)()) !== null && _d !== void 0 ? _d : {}),
200
201
  },
202
+ defaultCodec: null,
201
203
  },
202
204
  };
203
205
  }
@@ -1,16 +1,15 @@
1
1
  import React from 'react';
2
2
  import type { LoopDisplay } from './CompositionManager.js';
3
3
  export type LayoutAndStyle = {
4
- layout: 'none';
5
- } | {
6
4
  layout?: 'absolute-fill';
7
5
  style?: React.CSSProperties;
8
6
  className?: string;
7
+ } | {
8
+ layout: 'none';
9
9
  };
10
- export type SequenceProps = {
10
+ export type SequencePropsWithoutDuration = {
11
11
  children: React.ReactNode;
12
12
  from?: number;
13
- durationInFrames?: number;
14
13
  name?: string;
15
14
  /**
16
15
  * @deprecated For internal use only.
@@ -21,6 +20,9 @@ export type SequenceProps = {
21
20
  */
22
21
  loopDisplay?: LoopDisplay;
23
22
  } & LayoutAndStyle;
23
+ export type SequenceProps = {
24
+ durationInFrames?: number;
25
+ } & SequencePropsWithoutDuration;
24
26
  /**
25
27
  * @description A component that time-shifts its children and wraps them in an absolutely positioned <div>.
26
28
  * @see [Documentation](https://www.remotion.dev/docs/sequence)
@@ -0,0 +1,4 @@
1
+ export declare const validCodecs: readonly ["h264", "h265", "vp8", "vp9", "mp3", "aac", "wav", "prores", "h264-mkv", "gif"];
2
+ export type Codec = (typeof validCodecs)[number];
3
+ export type CodecOrUndefined = Codec | undefined;
4
+ export declare const DEFAULT_CODEC: Codec;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEFAULT_CODEC = exports.validCodecs = void 0;
4
+ exports.validCodecs = [
5
+ 'h264',
6
+ 'h265',
7
+ 'vp8',
8
+ 'vp9',
9
+ 'mp3',
10
+ 'aac',
11
+ 'wav',
12
+ 'prores',
13
+ 'h264-mkv',
14
+ 'gif',
15
+ ];
16
+ exports.DEFAULT_CODEC = 'h264';
@@ -1,5 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import './asset-types.js';
3
+ import type { Codec } from './codec.js';
3
4
  import type { TRenderAsset } from './CompositionManager.js';
4
5
  import type { StaticFile } from './get-static-files.js';
5
6
  import type { ClipRegion } from './NativeLayers.js';
@@ -61,6 +62,7 @@ export type BundleState = {
61
62
  compositionDurationInFrames: number;
62
63
  compositionWidth: number;
63
64
  compositionFps: number;
65
+ compositionDefaultCodec: Codec;
64
66
  };
65
67
  export * from './AbsoluteFill.js';
66
68
  export * from './audio/index.js';
@@ -85,7 +87,7 @@ export { ClipRegion } from './NativeLayers.js';
85
87
  export { prefetch } from './prefetch.js';
86
88
  export { random, RandomSeed } from './random.js';
87
89
  export { registerRoot } from './register-root.js';
88
- export { Sequence } from './Sequence.js';
90
+ export { LayoutAndStyle, Sequence, SequenceProps, SequencePropsWithoutDuration, } from './Sequence.js';
89
91
  export { Series } from './series/index.js';
90
92
  export * from './spring/index.js';
91
93
  export { staticFile } from './static-file.js';
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.resolveVideoConfig = void 0;
4
+ const validate_default_codec_js_1 = require("./validation/validate-default-codec.js");
4
5
  const validate_dimensions_js_1 = require("./validation/validate-dimensions.js");
5
6
  const validate_duration_in_frames_js_1 = require("./validation/validate-duration-in-frames.js");
6
7
  const validate_fps_js_1 = require("./validation/validate-fps.js");
@@ -19,10 +20,12 @@ const validateCalculated = ({ composition, calculated, }) => {
19
20
  allowFloats: false,
20
21
  component: `of the "<Composition />" component with the id "${composition.id}"`,
21
22
  });
22
- return { width, height, fps, durationInFrames };
23
+ const defaultCodec = calculated === null || calculated === void 0 ? void 0 : calculated.defaultCodec;
24
+ (0, validate_default_codec_js_1.validateDefaultCodec)(defaultCodec, calculateMetadataErrorLocation);
25
+ return { width, height, fps, durationInFrames, defaultCodec };
23
26
  };
24
27
  const resolveVideoConfig = ({ composition, editorProps: editorPropsOrUndefined, signal, inputProps, }) => {
25
- var _a, _b, _c, _d, _e, _f;
28
+ var _a, _b, _c, _d, _e, _f, _g;
26
29
  const calculatedProm = composition.calculateMetadata
27
30
  ? composition.calculateMetadata({
28
31
  defaultProps: (_a = composition.defaultProps) !== null && _a !== void 0 ? _a : {},
@@ -43,7 +46,7 @@ const resolveVideoConfig = ({ composition, editorProps: editorPropsOrUndefined,
43
46
  'then' in calculatedProm) {
44
47
  return calculatedProm.then((c) => {
45
48
  var _a, _b;
46
- const { height, width, durationInFrames, fps } = validateCalculated({
49
+ const { height, width, durationInFrames, fps, defaultCodec } = validateCalculated({
47
50
  calculated: c,
48
51
  composition,
49
52
  });
@@ -55,6 +58,7 @@ const resolveVideoConfig = ({ composition, editorProps: editorPropsOrUndefined,
55
58
  id: composition.id,
56
59
  defaultProps: (_a = composition.defaultProps) !== null && _a !== void 0 ? _a : {},
57
60
  props: (_b = c.props) !== null && _b !== void 0 ? _b : fallbackProps,
61
+ defaultCodec: defaultCodec !== null && defaultCodec !== void 0 ? defaultCodec : null,
58
62
  };
59
63
  });
60
64
  }
@@ -68,6 +72,7 @@ const resolveVideoConfig = ({ composition, editorProps: editorPropsOrUndefined,
68
72
  id: composition.id,
69
73
  defaultProps: (_d = composition.defaultProps) !== null && _d !== void 0 ? _d : {},
70
74
  props: fallbackProps,
75
+ defaultCodec: null,
71
76
  };
72
77
  }
73
78
  return {
@@ -75,6 +80,7 @@ const resolveVideoConfig = ({ composition, editorProps: editorPropsOrUndefined,
75
80
  id: composition.id,
76
81
  defaultProps: (_e = composition.defaultProps) !== null && _e !== void 0 ? _e : {},
77
82
  props: (_f = calculatedProm.props) !== null && _f !== void 0 ? _f : fallbackProps,
83
+ defaultCodec: (_g = calculatedProm.defaultCodec) !== null && _g !== void 0 ? _g : null,
78
84
  };
79
85
  };
80
86
  exports.resolveVideoConfig = resolveVideoConfig;
@@ -3,6 +3,7 @@ import type { LayoutAndStyle, SequenceProps } from '../Sequence.js';
3
3
  type SeriesSequenceProps = PropsWithChildren<{
4
4
  durationInFrames: number;
5
5
  offset?: number;
6
+ className?: string;
6
7
  } & Pick<SequenceProps, 'layout' | 'name'> & LayoutAndStyle>;
7
8
  declare const SeriesSequence: import("react").ForwardRefExoticComponent<SeriesSequenceProps & import("react").RefAttributes<HTMLDivElement>>;
8
9
  /**
@@ -28,10 +28,10 @@ const Series = ({ children }) => {
28
28
  if (castedChild.trim() === '') {
29
29
  return null;
30
30
  }
31
- throw new TypeError(`The <Series /> component only accepts a list of <Series.Sequence /> components as it's children, but you passed a string "${castedChild}"`);
31
+ throw new TypeError(`The <Series /> component only accepts a list of <Series.Sequence /> components as its children, but you passed a string "${castedChild}"`);
32
32
  }
33
33
  if (castedChild.type !== SeriesSequence) {
34
- throw new TypeError(`The <Series /> component only accepts a list of <Series.Sequence /> components as it's children, but got ${castedChild} instead`);
34
+ throw new TypeError(`The <Series /> component only accepts a list of <Series.Sequence /> components as its children, but got ${castedChild} instead`);
35
35
  }
36
36
  const debugInfo = `index = ${i}, duration = ${castedChild.props.durationInFrames}`;
37
37
  if (!(castedChild === null || castedChild === void 0 ? void 0 : castedChild.props.children)) {
@@ -13,7 +13,7 @@ const useUnsafeVideoConfig = () => {
13
13
  if (!video) {
14
14
  return null;
15
15
  }
16
- const { id, durationInFrames, fps, height, width, defaultProps, props } = video;
16
+ const { id, durationInFrames, fps, height, width, defaultProps, props, defaultCodec, } = video;
17
17
  return {
18
18
  id,
19
19
  width,
@@ -22,6 +22,7 @@ const useUnsafeVideoConfig = () => {
22
22
  durationInFrames: ctxDuration !== null && ctxDuration !== void 0 ? ctxDuration : durationInFrames,
23
23
  defaultProps,
24
24
  props,
25
+ defaultCodec,
25
26
  };
26
27
  }, [ctxDuration, video]);
27
28
  };
@@ -0,0 +1,2 @@
1
+ import type { CodecOrUndefined } from '../codec';
2
+ export declare function validateDefaultCodec(defaultCodec: unknown, location: string): asserts defaultCodec is CodecOrUndefined;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateDefaultCodec = void 0;
4
+ const codec_1 = require("../codec");
5
+ function validateDefaultCodec(defaultCodec, location) {
6
+ if (typeof defaultCodec === 'undefined') {
7
+ return;
8
+ }
9
+ if (typeof defaultCodec !== 'string') {
10
+ throw new TypeError(`The "defaultCodec" prop ${location} must be a string, but you passed a value of type ${typeof defaultCodec}.`);
11
+ }
12
+ if (!codec_1.validCodecs.includes(defaultCodec)) {
13
+ throw new Error(`The "defaultCodec" prop ${location} must be one of ${codec_1.validCodecs.join(', ')}, but you passed ${defaultCodec}.`);
14
+ }
15
+ }
16
+ exports.validateDefaultCodec = validateDefaultCodec;
@@ -1 +1 @@
1
- export declare const VERSION = "4.0.51";
1
+ export declare const VERSION = "4.0.53";
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
4
  // Automatically generated on publish
5
- exports.VERSION = '4.0.51';
5
+ exports.VERSION = '4.0.53';
@@ -1,3 +1,4 @@
1
+ import type { Codec } from './codec';
1
2
  export type VideoConfig = {
2
3
  width: number;
3
4
  height: number;
@@ -6,4 +7,5 @@ export type VideoConfig = {
6
7
  id: string;
7
8
  defaultProps: Record<string, unknown>;
8
9
  props: Record<string, unknown>;
10
+ defaultCodec: Codec | null;
9
11
  };
@@ -59,7 +59,7 @@ function truthy(value) {
59
59
  }
60
60
 
61
61
  // Automatically generated on publish
62
- const VERSION = '4.0.51';
62
+ const VERSION = '4.0.53';
63
63
 
64
64
  const checkMultipleRemotionVersions = () => {
65
65
  if (typeof globalThis === 'undefined') {
@@ -515,6 +515,31 @@ const EditorPropsProvider = ({ children }) => {
515
515
  return (jsx(EditorPropsContext.Provider, { value: ctx, children: children }));
516
516
  };
517
517
 
518
+ const validCodecs = [
519
+ 'h264',
520
+ 'h265',
521
+ 'vp8',
522
+ 'vp9',
523
+ 'mp3',
524
+ 'aac',
525
+ 'wav',
526
+ 'prores',
527
+ 'h264-mkv',
528
+ 'gif',
529
+ ];
530
+
531
+ function validateDefaultCodec(defaultCodec, location) {
532
+ if (typeof defaultCodec === 'undefined') {
533
+ return;
534
+ }
535
+ if (typeof defaultCodec !== 'string') {
536
+ throw new TypeError(`The "defaultCodec" prop ${location} must be a string, but you passed a value of type ${typeof defaultCodec}.`);
537
+ }
538
+ if (!validCodecs.includes(defaultCodec)) {
539
+ throw new Error(`The "defaultCodec" prop ${location} must be one of ${validCodecs.join(', ')}, but you passed ${defaultCodec}.`);
540
+ }
541
+ }
542
+
518
543
  function validateDimension(amount, nameOfProp, location) {
519
544
  if (typeof amount !== 'number') {
520
545
  throw new Error(`The "${nameOfProp}" prop ${location} must be a number, but you passed a value of type ${typeof amount}`);
@@ -585,10 +610,12 @@ const validateCalculated = ({ composition, calculated, }) => {
585
610
  allowFloats: false,
586
611
  component: `of the "<Composition />" component with the id "${composition.id}"`,
587
612
  });
588
- return { width, height, fps, durationInFrames };
613
+ const defaultCodec = calculated === null || calculated === void 0 ? void 0 : calculated.defaultCodec;
614
+ validateDefaultCodec(defaultCodec, calculateMetadataErrorLocation);
615
+ return { width, height, fps, durationInFrames, defaultCodec };
589
616
  };
590
617
  const resolveVideoConfig = ({ composition, editorProps: editorPropsOrUndefined, signal, inputProps, }) => {
591
- var _a, _b, _c, _d, _e, _f;
618
+ var _a, _b, _c, _d, _e, _f, _g;
592
619
  const calculatedProm = composition.calculateMetadata
593
620
  ? composition.calculateMetadata({
594
621
  defaultProps: (_a = composition.defaultProps) !== null && _a !== void 0 ? _a : {},
@@ -609,7 +636,7 @@ const resolveVideoConfig = ({ composition, editorProps: editorPropsOrUndefined,
609
636
  'then' in calculatedProm) {
610
637
  return calculatedProm.then((c) => {
611
638
  var _a, _b;
612
- const { height, width, durationInFrames, fps } = validateCalculated({
639
+ const { height, width, durationInFrames, fps, defaultCodec } = validateCalculated({
613
640
  calculated: c,
614
641
  composition,
615
642
  });
@@ -621,6 +648,7 @@ const resolveVideoConfig = ({ composition, editorProps: editorPropsOrUndefined,
621
648
  id: composition.id,
622
649
  defaultProps: (_a = composition.defaultProps) !== null && _a !== void 0 ? _a : {},
623
650
  props: (_b = c.props) !== null && _b !== void 0 ? _b : fallbackProps,
651
+ defaultCodec: defaultCodec !== null && defaultCodec !== void 0 ? defaultCodec : null,
624
652
  };
625
653
  });
626
654
  }
@@ -634,6 +662,7 @@ const resolveVideoConfig = ({ composition, editorProps: editorPropsOrUndefined,
634
662
  id: composition.id,
635
663
  defaultProps: (_d = composition.defaultProps) !== null && _d !== void 0 ? _d : {},
636
664
  props: fallbackProps,
665
+ defaultCodec: null,
637
666
  };
638
667
  }
639
668
  return {
@@ -641,6 +670,7 @@ const resolveVideoConfig = ({ composition, editorProps: editorPropsOrUndefined,
641
670
  id: composition.id,
642
671
  defaultProps: (_e = composition.defaultProps) !== null && _e !== void 0 ? _e : {},
643
672
  props: (_f = calculatedProm.props) !== null && _f !== void 0 ? _f : fallbackProps,
673
+ defaultCodec: (_g = calculatedProm.defaultCodec) !== null && _g !== void 0 ? _g : null,
644
674
  };
645
675
  };
646
676
 
@@ -811,6 +841,7 @@ const useResolvedVideoConfig = (preferredCompositionId) => {
811
841
  id: composition.id,
812
842
  props: currentCompositionMetadata.props,
813
843
  defaultProps: (_a = composition.defaultProps) !== null && _a !== void 0 ? _a : {},
844
+ defaultCodec: currentCompositionMetadata.defaultCodec,
814
845
  },
815
846
  };
816
847
  }
@@ -832,6 +863,7 @@ const useResolvedVideoConfig = (preferredCompositionId) => {
832
863
  ? {}
833
864
  : (_d = getInputProps()) !== null && _d !== void 0 ? _d : {}),
834
865
  },
866
+ defaultCodec: null,
835
867
  },
836
868
  };
837
869
  }
@@ -959,7 +991,7 @@ const useUnsafeVideoConfig = () => {
959
991
  if (!video) {
960
992
  return null;
961
993
  }
962
- const { id, durationInFrames, fps, height, width, defaultProps, props } = video;
994
+ const { id, durationInFrames, fps, height, width, defaultProps, props, defaultCodec, } = video;
963
995
  return {
964
996
  id,
965
997
  width,
@@ -968,6 +1000,7 @@ const useUnsafeVideoConfig = () => {
968
1000
  durationInFrames: ctxDuration !== null && ctxDuration !== void 0 ? ctxDuration : durationInFrames,
969
1001
  defaultProps,
970
1002
  props,
1003
+ defaultCodec,
971
1004
  };
972
1005
  }, [ctxDuration, video]);
973
1006
  };
@@ -4026,10 +4059,10 @@ const Series = ({ children }) => {
4026
4059
  if (castedChild.trim() === '') {
4027
4060
  return null;
4028
4061
  }
4029
- throw new TypeError(`The <Series /> component only accepts a list of <Series.Sequence /> components as it's children, but you passed a string "${castedChild}"`);
4062
+ throw new TypeError(`The <Series /> component only accepts a list of <Series.Sequence /> components as its children, but you passed a string "${castedChild}"`);
4030
4063
  }
4031
4064
  if (castedChild.type !== SeriesSequence) {
4032
- throw new TypeError(`The <Series /> component only accepts a list of <Series.Sequence /> components as it's children, but got ${castedChild} instead`);
4065
+ throw new TypeError(`The <Series /> component only accepts a list of <Series.Sequence /> components as its children, but got ${castedChild} instead`);
4033
4066
  }
4034
4067
  const debugInfo = `index = ${i}, duration = ${castedChild.props.durationInFrames}`;
4035
4068
  if (!(castedChild === null || castedChild === void 0 ? void 0 : castedChild.props.children)) {
@@ -1,4 +1,4 @@
1
1
  // Automatically generated on publish
2
- const VERSION = '4.0.51';
2
+ const VERSION = '4.0.53';
3
3
 
4
4
  export { VERSION };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "remotion",
3
- "version": "4.0.51",
3
+ "version": "4.0.53",
4
4
  "description": "Render videos in React",
5
5
  "main": "dist/cjs/index.js",
6
6
  "types": "dist/cjs/index.d.ts",
@@ -23,7 +23,7 @@
23
23
  "@testing-library/react": "14.0.0",
24
24
  "@types/node": "18.14.6",
25
25
  "@types/react": "18.0.26",
26
- "@types/react-dom": "18.0.10",
26
+ "@types/react-dom": "18.0.11",
27
27
  "@vitejs/plugin-react": "^2.0.0",
28
28
  "eslint": "8.42.0",
29
29
  "eslint-plugin-require-extensions": "^0.1.2",