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

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 (189) 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 +1 -1
  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.d.ts +7 -0
  60. package/dist/preload.js +83 -0
  61. package/dist/register-root.d.ts +2 -1
  62. package/dist/register-root.js +20 -5
  63. package/dist/series/index.d.ts +2 -2
  64. package/dist/series/index.js +4 -4
  65. package/dist/spring/index.d.ts +8 -4
  66. package/dist/spring/index.js +21 -6
  67. package/dist/spring/measure-spring.d.ts +1 -1
  68. package/dist/spring/measure-spring.js +1 -1
  69. package/dist/static-file.js +6 -0
  70. package/dist/timeline-position-state.d.ts +1 -1
  71. package/dist/{use-frame.d.ts → use-current-frame.d.ts} +0 -1
  72. package/dist/use-current-frame.js +28 -0
  73. package/dist/use-lazy-component.d.ts +3 -3
  74. package/dist/use-lazy-component.js +5 -1
  75. package/dist/use-media-in-timeline.d.ts +2 -2
  76. package/dist/use-media-in-timeline.js +10 -7
  77. package/dist/use-media-playback.d.ts +3 -2
  78. package/dist/use-media-playback.js +9 -6
  79. package/dist/use-media-tag-volume.d.ts +1 -1
  80. package/dist/use-sync-volume-with-media-tag.d.ts +2 -2
  81. package/dist/use-unsafe-video-config.d.ts +1 -1
  82. package/dist/use-unsafe-video-config.js +2 -2
  83. package/dist/use-video-config.d.ts +1 -1
  84. package/dist/use-video-config.js +6 -0
  85. package/dist/use-video.d.ts +13 -1
  86. package/dist/use-video.js +16 -3
  87. package/dist/validate-media-props.d.ts +4 -3
  88. package/dist/validation/validate-fps.d.ts +1 -1
  89. package/dist/validation/validate-fps.js +4 -1
  90. package/dist/validation/validate-offthreadvideo-image-format.d.ts +1 -0
  91. package/dist/validation/validate-offthreadvideo-image-format.js +15 -0
  92. package/dist/validation/validation-spring-duration.d.ts +1 -0
  93. package/dist/validation/validation-spring-duration.js +21 -0
  94. package/dist/version.d.ts +1 -0
  95. package/dist/version.js +5 -0
  96. package/dist/video/OffthreadVideo.d.ts +3 -0
  97. package/dist/video/OffthreadVideo.js +27 -0
  98. package/dist/video/OffthreadVideoForRendering.d.ts +3 -0
  99. package/dist/video/OffthreadVideoForRendering.js +101 -0
  100. package/dist/video/Video.d.ts +3 -3
  101. package/dist/video/Video.js +4 -4
  102. package/dist/video/VideoForDevelopment.d.ts +7 -2
  103. package/dist/video/VideoForDevelopment.js +28 -4
  104. package/dist/video/VideoForRendering.d.ts +5 -2
  105. package/dist/video/VideoForRendering.js +62 -40
  106. package/dist/video/get-current-time.d.ts +7 -1
  107. package/dist/video/get-current-time.js +17 -9
  108. package/dist/video/index.d.ts +3 -2
  109. package/dist/video/index.js +5 -12
  110. package/dist/video/props.d.ts +13 -2
  111. package/dist/volume-prop.js +1 -1
  112. package/dist/warn-about-non-seekable-media.d.ts +1 -1
  113. package/dist/warn-about-non-seekable-media.js +14 -2
  114. package/dist/wrap-remotion-context.d.ts +2 -1
  115. package/dist/wrap-remotion-context.js +12 -4
  116. package/ensure-correct-version.js +24 -0
  117. package/package.json +10 -11
  118. package/version.d.ts +1 -0
  119. package/version.js +1 -0
  120. package/dist/compress-assets.d.ts +0 -7
  121. package/dist/compress-assets.js +0 -25
  122. package/dist/config/browser-executable.d.ts +0 -3
  123. package/dist/config/browser-executable.js +0 -12
  124. package/dist/config/browser.d.ts +0 -4
  125. package/dist/config/browser.js +0 -19
  126. package/dist/config/chromium-flags.d.ts +0 -10
  127. package/dist/config/chromium-flags.js +0 -34
  128. package/dist/config/codec.d.ts +0 -17
  129. package/dist/config/codec.js +0 -103
  130. package/dist/config/concurrency.d.ts +0 -3
  131. package/dist/config/concurrency.js +0 -15
  132. package/dist/config/crf.d.ts +0 -9
  133. package/dist/config/crf.js +0 -83
  134. package/dist/config/env-file.d.ts +0 -2
  135. package/dist/config/env-file.js +0 -10
  136. package/dist/config/ffmpeg-executable.d.ts +0 -3
  137. package/dist/config/ffmpeg-executable.js +0 -12
  138. package/dist/config/frame-range.d.ts +0 -5
  139. package/dist/config/frame-range.js +0 -80
  140. package/dist/config/image-format.d.ts +0 -8
  141. package/dist/config/image-format.js +0 -37
  142. package/dist/config/image-sequence.d.ts +0 -3
  143. package/dist/config/image-sequence.js +0 -15
  144. package/dist/config/index.js +0 -175
  145. package/dist/config/log.d.ts +0 -7
  146. package/dist/config/log.js +0 -25
  147. package/dist/config/max-timeline-tracks.d.ts +0 -2
  148. package/dist/config/max-timeline-tracks.js +0 -24
  149. package/dist/config/override-webpack.d.ts +0 -12
  150. package/dist/config/override-webpack.js +0 -14
  151. package/dist/config/overwrite.d.ts +0 -3
  152. package/dist/config/overwrite.js +0 -14
  153. package/dist/config/pixel-format.d.ts +0 -8
  154. package/dist/config/pixel-format.js +0 -38
  155. package/dist/config/preview-server.d.ts +0 -2
  156. package/dist/config/preview-server.js +0 -20
  157. package/dist/config/prores-profile.d.ts +0 -7
  158. package/dist/config/prores-profile.js +0 -32
  159. package/dist/config/quality.d.ts +0 -2
  160. package/dist/config/quality.js +0 -17
  161. package/dist/config/scale.d.ts +0 -3
  162. package/dist/config/scale.js +0 -15
  163. package/dist/config/still-frame.d.ts +0 -2
  164. package/dist/config/still-frame.js +0 -12
  165. package/dist/config/timeout.d.ts +0 -2
  166. package/dist/config/timeout.js +0 -17
  167. package/dist/config/webpack-caching.d.ts +0 -3
  168. package/dist/config/webpack-caching.js +0 -16
  169. package/dist/feature-flags.d.ts +0 -1
  170. package/dist/feature-flags.js +0 -7
  171. package/dist/initial-frame.d.ts +0 -2
  172. package/dist/initial-frame.js +0 -12
  173. package/dist/is-audio-codec.d.ts +0 -2
  174. package/dist/is-audio-codec.js +0 -7
  175. package/dist/perf/index.d.ts +0 -5
  176. package/dist/perf/index.js +0 -33
  177. package/dist/timeline-inout-position-state.d.ts +0 -12
  178. package/dist/timeline-inout-position-state.js +0 -23
  179. package/dist/timeout.d.ts +0 -2
  180. package/dist/timeout.js +0 -12
  181. package/dist/use-frame.js +0 -25
  182. package/dist/validation/validate-frame.d.ts +0 -1
  183. package/dist/validation/validate-frame.js +0 -24
  184. package/dist/validation/validate-image-format.d.ts +0 -2
  185. package/dist/validation/validate-image-format.js +0 -9
  186. package/dist/validation/validate-opengl-renderer.d.ts +0 -4
  187. package/dist/validation/validate-opengl-renderer.js +0 -14
  188. package/dist/validation/validate-quality.d.ts +0 -1
  189. package/dist/validation/validate-quality.js +0 -21
@@ -1,14 +1,7 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
- };
12
2
  Object.defineProperty(exports, "__esModule", { value: true });
13
- __exportStar(require("./props"), exports);
14
- __exportStar(require("./Video"), exports);
3
+ exports.Video = exports.OffthreadVideo = void 0;
4
+ var OffthreadVideo_1 = require("./OffthreadVideo");
5
+ Object.defineProperty(exports, "OffthreadVideo", { enumerable: true, get: function () { return OffthreadVideo_1.OffthreadVideo; } });
6
+ var Video_1 = require("./Video");
7
+ Object.defineProperty(exports, "Video", { enumerable: true, get: function () { return Video_1.Video; } });
@@ -1,5 +1,5 @@
1
- /// <reference types="react" />
2
- import { VolumeProp } from '../volume-prop';
1
+ import type React from 'react';
2
+ import type { VolumeProp } from '../volume-prop';
3
3
  export declare type RemotionMainVideoProps = {
4
4
  startFrom?: number;
5
5
  endAt?: number;
@@ -8,3 +8,14 @@ export declare type RemotionVideoProps = Omit<React.DetailedHTMLProps<React.Vide
8
8
  volume?: VolumeProp;
9
9
  playbackRate?: number;
10
10
  };
11
+ export declare type OffthreadVideoImageFormat = 'png' | 'jpeg';
12
+ export declare type OffthreadVideoProps = {
13
+ src: string;
14
+ className?: string;
15
+ style?: React.CSSProperties;
16
+ volume?: VolumeProp;
17
+ playbackRate?: number;
18
+ muted?: boolean;
19
+ onError?: React.ReactEventHandler<HTMLVideoElement | HTMLImageElement>;
20
+ imageFormat?: OffthreadVideoImageFormat;
21
+ };
@@ -18,6 +18,6 @@ const evaluateVolume = ({ frame, volume, mediaVolume = 1, }) => {
18
18
  if (!Number.isFinite(evaluated)) {
19
19
  throw new TypeError(`You passed in a function to the volume prop but it returned a non-finite number for frame ${frame}.`);
20
20
  }
21
- return Math.min(1, evaluated);
21
+ return Math.max(0, Math.min(1, evaluated));
22
22
  };
23
23
  exports.evaluateVolume = evaluateVolume;
@@ -1 +1 @@
1
- export declare const warnAboutNonSeekableMedia: (ref: HTMLMediaElement) => void;
1
+ export declare const warnAboutNonSeekableMedia: (ref: HTMLMediaElement | null, type: 'console-warning' | 'console-error' | 'exception') => void;
@@ -2,8 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.warnAboutNonSeekableMedia = void 0;
4
4
  const alreadyWarned = {};
5
- const warnAboutNonSeekableMedia = (ref) => {
5
+ const warnAboutNonSeekableMedia = (ref, type) => {
6
6
  // Media is not loaded yet, but this does not yet mean something is wrong with the media
7
+ if (ref === null) {
8
+ return;
9
+ }
7
10
  if (ref.seekable.length === 0) {
8
11
  return;
9
12
  }
@@ -15,7 +18,16 @@ const warnAboutNonSeekableMedia = (ref) => {
15
18
  }
16
19
  const range = { start: ref.seekable.start(0), end: ref.seekable.end(0) };
17
20
  if (range.start === 0 && range.end === 0) {
18
- console.error('The media', ref.src, 'does not seem to support seeking. Remotion cannot properly handle it. Please see https://remotion.dev/docs/non-seekable-media for assistance.');
21
+ const msg = `The media does not support seeking. Remotion cannot properly render it. Please see https://remotion.dev/docs/non-seekable-media for assistance. Source: ${ref.src}`;
22
+ if (type === 'console-error') {
23
+ console.error(msg);
24
+ }
25
+ else if (type === 'console-warning') {
26
+ console.warn(`The media ${ref.src} does not support seeking. The video will render fine, but may not play correctly in preview and in the <Player>. See https://remotion.dev/docs/non-seekable-media for an explanation.`);
27
+ }
28
+ else {
29
+ throw new Error(msg);
30
+ }
19
31
  alreadyWarned[ref.src] = true;
20
32
  }
21
33
  };
@@ -3,8 +3,9 @@ export declare function useRemotionContexts(): {
3
3
  compositionManagerCtx: import("./CompositionManager").CompositionManagerContext;
4
4
  timelineContext: import("./timeline-position-state").TimelineContextValue;
5
5
  setTimelineContext: import("./timeline-position-state").SetTimelineContextValue;
6
- sequenceContext: import("./sequencing").SequenceContextType | null;
6
+ sequenceContext: import("./Sequence").SequenceContextType | null;
7
7
  nonceContext: import("./nonce").TNonceContext;
8
+ canUseRemotionHooksContext: boolean;
8
9
  };
9
10
  export interface RemotionContextProviderProps {
10
11
  contexts: ReturnType<typeof useRemotionContexts>;
@@ -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];
@@ -25,33 +29,37 @@ const jsx_runtime_1 = require("react/jsx-runtime");
25
29
  // such as in React Three Fiber. All the contexts need to be passed again
26
30
  // for them to be useable
27
31
  const react_1 = __importStar(require("react"));
32
+ const CanUseRemotionHooks_1 = require("./CanUseRemotionHooks");
28
33
  const CompositionManager_1 = require("./CompositionManager");
29
34
  const nonce_1 = require("./nonce");
30
- const sequencing_1 = require("./sequencing");
35
+ const Sequence_1 = require("./Sequence");
31
36
  const timeline_position_state_1 = require("./timeline-position-state");
32
37
  function useRemotionContexts() {
33
38
  const compositionManagerCtx = react_1.default.useContext(CompositionManager_1.CompositionManager);
34
39
  const timelineContext = react_1.default.useContext(timeline_position_state_1.TimelineContext);
35
40
  const setTimelineContext = react_1.default.useContext(timeline_position_state_1.SetTimelineContext);
36
- const sequenceContext = react_1.default.useContext(sequencing_1.SequenceContext);
41
+ const sequenceContext = react_1.default.useContext(Sequence_1.SequenceContext);
37
42
  const nonceContext = react_1.default.useContext(nonce_1.NonceContext);
43
+ const canUseRemotionHooksContext = react_1.default.useContext(CanUseRemotionHooks_1.CanUseRemotionHooks);
38
44
  return (0, react_1.useMemo)(() => ({
39
45
  compositionManagerCtx,
40
46
  timelineContext,
41
47
  setTimelineContext,
42
48
  sequenceContext,
43
49
  nonceContext,
50
+ canUseRemotionHooksContext,
44
51
  }), [
45
52
  compositionManagerCtx,
46
53
  nonceContext,
47
54
  sequenceContext,
48
55
  setTimelineContext,
49
56
  timelineContext,
57
+ canUseRemotionHooksContext,
50
58
  ]);
51
59
  }
52
60
  exports.useRemotionContexts = useRemotionContexts;
53
61
  const RemotionContextProvider = (props) => {
54
62
  const { children, contexts } = props;
55
- return ((0, jsx_runtime_1.jsx)(nonce_1.NonceContext.Provider, { value: contexts.nonceContext, children: (0, jsx_runtime_1.jsx)(CompositionManager_1.CompositionManager.Provider, { value: contexts.compositionManagerCtx, children: (0, jsx_runtime_1.jsx)(timeline_position_state_1.TimelineContext.Provider, { value: contexts.timelineContext, children: (0, jsx_runtime_1.jsx)(timeline_position_state_1.SetTimelineContext.Provider, { value: contexts.setTimelineContext, children: (0, jsx_runtime_1.jsx)(sequencing_1.SequenceContext.Provider, { value: contexts.sequenceContext, children: children }, void 0) }, void 0) }, void 0) }, void 0) }, void 0));
63
+ return ((0, jsx_runtime_1.jsx)(CanUseRemotionHooks_1.CanUseRemotionHooks.Provider, { value: contexts.canUseRemotionHooksContext, children: (0, jsx_runtime_1.jsx)(nonce_1.NonceContext.Provider, { value: contexts.nonceContext, children: (0, jsx_runtime_1.jsx)(CompositionManager_1.CompositionManager.Provider, { value: contexts.compositionManagerCtx, children: (0, jsx_runtime_1.jsx)(timeline_position_state_1.TimelineContext.Provider, { value: contexts.timelineContext, children: (0, jsx_runtime_1.jsx)(timeline_position_state_1.SetTimelineContext.Provider, { value: contexts.setTimelineContext, children: (0, jsx_runtime_1.jsx)(Sequence_1.SequenceContext.Provider, { value: contexts.sequenceContext, children: children }) }) }) }) }) }));
56
64
  };
57
65
  exports.RemotionContextProvider = RemotionContextProvider;
@@ -0,0 +1,24 @@
1
+ const path = require('node:path');
2
+ const fs = require('node:fs');
3
+ const cp = require('node:child_process');
4
+
5
+ const packageJson = JSON.parse(fs.readFileSync('package.json'));
6
+ const {version} = packageJson;
7
+ const src =
8
+ `
9
+ // Automatically generated on publish
10
+ export const VERSION = '${version}';
11
+ `.trim() + '\n';
12
+
13
+ fs.writeFileSync(path.resolve(process.cwd(), 'src/version.ts'), src);
14
+
15
+ cp.execSync('pnpm exec tsc');
16
+
17
+ const distFile = fs.readFileSync('dist/version.js', 'utf-8');
18
+
19
+ if (!distFile.includes(version)) {
20
+ console.log('In dist file, did not include version');
21
+ process.exit(1);
22
+ }
23
+
24
+ console.log('Updated version to v' + version);
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "remotion",
3
- "version": "4.0.0-oops.3+31c506229",
3
+ "version": "4.0.0-prefetch.7+47cce0679",
4
4
  "description": "Render videos in React",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "sideEffects": false,
8
8
  "scripts": {
9
+ "prepublish": "node ensure-correct-version.js && cp ../../README.md .",
9
10
  "lint": "eslint src --ext ts,tsx",
10
- "test": "jest --coverage && node generate-badges.js",
11
+ "test": "vitest --run",
11
12
  "build": "tsc -d",
12
- "watch": "tsc -w",
13
- "prerelease": "cp ../../README.md ."
13
+ "watch": "tsc -w"
14
14
  },
15
15
  "repository": {
16
16
  "url": "https://github.com/remotion-dev/remotion"
@@ -25,23 +25,22 @@
25
25
  "react-dom": ">=16.8.0"
26
26
  },
27
27
  "devDependencies": {
28
- "@jonny/eslint-config": "3.0.259",
29
- "@testing-library/react": "13.1.1",
30
- "@types/jest": "^27.4.0",
28
+ "@jonny/eslint-config": "3.0.266",
29
+ "@testing-library/react": "13.3.0",
31
30
  "@types/node": "^16.7.5",
32
31
  "@types/react": "18.0.1",
33
32
  "@types/react-dom": "18.0.0",
34
33
  "@types/webpack-env": "^1.16.0",
34
+ "@vitejs/plugin-react": "^2.0.0",
35
35
  "eslint": "8.13.0",
36
- "jest": "^27.2.4",
37
36
  "prettier": "^2.0.5",
38
37
  "prettier-plugin-organize-imports": "^2.3.4",
39
38
  "react": "^18.0.0",
40
39
  "react-dom": "^18.0.0",
41
40
  "react-test-renderer": "^18.0.0",
42
41
  "rimraf": "^3.0.2",
43
- "ts-jest": "^27.0.5",
44
- "typescript": "^4.5.5",
42
+ "typescript": "^4.7.0",
43
+ "vitest": "^0.18.0",
45
44
  "webpack": "5.72.0"
46
45
  },
47
46
  "keywords": [
@@ -55,5 +54,5 @@
55
54
  "publishConfig": {
56
55
  "access": "public"
57
56
  },
58
- "gitHead": "31c506229ccf43f67dee263b0edce90ebbb2e22e"
57
+ "gitHead": "47cce06799563fb244ff25b211ea4055389bd7de"
59
58
  }
package/version.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './dist/version';
package/version.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('./dist/version');
@@ -1,7 +0,0 @@
1
- import { TAsset } from './CompositionManager';
2
- /**
3
- * Since audio or video can be base64-encoded, those can be really long strings.
4
- * Since we track the `src` property for every frame, Node.JS can run out of memory easily. Instead of duplicating the src for every frame, we save memory by replacing the full base 64 encoded data with a string `same-as-[asset-id]-[frame]` referencing a previous asset with the same src.
5
- */
6
- export declare const compressAsset: (previousAssets: TAsset[], newAsset: TAsset) => TAsset;
7
- export declare const isAssetCompressed: (src: string) => boolean;
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isAssetCompressed = exports.compressAsset = void 0;
4
- /**
5
- * Since audio or video can be base64-encoded, those can be really long strings.
6
- * Since we track the `src` property for every frame, Node.JS can run out of memory easily. Instead of duplicating the src for every frame, we save memory by replacing the full base 64 encoded data with a string `same-as-[asset-id]-[frame]` referencing a previous asset with the same src.
7
- */
8
- const compressAsset = (previousAssets, newAsset) => {
9
- if (newAsset.src.length < 400) {
10
- return newAsset;
11
- }
12
- const assetWithSameSrc = previousAssets.find((a) => a.src === newAsset.src);
13
- if (!assetWithSameSrc) {
14
- return newAsset;
15
- }
16
- return {
17
- ...newAsset,
18
- src: `same-as-${assetWithSameSrc.id}-${assetWithSameSrc.frame}`,
19
- };
20
- };
21
- exports.compressAsset = compressAsset;
22
- const isAssetCompressed = (src) => {
23
- return src.startsWith('same-as');
24
- };
25
- exports.isAssetCompressed = isAssetCompressed;
@@ -1,3 +0,0 @@
1
- export declare type BrowserExecutable = string | null;
2
- export declare const setBrowserExecutable: (newBrowserExecutablePath: BrowserExecutable) => void;
3
- export declare const getBrowserExecutable: () => BrowserExecutable;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getBrowserExecutable = exports.setBrowserExecutable = void 0;
4
- let currentBrowserExecutablePath = null;
5
- const setBrowserExecutable = (newBrowserExecutablePath) => {
6
- currentBrowserExecutablePath = newBrowserExecutablePath;
7
- };
8
- exports.setBrowserExecutable = setBrowserExecutable;
9
- const getBrowserExecutable = () => {
10
- return currentBrowserExecutablePath;
11
- };
12
- exports.getBrowserExecutable = getBrowserExecutable;
@@ -1,4 +0,0 @@
1
- export declare type Browser = 'chrome' | 'firefox';
2
- export declare const DEFAULT_BROWSER: Browser;
3
- export declare const setBrowser: (browser: Browser) => void;
4
- export declare const getBrowser: () => Browser | null;
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getBrowser = exports.setBrowser = exports.DEFAULT_BROWSER = void 0;
4
- exports.DEFAULT_BROWSER = 'chrome';
5
- let currentBrowser = null;
6
- const setBrowser = (browser) => {
7
- if (browser === 'chrome') {
8
- process.env.PUPPETEER_PRODUCT = 'chrome';
9
- }
10
- if (browser === 'firefox') {
11
- process.env.PUPPETEER_PRODUCT = 'firefox';
12
- }
13
- currentBrowser = browser;
14
- };
15
- exports.setBrowser = setBrowser;
16
- const getBrowser = () => {
17
- return currentBrowser;
18
- };
19
- exports.getBrowser = getBrowser;
@@ -1,10 +0,0 @@
1
- import { OpenGlRenderer } from '../validation/validate-opengl-renderer';
2
- export declare const DEFAULT_OPENGL_RENDERER: OpenGlRenderer | null;
3
- export declare const getChromiumDisableWebSecurity: () => boolean;
4
- export declare const setChromiumDisableWebSecurity: (should: boolean) => void;
5
- export declare const getIgnoreCertificateErrors: () => boolean;
6
- export declare const setChromiumIgnoreCertificateErrors: (should: boolean) => void;
7
- export declare const getChromiumOpenGlRenderer: () => "angle" | "egl" | "swiftshader" | null;
8
- export declare const setChromiumOpenGlRenderer: (renderer: OpenGlRenderer) => void;
9
- export declare const getChromiumHeadlessMode: () => boolean;
10
- export declare const setChromiumHeadlessMode: (should: boolean) => void;
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setChromiumHeadlessMode = exports.getChromiumHeadlessMode = exports.setChromiumOpenGlRenderer = exports.getChromiumOpenGlRenderer = exports.setChromiumIgnoreCertificateErrors = exports.getIgnoreCertificateErrors = exports.setChromiumDisableWebSecurity = exports.getChromiumDisableWebSecurity = exports.DEFAULT_OPENGL_RENDERER = void 0;
4
- const validate_opengl_renderer_1 = require("../validation/validate-opengl-renderer");
5
- exports.DEFAULT_OPENGL_RENDERER = null;
6
- let chromiumDisableWebSecurity = false;
7
- let ignoreCertificateErrors = false;
8
- let openGlRenderer = exports.DEFAULT_OPENGL_RENDERER;
9
- let headlessMode = true;
10
- const getChromiumDisableWebSecurity = () => chromiumDisableWebSecurity;
11
- exports.getChromiumDisableWebSecurity = getChromiumDisableWebSecurity;
12
- const setChromiumDisableWebSecurity = (should) => {
13
- chromiumDisableWebSecurity = should;
14
- };
15
- exports.setChromiumDisableWebSecurity = setChromiumDisableWebSecurity;
16
- const getIgnoreCertificateErrors = () => ignoreCertificateErrors;
17
- exports.getIgnoreCertificateErrors = getIgnoreCertificateErrors;
18
- const setChromiumIgnoreCertificateErrors = (should) => {
19
- ignoreCertificateErrors = should;
20
- };
21
- exports.setChromiumIgnoreCertificateErrors = setChromiumIgnoreCertificateErrors;
22
- const getChromiumOpenGlRenderer = () => openGlRenderer;
23
- exports.getChromiumOpenGlRenderer = getChromiumOpenGlRenderer;
24
- const setChromiumOpenGlRenderer = (renderer) => {
25
- (0, validate_opengl_renderer_1.validateOpenGlRenderer)(renderer);
26
- openGlRenderer = renderer;
27
- };
28
- exports.setChromiumOpenGlRenderer = setChromiumOpenGlRenderer;
29
- const getChromiumHeadlessMode = () => headlessMode;
30
- exports.getChromiumHeadlessMode = getChromiumHeadlessMode;
31
- const setChromiumHeadlessMode = (should) => {
32
- headlessMode = should;
33
- };
34
- exports.setChromiumHeadlessMode = setChromiumHeadlessMode;
@@ -1,17 +0,0 @@
1
- declare const validCodecs: readonly ["h264", "h265", "vp8", "vp9", "mp3", "aac", "wav", "prores", "h264-mkv"];
2
- export declare type Codec = typeof validCodecs[number];
3
- export declare type CodecOrUndefined = Codec | undefined;
4
- declare const validLegacyFormats: readonly ["mp4", "png-sequence"];
5
- declare type LegacyFormat = typeof validLegacyFormats[number];
6
- declare let codec: CodecOrUndefined;
7
- export declare const getOutputCodecOrUndefined: () => CodecOrUndefined;
8
- export declare const DEFAULT_CODEC: Codec;
9
- export declare const getFinalOutputCodec: ({ codec: inputCodec, fileExtension, emitWarning, isLambda, }: {
10
- codec: CodecOrUndefined;
11
- fileExtension: string | null;
12
- emitWarning: boolean;
13
- isLambda: boolean;
14
- }) => Codec;
15
- export declare const setOutputFormat: (newLegacyFormat: LegacyFormat) => void;
16
- export declare const setCodec: (newCodec: CodecOrUndefined) => void;
17
- export {};
@@ -1,103 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setCodec = exports.setOutputFormat = exports.getFinalOutputCodec = exports.DEFAULT_CODEC = exports.getOutputCodecOrUndefined = void 0;
4
- const validCodecs = [
5
- 'h264',
6
- 'h265',
7
- 'vp8',
8
- 'vp9',
9
- 'mp3',
10
- 'aac',
11
- 'wav',
12
- 'prores',
13
- 'h264-mkv',
14
- ];
15
- const validLegacyFormats = ['mp4', 'png-sequence'];
16
- let codec;
17
- const getOutputCodecOrUndefined = () => {
18
- return codec;
19
- };
20
- exports.getOutputCodecOrUndefined = getOutputCodecOrUndefined;
21
- exports.DEFAULT_CODEC = 'h264';
22
- const DEFAULT_LAMBDA_CODEC = 'h264-mkv';
23
- const getFinalOutputCodec = ({ codec: inputCodec, fileExtension, emitWarning, isLambda, }) => {
24
- if (inputCodec === undefined && fileExtension === 'webm') {
25
- if (emitWarning) {
26
- console.info('You have specified a .webm extension, using the VP8 encoder. Use --codec=vp9 to use the Vp9 encoder.');
27
- }
28
- return 'vp8';
29
- }
30
- if (inputCodec === undefined && fileExtension === 'hevc') {
31
- if (emitWarning) {
32
- console.info('You have specified a .hevc extension, using the H265 encoder.');
33
- }
34
- return 'h265';
35
- }
36
- if (inputCodec === undefined && fileExtension === 'mp3') {
37
- if (emitWarning) {
38
- console.info('You have specified a .mp3 extension, using the MP3 encoder.');
39
- }
40
- return 'mp3';
41
- }
42
- if (inputCodec === undefined && fileExtension === 'mov') {
43
- if (emitWarning) {
44
- console.info('You have specified a .mov extension, using the Apple ProRes encoder.');
45
- }
46
- return 'prores';
47
- }
48
- if (inputCodec === undefined && fileExtension === 'wav') {
49
- if (emitWarning) {
50
- console.info('You have specified a .wav extension, using the WAV encoder.');
51
- }
52
- return 'wav';
53
- }
54
- if (inputCodec === undefined && fileExtension === 'aac') {
55
- if (emitWarning) {
56
- console.info('You have specified a .aac extension, using the AAC encoder.');
57
- }
58
- return 'aac';
59
- }
60
- if (inputCodec === undefined && fileExtension === 'm4a') {
61
- if (emitWarning) {
62
- console.info('You have specified a .m4a extension, using the AAC encoder.');
63
- }
64
- return 'aac';
65
- }
66
- if (inputCodec === undefined && fileExtension === 'mkv') {
67
- if (emitWarning) {
68
- console.info('You have specified a .mkv extension, using the H264 encoder and WAV audio format.');
69
- }
70
- return 'h264-mkv';
71
- }
72
- return inputCodec !== null && inputCodec !== void 0 ? inputCodec : (isLambda ? DEFAULT_LAMBDA_CODEC : exports.DEFAULT_CODEC);
73
- };
74
- exports.getFinalOutputCodec = getFinalOutputCodec;
75
- const setOutputFormat = (newLegacyFormat) => {
76
- if (newLegacyFormat === undefined) {
77
- codec = undefined;
78
- return;
79
- }
80
- if (!validLegacyFormats.includes(newLegacyFormat)) {
81
- throw new Error(`Output format must be one of the following: ${validLegacyFormats.join(', ')}, but got ${newLegacyFormat}`);
82
- }
83
- console.warn('setOutputFormat() is deprecated. Use the setCodec() and setImageSequence() instead.');
84
- if (newLegacyFormat === 'mp4') {
85
- codec = 'h264';
86
- return;
87
- }
88
- if (newLegacyFormat === 'png-sequence') {
89
- codec = undefined;
90
- }
91
- };
92
- exports.setOutputFormat = setOutputFormat;
93
- const setCodec = (newCodec) => {
94
- if (newCodec === undefined) {
95
- codec = undefined;
96
- return;
97
- }
98
- if (!validCodecs.includes(newCodec)) {
99
- throw new Error(`Codec must be one of the following: ${validCodecs.join(', ')}, but got ${newCodec}`);
100
- }
101
- codec = newCodec;
102
- };
103
- exports.setCodec = setCodec;
@@ -1,3 +0,0 @@
1
- export declare type Concurrency = number | null;
2
- export declare const setConcurrency: (newConcurrency: Concurrency) => void;
3
- export declare const getConcurrency: () => number | null;
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getConcurrency = exports.setConcurrency = void 0;
4
- let currentConcurrency = null;
5
- const setConcurrency = (newConcurrency) => {
6
- if (typeof newConcurrency !== 'number') {
7
- throw new Error('--concurrency flag must be a number.');
8
- }
9
- currentConcurrency = newConcurrency;
10
- };
11
- exports.setConcurrency = setConcurrency;
12
- const getConcurrency = () => {
13
- return currentConcurrency;
14
- };
15
- exports.getConcurrency = getConcurrency;
@@ -1,9 +0,0 @@
1
- import { Codec } from './codec';
2
- declare type Crf = number | undefined;
3
- export declare const setCrf: (newCrf: Crf) => void;
4
- export declare const getCrfOrUndefined: () => Crf;
5
- export declare const getDefaultCrfForCodec: (codec: Codec) => number;
6
- export declare const getValidCrfRanges: (codec: Codec) => [number, number];
7
- export declare const validateSelectedCrfAndCodecCombination: (crf: unknown, codec: Codec) => void;
8
- export declare const getActualCrf: (codec: Codec) => number;
9
- export {};
@@ -1,83 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getActualCrf = exports.validateSelectedCrfAndCodecCombination = exports.getValidCrfRanges = exports.getDefaultCrfForCodec = exports.getCrfOrUndefined = exports.setCrf = void 0;
4
- const is_audio_codec_1 = require("../is-audio-codec");
5
- let currentCrf;
6
- const setCrf = (newCrf) => {
7
- if (typeof newCrf !== 'number' && newCrf !== undefined) {
8
- throw new TypeError('The CRF must be a number or undefined.');
9
- }
10
- currentCrf = newCrf;
11
- };
12
- exports.setCrf = setCrf;
13
- const getCrfOrUndefined = () => {
14
- return currentCrf;
15
- };
16
- exports.getCrfOrUndefined = getCrfOrUndefined;
17
- const getDefaultCrfForCodec = (codec) => {
18
- if ((0, is_audio_codec_1.isAudioCodec)(codec)) {
19
- return 0;
20
- }
21
- if (codec === 'h264' || codec === 'h264-mkv') {
22
- return 18; // FFMPEG default 23
23
- }
24
- if (codec === 'h265') {
25
- return 23; // FFMPEG default 28
26
- }
27
- if (codec === 'vp8') {
28
- return 9; // FFMPEG default 10
29
- }
30
- if (codec === 'vp9') {
31
- return 28; // FFMPEG recommendation 31
32
- }
33
- if (codec === 'prores') {
34
- return 0;
35
- }
36
- throw new TypeError(`Got unexpected codec "${codec}"`);
37
- };
38
- exports.getDefaultCrfForCodec = getDefaultCrfForCodec;
39
- const getValidCrfRanges = (codec) => {
40
- if ((0, is_audio_codec_1.isAudioCodec)(codec)) {
41
- return [0, 0];
42
- }
43
- if (codec === 'prores') {
44
- return [0, 0];
45
- }
46
- if (codec === 'h264' || codec === 'h264-mkv') {
47
- return [1, 51];
48
- }
49
- if (codec === 'h265') {
50
- return [0, 51];
51
- }
52
- if (codec === 'vp8') {
53
- return [4, 63];
54
- }
55
- if (codec === 'vp9') {
56
- return [0, 63];
57
- }
58
- throw new TypeError(`Got unexpected codec "${codec}"`);
59
- };
60
- exports.getValidCrfRanges = getValidCrfRanges;
61
- const validateSelectedCrfAndCodecCombination = (crf, codec) => {
62
- if (crf === null) {
63
- return;
64
- }
65
- if (typeof crf !== 'number') {
66
- throw new TypeError('Expected CRF to be a number, but is ' + JSON.stringify(crf));
67
- }
68
- const range = (0, exports.getValidCrfRanges)(codec);
69
- if (crf === 0 && (codec === 'h264' || codec === 'h264-mkv')) {
70
- throw new TypeError("Setting the CRF to 0 with a H264 codec is not supported anymore because of it's inconsistencies between platforms. Videos with CRF 0 cannot be played on iOS/macOS. 0 is a extreme value with inefficient settings which you probably want. Set CRF to a higher value to fix this error.");
71
- }
72
- if (crf < range[0] || crf > range[1]) {
73
- throw new TypeError(`CRF must be between ${range[0]} and ${range[1]} for codec ${codec}. Passed: ${crf}`);
74
- }
75
- };
76
- exports.validateSelectedCrfAndCodecCombination = validateSelectedCrfAndCodecCombination;
77
- const getActualCrf = (codec) => {
78
- var _a;
79
- const crf = (_a = (0, exports.getCrfOrUndefined)()) !== null && _a !== void 0 ? _a : (0, exports.getDefaultCrfForCodec)(codec);
80
- (0, exports.validateSelectedCrfAndCodecCombination)(crf, codec);
81
- return crf;
82
- };
83
- exports.getActualCrf = getActualCrf;
@@ -1,2 +0,0 @@
1
- export declare const setDotEnvLocation: (file: string) => void;
2
- export declare const getDotEnvLocation: () => string | null;
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getDotEnvLocation = exports.setDotEnvLocation = void 0;
4
- let envFile = null;
5
- const setDotEnvLocation = (file) => {
6
- envFile = file;
7
- };
8
- exports.setDotEnvLocation = setDotEnvLocation;
9
- const getDotEnvLocation = () => envFile;
10
- exports.getDotEnvLocation = getDotEnvLocation;
@@ -1,3 +0,0 @@
1
- export declare type FfmpegExecutable = string | null;
2
- export declare const setFfmpegExecutable: (ffmpegPath: FfmpegExecutable) => void;
3
- export declare const getCustomFfmpegExecutable: () => FfmpegExecutable;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getCustomFfmpegExecutable = exports.setFfmpegExecutable = void 0;
4
- let currentFfmpegExecutablePath = null;
5
- const setFfmpegExecutable = (ffmpegPath) => {
6
- currentFfmpegExecutablePath = ffmpegPath;
7
- };
8
- exports.setFfmpegExecutable = setFfmpegExecutable;
9
- const getCustomFfmpegExecutable = () => {
10
- return currentFfmpegExecutablePath;
11
- };
12
- exports.getCustomFfmpegExecutable = getCustomFfmpegExecutable;