remotion 3.3.32 → 3.3.34

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/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "3.3.32";
1
+ export declare const VERSION = "3.3.34";
package/dist/version.js CHANGED
@@ -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 = '3.3.32';
5
+ exports.VERSION = '3.3.34';
@@ -29,9 +29,11 @@ const useAppendVideoFragment = ({ actualSrc: initialActualSrc, actualFrom: initi
29
29
  exports.useAppendVideoFragment = useAppendVideoFragment;
30
30
  // https://github.com/remotion-dev/remotion/issues/1655
31
31
  const isIOSSafariCase = (actualSrc) => {
32
- return (/iP(ad|od|hone)/i.test(window.navigator.userAgent) &&
33
- Boolean(navigator.userAgent.match(/Version\/[\d.]+.*Safari/)) &&
34
- actualSrc.startsWith('blob:'));
32
+ return typeof window === 'undefined'
33
+ ? false
34
+ : /iP(ad|od|hone)/i.test(window.navigator.userAgent) &&
35
+ Boolean(navigator.userAgent.match(/Version\/[\d.]+.*Safari/)) &&
36
+ actualSrc.startsWith('blob:');
35
37
  };
36
38
  const appendVideoFragment = ({ actualSrc, actualFrom, duration, fps, }) => {
37
39
  var _a;
@@ -41,7 +43,7 @@ const appendVideoFragment = ({ actualSrc, actualFrom, duration, fps, }) => {
41
43
  if (actualSrc.startsWith('data:')) {
42
44
  return actualSrc;
43
45
  }
44
- const existingHash = Boolean(new URL(actualSrc, (_a = window.location.href) !== null && _a !== void 0 ? _a : 'http://localhost:3000').hash);
46
+ const existingHash = Boolean(new URL(actualSrc, (_a = (typeof window === 'undefined' ? null : window.location.href)) !== null && _a !== void 0 ? _a : 'http://localhost:3000').hash);
45
47
  if (existingHash) {
46
48
  return actualSrc;
47
49
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "remotion",
3
- "version": "3.3.32",
3
+ "version": "3.3.34",
4
4
  "description": "Render videos in React",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -65,5 +65,5 @@
65
65
  ]
66
66
  }
67
67
  },
68
- "gitHead": "6b4f3514c801ddf2e7f957dd2e633271fbbc75f6"
68
+ "gitHead": "b078979b3e2f5cc4d240f112b827e7ef951aa318"
69
69
  }
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- import type { Layer } from './layers';
3
- export declare const LayerMaster: <T extends object>({ layers, defaultProps, inputProps, fallbackComponent: FallbackComponent, }: {
4
- layers: Layer<T>[];
5
- defaultProps: T | undefined;
6
- inputProps: any;
7
- fallbackComponent: React.FC | null;
8
- }) => JSX.Element;
@@ -1,39 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LayerMaster = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = require("react");
6
- const AbsoluteFill_1 = require("./AbsoluteFill");
7
- const get_environment_1 = require("./get-environment");
8
- const LayerMaster = ({ layers, defaultProps, inputProps, fallbackComponent: FallbackComponent, }) => {
9
- return (
10
- // TODO: Same styles as normal
11
- (0, jsx_runtime_1.jsx)(AbsoluteFill_1.AbsoluteFill, { children: layers.map((layer, i) => {
12
- const Comp = layer.component;
13
- if (layer.type === 'web') {
14
- if (FallbackComponent === null) {
15
- // eslint-disable-next-line react/no-array-index-key
16
- return (0, jsx_runtime_1.jsx)(Comp, { ...defaultProps, ...inputProps }, String(i));
17
- }
18
- return (
19
- // eslint-disable-next-line react/no-array-index-key
20
- (0, jsx_runtime_1.jsx)(react_1.Suspense, { fallback: (0, jsx_runtime_1.jsx)(FallbackComponent, {}), children: (0, jsx_runtime_1.jsx)(Comp, { ...defaultProps, ...inputProps }) }, String(i)));
21
- }
22
- // SVG should not support suspense
23
- if (layer.type === 'svg') {
24
- if ((0, get_environment_1.getRemotionEnvironment)() === 'rendering') {
25
- return null;
26
- }
27
- return ((0, jsx_runtime_1.jsx)(AbsoluteFill_1.AbsoluteFill, { children: (0, jsx_runtime_1.jsx)(Comp, { ...defaultProps, ...inputProps }, String(i)) }));
28
- }
29
- if (layer.type === 'video') {
30
- if ((0, get_environment_1.getRemotionEnvironment)() === 'rendering') {
31
- return null;
32
- }
33
- // TODO: AbsoluteFill is different flex direction
34
- return ((0, jsx_runtime_1.jsx)(AbsoluteFill_1.AbsoluteFill, { children: (0, jsx_runtime_1.jsx)(Comp, { ...defaultProps, ...inputProps }, String(i)) }));
35
- }
36
- throw new Error('Unknown layer type');
37
- }) }));
38
- };
39
- exports.LayerMaster = LayerMaster;
package/dist/Satori.d.ts DELETED
@@ -1,5 +0,0 @@
1
- import type { PropsWithChildren } from 'react';
2
- import React from 'react';
3
- export declare const Satori: React.FC<PropsWithChildren>;
4
- export declare const SatoriForRendering: React.FC<PropsWithChildren>;
5
- export declare const SatoriForDevelopment: React.FC<PropsWithChildren>;
package/dist/Satori.js DELETED
@@ -1,92 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = 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);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.SatoriForDevelopment = exports.SatoriForRendering = exports.Satori = void 0;
30
- const jsx_runtime_1 = require("react/jsx-runtime");
31
- const react_1 = __importStar(require("react"));
32
- const satori_1 = __importDefault(require("satori"));
33
- const _1 = require(".");
34
- const get_environment_1 = require("./get-environment");
35
- const NativeLayers_1 = require("./NativeLayers");
36
- const use_video_config_1 = require("./use-video-config");
37
- const Satori = ({ children }) => {
38
- if ((0, get_environment_1.getRemotionEnvironment)() === 'rendering') {
39
- return (0, jsx_runtime_1.jsx)(exports.SatoriForRendering, { children: children });
40
- }
41
- return (0, jsx_runtime_1.jsx)(exports.SatoriForDevelopment, { children: children });
42
- };
43
- exports.Satori = Satori;
44
- const SatoriForRendering = ({ children }) => {
45
- const { width, height } = (0, use_video_config_1.useVideoConfig)();
46
- const { setSatoriStack } = (0, react_1.useContext)(NativeLayers_1.NativeLayersContext);
47
- (0, react_1.useLayoutEffect)(() => {
48
- const handle = (0, _1.delayRender)();
49
- (0, satori_1.default)(children, {
50
- width,
51
- height,
52
- fonts: [],
53
- })
54
- .then((svg) => {
55
- (0, _1.continueRender)(handle);
56
- setSatoriStack(svg);
57
- console.log({ svg });
58
- })
59
- .catch((err) => {
60
- console.log(err);
61
- });
62
- }, [children, height, setSatoriStack, width]);
63
- return (0, jsx_runtime_1.jsx)(_1.Experimental.Null, {});
64
- };
65
- exports.SatoriForRendering = SatoriForRendering;
66
- const SatoriForDevelopment = ({ children, }) => {
67
- const [markup, setMarkup] = react_1.default.useState(null);
68
- const { width, height } = (0, use_video_config_1.useVideoConfig)();
69
- (0, react_1.useEffect)(() => {
70
- (0, satori_1.default)(children, {
71
- width,
72
- height,
73
- fonts: [],
74
- })
75
- .then((svg) => {
76
- setMarkup(svg);
77
- console.log({ svg });
78
- })
79
- .catch((err) => {
80
- console.log(err);
81
- });
82
- }, [children, height, width]);
83
- if (!markup) {
84
- return null;
85
- }
86
- return ((0, jsx_runtime_1.jsx)("div", {
87
- // eslint-disable-next-line react/no-danger
88
- dangerouslySetInnerHTML: {
89
- __html: markup,
90
- } }));
91
- };
92
- exports.SatoriForDevelopment = SatoriForDevelopment;
@@ -1,3 +0,0 @@
1
- import type { ComponentType } from 'react';
2
- import type { TCompMetadata } from './CompositionManager';
3
- export declare const getCompositionsFromMarkup: (Comp: ComponentType) => TCompMetadata[];
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getCompositionsFromMarkup = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const server_1 = require("react-dom/server");
6
- const Composition_1 = require("./Composition");
7
- const getCompositionsFromMarkup = (Comp) => {
8
- // TODO: Is this still necessary?
9
- process.env.REMOTION_SERVER_RENDERING = 'true';
10
- const str = (0, server_1.renderToString)((0, jsx_runtime_1.jsx)(Composition_1.GetCompositionsFromMarkupModeProvider, { children: (0, jsx_runtime_1.jsx)(Comp, {}) }));
11
- const matches = str.matchAll(/<div>(.*?)<\/div>/g);
12
- const metadata = [];
13
- for (const match of matches) {
14
- const json = JSON.parse(match[1]);
15
- metadata.push(json);
16
- }
17
- return metadata;
18
- };
19
- exports.getCompositionsFromMarkup = getCompositionsFromMarkup;
package/dist/layers.d.ts DELETED
@@ -1,24 +0,0 @@
1
- import type { ComponentType, LazyExoticComponent } from 'react';
2
- import React from 'react';
3
- export declare type LooseComponentType<T> = ComponentType<T> | ((props: T) => React.ReactNode);
4
- export declare type InputLayer<T> = {
5
- component: LooseComponentType<T>;
6
- type: 'web' | 'svg' | 'video';
7
- };
8
- export declare type CompProps<T> = {
9
- lazyComponent: () => Promise<{
10
- default: LooseComponentType<T>;
11
- }>;
12
- } | {
13
- component: LooseComponentType<T>;
14
- } | {
15
- layers: InputLayer<T>[];
16
- };
17
- export declare type Layer<T> = {
18
- component: LazyExoticComponent<ComponentType<T>>;
19
- type: 'web' | 'svg' | 'video';
20
- };
21
- export declare type SmallLayer = Pick<Layer<unknown>, 'type'>;
22
- export declare const convertComponentTypesToLayers: <T>(compProps: CompProps<T>) => Layer<T>[];
23
- export declare const convertComponentTypesToLayersWithCache: <T>(compProps: CompProps<T>, prevCompProps: CompProps<T> | null, prevReturnValue: Layer<T>[] | null) => Layer<T>[];
24
- export declare const useLayers: <T>(compProps: CompProps<T>) => Layer<T>[];
package/dist/layers.js DELETED
@@ -1,149 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = 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);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.useLayers = exports.convertComponentTypesToLayersWithCache = exports.convertComponentTypesToLayers = void 0;
27
- const react_1 = __importStar(require("react"));
28
- const inputLayersToLayers = (layers) => {
29
- return layers.map((layer) => {
30
- if (layer.type === 'web') {
31
- return {
32
- component: react_1.default.lazy(() => Promise.resolve({ default: layer.component })),
33
- type: 'web',
34
- };
35
- }
36
- // No lazy for Video allowed!
37
- if (layer.type === 'video') {
38
- return {
39
- component: layer.component,
40
- type: 'video',
41
- };
42
- }
43
- // No lazy for SVG allowed!
44
- return {
45
- component: layer.component,
46
- type: 'svg',
47
- };
48
- });
49
- };
50
- const convertComponentTypesToLayers = (compProps) => {
51
- if ('component' in compProps) {
52
- // In SSR, suspense is not yet supported, we cannot use React.lazy
53
- if (typeof document === 'undefined') {
54
- return [
55
- {
56
- component: compProps.component,
57
- type: 'web',
58
- },
59
- ];
60
- }
61
- return [
62
- {
63
- component: react_1.default.lazy(() => Promise.resolve({ default: compProps.component })),
64
- type: 'web',
65
- },
66
- ];
67
- }
68
- if ('lazyComponent' in compProps) {
69
- return [
70
- {
71
- component: react_1.default.lazy(compProps.lazyComponent),
72
- type: 'web',
73
- },
74
- ];
75
- }
76
- if ('layers' in compProps) {
77
- return inputLayersToLayers(compProps.layers);
78
- }
79
- throw new Error('Unknown component type');
80
- };
81
- exports.convertComponentTypesToLayers = convertComponentTypesToLayers;
82
- const convertComponentTypesToLayersWithCache = (compProps, prevCompProps, prevReturnValue) => {
83
- if ('component' in compProps) {
84
- if (prevCompProps &&
85
- 'component' in prevCompProps &&
86
- compProps.component === prevCompProps.component &&
87
- prevReturnValue) {
88
- return prevReturnValue;
89
- }
90
- return [
91
- {
92
- type: 'web',
93
- component: react_1.default.lazy(() => Promise.resolve({ default: compProps.component })),
94
- },
95
- ];
96
- }
97
- if ('lazyComponent' in compProps) {
98
- if (prevCompProps &&
99
- 'lazyComponent' in prevCompProps &&
100
- compProps.lazyComponent === prevCompProps.lazyComponent &&
101
- prevReturnValue) {
102
- return prevReturnValue;
103
- }
104
- return [
105
- {
106
- type: 'web',
107
- component: react_1.default.lazy(compProps.lazyComponent),
108
- },
109
- ];
110
- }
111
- if ('layers' in compProps) {
112
- const isTheSame = () => {
113
- if (!prevCompProps) {
114
- return false;
115
- }
116
- if (!('layers' in prevCompProps)) {
117
- return false;
118
- }
119
- if (compProps.layers.length !== prevCompProps.layers.length) {
120
- return false;
121
- }
122
- for (let i = 0; i < compProps.layers.length; i++) {
123
- if (compProps.layers[i].component !== prevCompProps.layers[i].component) {
124
- return false;
125
- }
126
- if (compProps.layers[i].type !== prevCompProps.layers[i].type) {
127
- return false;
128
- }
129
- }
130
- return true;
131
- };
132
- if (isTheSame()) {
133
- return prevReturnValue;
134
- }
135
- return inputLayersToLayers(compProps.layers);
136
- }
137
- throw new Error('Unknown component type');
138
- };
139
- exports.convertComponentTypesToLayersWithCache = convertComponentTypesToLayersWithCache;
140
- const useLayers = (compProps) => {
141
- var _a, _b;
142
- const prevCompProps = (0, react_1.useRef)();
143
- const prevLayers = (0, react_1.useRef)();
144
- const layers = (0, exports.convertComponentTypesToLayersWithCache)(compProps, (_a = prevCompProps.current) !== null && _a !== void 0 ? _a : null, (_b = prevLayers.current) !== null && _b !== void 0 ? _b : null);
145
- prevCompProps.current = compProps;
146
- prevLayers.current = layers;
147
- return layers;
148
- };
149
- exports.useLayers = useLayers;
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- import type { RemotionMainVideoProps } from './props';
3
- export declare const NativeVideo: React.FC<{
4
- src: string;
5
- } & RemotionMainVideoProps>;
@@ -1,33 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NativeVideo = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = require("react");
6
- const get_environment_1 = require("../get-environment");
7
- const Sequence_1 = require("../Sequence");
8
- const validate_media_props_1 = require("../validate-media-props");
9
- const validate_start_from_props_1 = require("../validate-start-from-props");
10
- const NativeVideoForRendering_1 = require("./NativeVideoForRendering");
11
- const VideoForDevelopment_1 = require("./VideoForDevelopment");
12
- const NativeVideo = (props) => {
13
- const { startFrom, endAt, ...otherProps } = props;
14
- const onDuration = (0, react_1.useCallback)(() => undefined, []);
15
- if (typeof props.src !== 'string') {
16
- throw new TypeError(`The \`<NativeVideo>\` tag requires a string for \`src\`, but got ${JSON.stringify(props.src)} instead.`);
17
- }
18
- if (typeof startFrom !== 'undefined' || typeof endAt !== 'undefined') {
19
- (0, validate_start_from_props_1.validateStartFromProps)(startFrom, endAt);
20
- const startFromFrameNo = startFrom !== null && startFrom !== void 0 ? startFrom : 0;
21
- const endAtFrameNo = endAt !== null && endAt !== void 0 ? endAt : Infinity;
22
- 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.NativeVideo, { ...otherProps }) }));
23
- }
24
- (0, validate_media_props_1.validateMediaProps)(props, 'Video');
25
- if ((0, get_environment_1.getRemotionEnvironment)() === 'rendering') {
26
- throw new Error('Cannot render in the browser');
27
- }
28
- if ((0, get_environment_1.getRemotionEnvironment)() === 'server-rendering') {
29
- return (0, jsx_runtime_1.jsx)(NativeVideoForRendering_1.NativeVideoForRendering, { ...otherProps });
30
- }
31
- return ((0, jsx_runtime_1.jsx)(VideoForDevelopment_1.VideoForDevelopment, { onDuration: onDuration, onlyWarnForMediaSeekingError: true, ...otherProps }));
32
- };
33
- exports.NativeVideo = NativeVideo;
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- export declare type NativeVideoLayerInfo = {
3
- src: string;
4
- frame: number;
5
- };
6
- export declare const NativeVideoForRendering: React.FC<{
7
- src: string;
8
- }>;
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NativeVideoForRendering = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const use_current_frame_1 = require("../use-current-frame");
6
- const NativeVideoForRendering = ({ src }) => {
7
- const frame = (0, use_current_frame_1.useCurrentFrame)();
8
- return ((0, jsx_runtime_1.jsx)("div", {
9
- // eslint-disable-next-line react/no-danger
10
- dangerouslySetInnerHTML: {
11
- __html: JSON.stringify({ src, frame }),
12
- } }));
13
- };
14
- exports.NativeVideoForRendering = NativeVideoForRendering;