remotion 4.0.51 → 4.0.52
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.
- package/dist/cjs/Composition.d.ts +2 -0
- package/dist/cjs/CompositionManagerContext.d.ts +1 -1
- package/dist/cjs/ResolveCompositionConfig.js +2 -0
- package/dist/cjs/codec.d.ts +4 -0
- package/dist/cjs/codec.js +16 -0
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/resolve-video-config.js +9 -3
- package/dist/cjs/use-unsafe-video-config.js +2 -1
- package/dist/cjs/validation/validate-default-codec.d.ts +2 -0
- package/dist/cjs/validation/validate-default-codec.js +16 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/video-config.d.ts +2 -0
- package/dist/esm/index.mjs +38 -5
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
|
@@ -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
|
}
|
|
@@ -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';
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -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';
|
|
@@ -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
|
-
|
|
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;
|
|
@@ -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,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;
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "4.0.
|
|
1
|
+
export declare const VERSION = "4.0.52";
|
package/dist/cjs/version.js
CHANGED
|
@@ -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
|
};
|
package/dist/esm/index.mjs
CHANGED
|
@@ -59,7 +59,7 @@ function truthy(value) {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
// Automatically generated on publish
|
|
62
|
-
const VERSION = '4.0.
|
|
62
|
+
const VERSION = '4.0.52';
|
|
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
|
-
|
|
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
|
};
|
package/dist/esm/version.mjs
CHANGED