remotion 3.3.55 → 3.3.56

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 (143) hide show
  1. package/dist/cjs/audio/Audio.d.ts +1 -1
  2. package/dist/cjs/index.d.ts +1 -0
  3. package/dist/cjs/internals.d.ts +1 -1
  4. package/dist/cjs/use-video.d.ts +1 -1
  5. package/dist/cjs/version.d.ts +1 -1
  6. package/dist/cjs/version.js +1 -1
  7. package/dist/esm/index.mjs +1 -1
  8. package/dist/esm/version.mjs +1 -1
  9. package/dist/tsconfig-esm.tsbuildinfo +1 -0
  10. package/package.json +3 -3
  11. package/tsconfig-esm.json +12 -0
  12. package/dist/esm/AbsoluteFill.js +0 -25
  13. package/dist/esm/CanUseRemotionHooks.js +0 -6
  14. package/dist/esm/Clipper.js +0 -20
  15. package/dist/esm/Composition.js +0 -112
  16. package/dist/esm/CompositionManager.js +0 -137
  17. package/dist/esm/Folder.js +0 -33
  18. package/dist/esm/IFrame.js +0 -25
  19. package/dist/esm/Img.js +0 -53
  20. package/dist/esm/NativeLayers.js +0 -25
  21. package/dist/esm/Null.js +0 -21
  22. package/dist/esm/RemotionRoot.js +0 -69
  23. package/dist/esm/Sequence.js +0 -128
  24. package/dist/esm/SequenceContext.js +0 -2
  25. package/dist/esm/Still.js +0 -9
  26. package/dist/esm/absolute-src.js +0 -3
  27. package/dist/esm/asset-types.js +0 -1
  28. package/dist/esm/audio/Audio.js +0 -53
  29. package/dist/esm/audio/AudioForDevelopment.js +0 -91
  30. package/dist/esm/audio/AudioForRendering.js +0 -108
  31. package/dist/esm/audio/index.js +0 -2
  32. package/dist/esm/audio/props.js +0 -1
  33. package/dist/esm/audio/shared-audio-tags.js +0 -194
  34. package/dist/esm/audio/use-audio-frame.js +0 -18
  35. package/dist/esm/bezier.js +0 -110
  36. package/dist/esm/cancel-render.js +0 -43
  37. package/dist/esm/config/input-props.js +0 -27
  38. package/dist/esm/config.js +0 -17
  39. package/dist/esm/default-css.js +0 -44
  40. package/dist/esm/delay-render.js +0 -72
  41. package/dist/esm/easing.js +0 -77
  42. package/dist/esm/freeze.js +0 -34
  43. package/dist/esm/get-asset-file-name.js +0 -10
  44. package/dist/esm/get-environment.js +0 -29
  45. package/dist/esm/get-preview-dom-element.js +0 -3
  46. package/dist/esm/get-static-files.js +0 -31
  47. package/dist/esm/get-timeline-clip-name.js +0 -21
  48. package/dist/esm/index.js +0 -49
  49. package/dist/esm/internals.js +0 -75
  50. package/dist/esm/interpolate-colors.js +0 -401
  51. package/dist/esm/interpolate.js +0 -123
  52. package/dist/esm/is-approximately-the-same.js +0 -4
  53. package/dist/esm/is-player.js +0 -9
  54. package/dist/esm/loading-indicator.js +0 -31
  55. package/dist/esm/loop/index.js +0 -29
  56. package/dist/esm/multiple-versions-warning.js +0 -28
  57. package/dist/esm/nonce.js +0 -13
  58. package/dist/esm/play-and-handle-not-allowed-error.js +0 -40
  59. package/dist/esm/portal-node.js +0 -19
  60. package/dist/esm/prefetch-state.js +0 -22
  61. package/dist/esm/prefetch.js +0 -107
  62. package/dist/esm/random.js +0 -37
  63. package/dist/esm/register-root.js +0 -31
  64. package/dist/esm/series/flatten-children.js +0 -12
  65. package/dist/esm/series/index.js +0 -61
  66. package/dist/esm/setup-env-variables.js +0 -32
  67. package/dist/esm/spring/index.js +0 -50
  68. package/dist/esm/spring/measure-spring.js +0 -64
  69. package/dist/esm/spring/spring-utils.js +0 -99
  70. package/dist/esm/static-file.js +0 -29
  71. package/dist/esm/test/Img.test.js +0 -20
  72. package/dist/esm/test/absolute-src.test.js +0 -16
  73. package/dist/esm/test/audio-for-rendering.test.js +0 -83
  74. package/dist/esm/test/audio.test.js +0 -51
  75. package/dist/esm/test/bezier.test.js +0 -50
  76. package/dist/esm/test/composition-rules.test.js +0 -28
  77. package/dist/esm/test/composition-validation.test.js +0 -97
  78. package/dist/esm/test/easing.test.js +0 -189
  79. package/dist/esm/test/expect-to-throw.js +0 -11
  80. package/dist/esm/test/freeze.test.js +0 -63
  81. package/dist/esm/test/get-asset-file-name.test.js +0 -12
  82. package/dist/esm/test/get-current-time.test.js +0 -72
  83. package/dist/esm/test/input-props.test.js +0 -29
  84. package/dist/esm/test/interpolate.test.js +0 -136
  85. package/dist/esm/test/interpolateColors.test.js +0 -61
  86. package/dist/esm/test/loop-validation.test.js +0 -68
  87. package/dist/esm/test/measure-spring.test.js +0 -43
  88. package/dist/esm/test/media-validation.test.js +0 -45
  89. package/dist/esm/test/nested-sequences.test.js +0 -130
  90. package/dist/esm/test/not-all-props-in-media-tags.test.js +0 -28
  91. package/dist/esm/test/random.test.js +0 -58
  92. package/dist/esm/test/ready-manager.test.js +0 -27
  93. package/dist/esm/test/render-hook.js +0 -20
  94. package/dist/esm/test/sequence-from-initial-offset.test.js +0 -33
  95. package/dist/esm/test/sequence-validation.test.js +0 -45
  96. package/dist/esm/test/series.test.js +0 -113
  97. package/dist/esm/test/spring.test.js +0 -36
  98. package/dist/esm/test/truthy.test.js +0 -22
  99. package/dist/esm/test/use-audio-frame.test.js +0 -53
  100. package/dist/esm/test/use-media-in-timeline.test.js +0 -49
  101. package/dist/esm/test/use-media-tag-volume.test.js +0 -44
  102. package/dist/esm/test/use-sync-volume-with-media-tag.test.js +0 -53
  103. package/dist/esm/test/validate-start-from-props.test.js +0 -37
  104. package/dist/esm/test/video.test.js +0 -55
  105. package/dist/esm/test/volume-prop.test.js +0 -93
  106. package/dist/esm/test/wrap-sequence-context.js +0 -37
  107. package/dist/esm/timeline-position-state.js +0 -35
  108. package/dist/esm/truthy.js +0 -3
  109. package/dist/esm/use-current-frame.js +0 -23
  110. package/dist/esm/use-lazy-component.js +0 -22
  111. package/dist/esm/use-media-in-timeline.js +0 -125
  112. package/dist/esm/use-media-playback.js +0 -73
  113. package/dist/esm/use-media-tag-volume.js +0 -27
  114. package/dist/esm/use-sync-volume-with-media-tag.js +0 -17
  115. package/dist/esm/use-unsafe-video-config.js +0 -23
  116. package/dist/esm/use-video-config.js +0 -26
  117. package/dist/esm/use-video.js +0 -24
  118. package/dist/esm/validate-frame.js +0 -20
  119. package/dist/esm/validate-media-props.js +0 -20
  120. package/dist/esm/validate-start-from-props.js +0 -27
  121. package/dist/esm/validation/validate-composition-id.js +0 -8
  122. package/dist/esm/validation/validate-dimensions.js +0 -17
  123. package/dist/esm/validation/validate-duration-in-frames.js +0 -11
  124. package/dist/esm/validation/validate-folder-name.js +0 -14
  125. package/dist/esm/validation/validate-fps.js +0 -17
  126. package/dist/esm/validation/validate-offthreadvideo-image-format.js +0 -11
  127. package/dist/esm/validation/validation-spring-duration.js +0 -17
  128. package/dist/esm/version.js +0 -2
  129. package/dist/esm/video/OffthreadVideo.js +0 -33
  130. package/dist/esm/video/OffthreadVideoForRendering.js +0 -100
  131. package/dist/esm/video/Video.js +0 -51
  132. package/dist/esm/video/VideoForDevelopment.js +0 -110
  133. package/dist/esm/video/VideoForRendering.js +0 -200
  134. package/dist/esm/video/duration-state.js +0 -29
  135. package/dist/esm/video/get-current-time.js +0 -26
  136. package/dist/esm/video/index.js +0 -2
  137. package/dist/esm/video/props.js +0 -1
  138. package/dist/esm/video/video-fragment.js +0 -55
  139. package/dist/esm/video-config.js +0 -1
  140. package/dist/esm/volume-position-state.js +0 -27
  141. package/dist/esm/volume-prop.js +0 -20
  142. package/dist/esm/warn-about-non-seekable-media.js +0 -30
  143. package/dist/esm/wrap-remotion-context.js +0 -45
@@ -1,194 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import React, { createContext, createRef, useCallback, useContext, useInsertionEffect, useLayoutEffect, useMemo, useRef, useState, } from 'react';
3
- const EMPTY_AUDIO = 'data:audio/mp3;base64,/+MYxAAJcAV8AAgAABn//////+/gQ5BAMA+D4Pg+BAQBAEAwD4Pg+D4EBAEAQDAPg++hYBH///hUFQVBUFREDQNHmf///////+MYxBUGkAGIMAAAAP/29Xt6lUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV/+MYxDUAAANIAAAAAFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV';
4
- const compareProps = (obj1, obj2) => {
5
- const keysA = Object.keys(obj1).sort();
6
- const keysB = Object.keys(obj2).sort();
7
- if (keysA.length !== keysB.length) {
8
- return false;
9
- }
10
- for (let i = 0; i < keysA.length; i++) {
11
- // Not the same keys
12
- if (keysA[i] !== keysB[i]) {
13
- return false;
14
- }
15
- // Not the same values
16
- if (obj1[keysA[i]] !== obj2[keysB[i]]) {
17
- return false;
18
- }
19
- }
20
- return true;
21
- };
22
- const didPropChange = (key, newProp, prevProp) => {
23
- // /music.mp3 and http://localhost:3000/music.mp3 are the same
24
- if (key === 'src' &&
25
- !prevProp.startsWith('data:') &&
26
- !newProp.startsWith('data:')) {
27
- return (new URL(prevProp, window.location.origin).toString() !==
28
- new URL(newProp, window.location.origin).toString());
29
- }
30
- if (prevProp === newProp) {
31
- return false;
32
- }
33
- return true;
34
- };
35
- export const SharedAudioContext = createContext(null);
36
- export const SharedAudioContextProvider = ({ children, numberOfAudioTags }) => {
37
- const audios = useRef([]);
38
- const [initialNumberOfAudioTags] = useState(numberOfAudioTags);
39
- if (numberOfAudioTags !== initialNumberOfAudioTags) {
40
- throw new Error('The number of shared audio tags has changed dynamically. Once you have set this property, you cannot change it afterwards.');
41
- }
42
- const refs = useMemo(() => {
43
- return new Array(numberOfAudioTags).fill(true).map(() => {
44
- return { id: Math.random(), ref: createRef() };
45
- });
46
- }, [numberOfAudioTags]);
47
- const takenAudios = useRef(new Array(numberOfAudioTags).fill(false));
48
- const rerenderAudios = useCallback(() => {
49
- refs.forEach(({ ref, id }) => {
50
- var _a;
51
- const data = (_a = audios.current) === null || _a === void 0 ? void 0 : _a.find((a) => a.id === id);
52
- const { current } = ref;
53
- if (!current) {
54
- // Whole player has been unmounted, the refs don't exist anymore.
55
- // It is not an error anymore though
56
- return;
57
- }
58
- if (data === undefined) {
59
- current.src = EMPTY_AUDIO;
60
- return;
61
- }
62
- if (!data) {
63
- throw new TypeError('Expected audio data to be there');
64
- }
65
- Object.keys(data.props).forEach((key) => {
66
- // @ts-expect-error
67
- if (didPropChange(key, data.props[key], current[key])) {
68
- // @ts-expect-error
69
- current[key] = data.props[key];
70
- }
71
- });
72
- });
73
- }, [refs]);
74
- const registerAudio = useCallback((aud, audioId) => {
75
- var _a, _b;
76
- const found = (_a = audios.current) === null || _a === void 0 ? void 0 : _a.find((a) => a.audioId === audioId);
77
- if (found) {
78
- return found;
79
- }
80
- const firstFreeAudio = takenAudios.current.findIndex((a) => a === false);
81
- if (firstFreeAudio === -1) {
82
- throw new Error(`Tried to simultaneously mount ${numberOfAudioTags + 1} <Audio /> tags at the same time. With the current settings, the maximum amount of <Audio /> tags is limited to ${numberOfAudioTags} at the same time. Remotion pre-mounts silent audio tags to help avoid browser autoplay restrictions. See https://remotion.dev/docs/player/autoplay#use-the-numberofsharedaudiotags-property for more information on how to increase this limit.`);
83
- }
84
- const { id, ref } = refs[firstFreeAudio];
85
- const cloned = [...takenAudios.current];
86
- cloned[firstFreeAudio] = id;
87
- takenAudios.current = cloned;
88
- const newElem = {
89
- props: aud,
90
- id,
91
- el: ref,
92
- audioId,
93
- };
94
- (_b = audios.current) === null || _b === void 0 ? void 0 : _b.push(newElem);
95
- rerenderAudios();
96
- return newElem;
97
- }, [numberOfAudioTags, refs, rerenderAudios]);
98
- const unregisterAudio = useCallback((id) => {
99
- var _a;
100
- const cloned = [...takenAudios.current];
101
- const index = refs.findIndex((r) => r.id === id);
102
- if (index === -1) {
103
- throw new TypeError('Error occured in ');
104
- }
105
- cloned[index] = false;
106
- takenAudios.current = cloned;
107
- audios.current = (_a = audios.current) === null || _a === void 0 ? void 0 : _a.filter((a) => a.id !== id);
108
- rerenderAudios();
109
- }, [refs, rerenderAudios]);
110
- const updateAudio = useCallback(({ aud, audioId, id, }) => {
111
- var _a;
112
- let changed = false;
113
- audios.current = (_a = audios.current) === null || _a === void 0 ? void 0 : _a.map((prevA) => {
114
- if (prevA.id === id) {
115
- const isTheSame = compareProps(aud, prevA.props);
116
- if (isTheSame) {
117
- return prevA;
118
- }
119
- changed = true;
120
- return {
121
- ...prevA,
122
- props: aud,
123
- audioId,
124
- };
125
- }
126
- return prevA;
127
- });
128
- if (changed) {
129
- rerenderAudios();
130
- }
131
- }, [rerenderAudios]);
132
- const playAllAudios = useCallback(() => {
133
- refs.forEach((ref) => {
134
- var _a;
135
- (_a = ref.ref.current) === null || _a === void 0 ? void 0 : _a.play();
136
- });
137
- }, [refs]);
138
- const value = useMemo(() => {
139
- return {
140
- registerAudio,
141
- unregisterAudio,
142
- updateAudio,
143
- playAllAudios,
144
- numberOfAudioTags,
145
- };
146
- }, [
147
- numberOfAudioTags,
148
- playAllAudios,
149
- registerAudio,
150
- unregisterAudio,
151
- updateAudio,
152
- ]);
153
- return (_jsxs(SharedAudioContext.Provider, { value: value, children: [refs.map(({ id, ref }) => {
154
- return _jsx("audio", { ref: ref, src: EMPTY_AUDIO }, id);
155
- }), children] }));
156
- };
157
- export const useSharedAudio = (aud, audioId) => {
158
- const ctx = useContext(SharedAudioContext);
159
- /**
160
- * We work around this in React 18 so an audio tag will only register itself once
161
- */
162
- const [elem] = useState(() => {
163
- if (ctx && ctx.numberOfAudioTags > 0) {
164
- return ctx.registerAudio(aud, audioId);
165
- }
166
- return {
167
- el: React.createRef(),
168
- id: Math.random(),
169
- props: aud,
170
- audioId,
171
- };
172
- });
173
- /**
174
- * Effects in React 18 fire twice, and we are looking for a way to only fire it once.
175
- * - useInsertionEffect only fires once. If it's available we are in React 18.
176
- * - useLayoutEffect only fires once in React 17.
177
- */
178
- const effectToUse = useInsertionEffect !== null && useInsertionEffect !== void 0 ? useInsertionEffect : useLayoutEffect;
179
- if (typeof document !== 'undefined') {
180
- effectToUse(() => {
181
- if (ctx && ctx.numberOfAudioTags > 0) {
182
- ctx.updateAudio({ id: elem.id, aud, audioId });
183
- }
184
- }, [aud, ctx, elem.id, audioId]);
185
- effectToUse(() => {
186
- return () => {
187
- if (ctx && ctx.numberOfAudioTags > 0) {
188
- ctx.unregisterAudio(elem.id);
189
- }
190
- };
191
- }, [ctx, elem.id]);
192
- }
193
- return elem;
194
- };
@@ -1,18 +0,0 @@
1
- import { useContext } from 'react';
2
- import { SequenceContext } from '../SequenceContext.js';
3
- import { useCurrentFrame } from '../use-current-frame.js';
4
- export const useMediaStartsAt = () => {
5
- var _a;
6
- const parentSequence = useContext(SequenceContext);
7
- const startsAt = Math.min(0, (_a = parentSequence === null || parentSequence === void 0 ? void 0 : parentSequence.relativeFrom) !== null && _a !== void 0 ? _a : 0);
8
- return startsAt;
9
- };
10
- /**
11
- * When passing a function as the prop for `volume`,
12
- * we calculate the way more intuitive value for currentFrame
13
- */
14
- export const useFrameForVolumeProp = () => {
15
- const frame = useCurrentFrame();
16
- const startsAt = useMediaStartsAt();
17
- return frame + startsAt;
18
- };
@@ -1,110 +0,0 @@
1
- // Taken from https://github.com/facebook/react-native/blob/0b9ea60b4fee8cacc36e7160e31b91fc114dbc0d/Libraries/Animated/src/bezier.js
2
- const NEWTON_ITERATIONS = 4;
3
- const NEWTON_MIN_SLOPE = 0.001;
4
- const SUBDIVISION_PRECISION = 0.0000001;
5
- const SUBDIVISION_MAX_ITERATIONS = 10;
6
- const kSplineTableSize = 11;
7
- const kSampleStepSize = 1.0 / (kSplineTableSize - 1.0);
8
- const float32ArraySupported = typeof Float32Array === 'function';
9
- function a(aA1, aA2) {
10
- return 1.0 - 3.0 * aA2 + 3.0 * aA1;
11
- }
12
- function b(aA1, aA2) {
13
- return 3.0 * aA2 - 6.0 * aA1;
14
- }
15
- function c(aA1) {
16
- return 3.0 * aA1;
17
- }
18
- // Returns x(t) given t, x1, and x2, or y(t) given t, y1, and y2.
19
- function calcBezier(aT, aA1, aA2) {
20
- return ((a(aA1, aA2) * aT + b(aA1, aA2)) * aT + c(aA1)) * aT;
21
- }
22
- // Returns dx/dt given t, x1, and x2, or dy/dt given t, y1, and y2.
23
- function getSlope(aT, aA1, aA2) {
24
- return 3.0 * a(aA1, aA2) * aT * aT + 2.0 * b(aA1, aA2) * aT + c(aA1);
25
- }
26
- function binarySubdivide({ aX, _aA, _aB, mX1, mX2, }) {
27
- let currentX;
28
- let currentT;
29
- let i = 0;
30
- let aA = _aA;
31
- let aB = _aB;
32
- do {
33
- currentT = aA + (aB - aA) / 2.0;
34
- currentX = calcBezier(currentT, mX1, mX2) - aX;
35
- if (currentX > 0.0) {
36
- aB = currentT;
37
- }
38
- else {
39
- aA = currentT;
40
- }
41
- } while (Math.abs(currentX) > SUBDIVISION_PRECISION &&
42
- ++i < SUBDIVISION_MAX_ITERATIONS);
43
- return currentT;
44
- }
45
- function newtonRaphsonIterate(aX, _aGuessT, mX1, mX2) {
46
- let aGuessT = _aGuessT;
47
- for (let i = 0; i < NEWTON_ITERATIONS; ++i) {
48
- const currentSlope = getSlope(aGuessT, mX1, mX2);
49
- if (currentSlope === 0.0) {
50
- return aGuessT;
51
- }
52
- const currentX = calcBezier(aGuessT, mX1, mX2) - aX;
53
- aGuessT -= currentX / currentSlope;
54
- }
55
- return aGuessT;
56
- }
57
- export function bezier(mX1, mY1, mX2, mY2) {
58
- if (!(mX1 >= 0 && mX1 <= 1 && mX2 >= 0 && mX2 <= 1)) {
59
- throw new Error('bezier x values must be in [0, 1] range');
60
- }
61
- // Precompute samples table
62
- const sampleValues = float32ArraySupported
63
- ? new Float32Array(kSplineTableSize)
64
- : new Array(kSplineTableSize);
65
- if (mX1 !== mY1 || mX2 !== mY2) {
66
- for (let i = 0; i < kSplineTableSize; ++i) {
67
- sampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2);
68
- }
69
- }
70
- function getTForX(aX) {
71
- let intervalStart = 0.0;
72
- let currentSample = 1;
73
- const lastSample = kSplineTableSize - 1;
74
- for (; currentSample !== lastSample && sampleValues[currentSample] <= aX; ++currentSample) {
75
- intervalStart += kSampleStepSize;
76
- }
77
- --currentSample;
78
- // Interpolate to provide an initial guess for t
79
- const dist = (aX - sampleValues[currentSample]) /
80
- (sampleValues[currentSample + 1] - sampleValues[currentSample]);
81
- const guessForT = intervalStart + dist * kSampleStepSize;
82
- const initialSlope = getSlope(guessForT, mX1, mX2);
83
- if (initialSlope >= NEWTON_MIN_SLOPE) {
84
- return newtonRaphsonIterate(aX, guessForT, mX1, mX2);
85
- }
86
- if (initialSlope === 0.0) {
87
- return guessForT;
88
- }
89
- return binarySubdivide({
90
- aX,
91
- _aA: intervalStart,
92
- _aB: intervalStart + kSampleStepSize,
93
- mX1,
94
- mX2,
95
- });
96
- }
97
- return function (x) {
98
- if (mX1 === mY1 && mX2 === mY2) {
99
- return x; // linear
100
- }
101
- // Because JavaScript number are imprecise, we should guarantee the extremes are right.
102
- if (x === 0) {
103
- return 0;
104
- }
105
- if (x === 1) {
106
- return 1;
107
- }
108
- return calcBezier(getTForX(x), mY1, mY2);
109
- };
110
- }
@@ -1,43 +0,0 @@
1
- const isErrorLike = (err) => {
2
- if (err === null) {
3
- return false;
4
- }
5
- if (typeof err !== 'object') {
6
- return false;
7
- }
8
- if (!('stack' in err)) {
9
- return false;
10
- }
11
- // eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error
12
- // @ts-ignore we just asserted
13
- if (typeof err.stack !== 'string') {
14
- return false;
15
- }
16
- if (!('message' in err)) {
17
- return false;
18
- }
19
- // eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error
20
- // @ts-ignore we just asserted
21
- if (typeof err.message !== 'string') {
22
- return false;
23
- }
24
- return true;
25
- };
26
- /**
27
- * @description When you invoke this function, Remotion will stop rendering all the frames without any retries
28
- * @see [Documentation](https://www.remotion.dev/docs/cancel-render)
29
- */
30
- export function cancelRender(err) {
31
- let error;
32
- if (isErrorLike(err)) {
33
- error = err;
34
- }
35
- else if (typeof err === 'string') {
36
- error = Error(err);
37
- }
38
- else {
39
- error = Error('Rendering was cancelled');
40
- }
41
- window.remotion_cancelledError = error.stack;
42
- throw error;
43
- }
@@ -1,27 +0,0 @@
1
- import { getRemotionEnvironment } from '../get-environment.js';
2
- let didWarnSSRImport = false;
3
- const warnOnceSSRImport = () => {
4
- if (didWarnSSRImport) {
5
- return;
6
- }
7
- didWarnSSRImport = true;
8
- console.warn('Called `getInputProps()` on the server. This function is not available server-side and has returned an empty object.');
9
- console.warn("To hide this warning, don't call this function on the server:");
10
- console.warn(" typeof window === 'undefined' ? {} : getInputProps()");
11
- };
12
- export const getInputProps = () => {
13
- if (typeof window === 'undefined') {
14
- warnOnceSSRImport();
15
- return {};
16
- }
17
- if (getRemotionEnvironment() === 'player-development' ||
18
- getRemotionEnvironment() === 'player-production') {
19
- throw new Error('You cannot call `getInputProps()` from a <Player>. Instead, the props are available as React props from component that you passed as `component` prop.');
20
- }
21
- const param = window.remotion_inputProps;
22
- if (!param) {
23
- return {};
24
- }
25
- const parsed = JSON.parse(param);
26
- return parsed;
27
- };
@@ -1,17 +0,0 @@
1
- /**
2
- * The configuration has moved to @remotion/cli.
3
- * For the moment the type definitions are going to stay here
4
- */
5
- const conf = {};
6
- let enabled = false;
7
- export const Config = new Proxy(conf, {
8
- get(target, prop, receiver) {
9
- if (!enabled) {
10
- throw new Error('To use the Remotion config file, you need to have @remotion/cli installed.\n- Make sure that all versions of Remotion are the same.\n- Make sure that @remotion/cli is installed.\n- Make sure Config is imported from "@remotion/cli", not "remotion".');
11
- }
12
- return Reflect.get(target, prop, receiver);
13
- },
14
- });
15
- export const enableLegacyRemotionConfig = () => {
16
- enabled = true;
17
- };
@@ -1,44 +0,0 @@
1
- const injected = {};
2
- export const injectCSS = (css) => {
3
- // Skip in node
4
- if (typeof document === 'undefined') {
5
- return;
6
- }
7
- if (injected[css]) {
8
- return;
9
- }
10
- const head = document.head || document.getElementsByTagName('head')[0];
11
- const style = document.createElement('style');
12
- style.appendChild(document.createTextNode(css));
13
- head.prepend(style);
14
- injected[css] = true;
15
- };
16
- export const OFFTHREAD_VIDEO_CLASS_NAME = '__remotion_offthreadvideo';
17
- export const makeDefaultCSS = (scope, backgroundColor) => {
18
- if (!scope) {
19
- return `
20
- * {
21
- box-sizing: border-box;
22
- }
23
- body {
24
- margin: 0;
25
- background-color: ${backgroundColor};
26
- }
27
- .${OFFTHREAD_VIDEO_CLASS_NAME} {
28
- object-fit: contain;
29
- }
30
- `;
31
- }
32
- return `
33
- ${scope} * {
34
- box-sizing: border-box;
35
- }
36
- ${scope} *:-webkit-full-screen {
37
- width: 100%;
38
- height: 100%;
39
- }
40
- ${scope} .${OFFTHREAD_VIDEO_CLASS_NAME} {
41
- object-fit: contain;
42
- }
43
- `;
44
- };
@@ -1,72 +0,0 @@
1
- import { getRemotionEnvironment } from './get-environment.js';
2
- import { truthy } from './truthy.js';
3
- if (typeof window !== 'undefined') {
4
- window.ready = false;
5
- }
6
- let handles = [];
7
- const timeouts = {};
8
- export const DELAY_RENDER_CALLSTACK_TOKEN = 'The delayRender was called:';
9
- const defaultTimeout = 30000;
10
- /**
11
- * @description Call this function to tell Remotion to wait before capturing this frame until data has loaded. Use continueRender() to unblock the render.
12
- * @param label _optional_ A label to identify the call in case it does time out.
13
- * @returns {number} An identifier to be passed to continueRender().
14
- * @see [Documentation](https://www.remotion.dev/docs/delay-render)
15
- */
16
- export const delayRender = (label) => {
17
- var _a, _b, _c;
18
- if (typeof label !== 'string' && typeof label !== 'undefined') {
19
- throw new Error('The label parameter of delayRender() must be a string or undefined, got: ' +
20
- JSON.stringify(label));
21
- }
22
- const handle = Math.random();
23
- handles.push(handle);
24
- const called = (_b = (_a = Error().stack) === null || _a === void 0 ? void 0 : _a.replace(/^Error/g, '')) !== null && _b !== void 0 ? _b : '';
25
- if (getRemotionEnvironment() === 'rendering') {
26
- const timeoutToUse = typeof window === 'undefined'
27
- ? defaultTimeout
28
- : ((_c = window.remotion_puppeteerTimeout) !== null && _c !== void 0 ? _c : defaultTimeout) - 2000;
29
- timeouts[handle] = setTimeout(() => {
30
- const message = [
31
- `A delayRender()`,
32
- label ? `"${label}"` : null,
33
- `was called but not cleared after ${timeoutToUse}ms. See https://remotion.dev/docs/timeout for help.`,
34
- DELAY_RENDER_CALLSTACK_TOKEN,
35
- called,
36
- ]
37
- .filter(truthy)
38
- .join(' ');
39
- throw new Error(message);
40
- }, timeoutToUse);
41
- }
42
- if (typeof window !== 'undefined') {
43
- window.ready = false;
44
- }
45
- return handle;
46
- };
47
- /**
48
- * @description Unblock a render that has been blocked by delayRender()
49
- * @param handle The return value of delayRender().
50
- * @see [Documentation](https://www.remotion.dev/docs/continue-render)
51
- */
52
- export const continueRender = (handle) => {
53
- if (typeof handle === 'undefined') {
54
- throw new TypeError('The continueRender() method must be called with a parameter that is the return value of delayRender(). No value was passed.');
55
- }
56
- if (typeof handle !== 'number') {
57
- throw new TypeError('The parameter passed into continueRender() must be the return value of delayRender() which is a number. Got: ' +
58
- JSON.stringify(handle));
59
- }
60
- handles = handles.filter((h) => {
61
- if (h === handle) {
62
- if (getRemotionEnvironment() === 'rendering') {
63
- clearTimeout(timeouts[handle]);
64
- }
65
- return false;
66
- }
67
- return true;
68
- });
69
- if (handles.length === 0 && typeof window !== 'undefined') {
70
- window.ready = true;
71
- }
72
- };
@@ -1,77 +0,0 @@
1
- // Taken from https://github.com/facebook/react-native/blob/0b9ea60b4fee8cacc36e7160e31b91fc114dbc0d/Libraries/Animated/src/Easing.js
2
- import { bezier } from './bezier.js';
3
- /**
4
- * @description The Easing module implements common easing functions. You can use it with the interpolate() API.
5
- * @see [Documentation](https://www.remotion.dev/docs/easing)
6
- */
7
- export class Easing {
8
- static step0(n) {
9
- return n > 0 ? 1 : 0;
10
- }
11
- static step1(n) {
12
- return n >= 1 ? 1 : 0;
13
- }
14
- static linear(t) {
15
- return t;
16
- }
17
- static ease(t) {
18
- return Easing.bezier(0.42, 0, 1, 1)(t);
19
- }
20
- static quad(t) {
21
- return t * t;
22
- }
23
- static cubic(t) {
24
- return t * t * t;
25
- }
26
- static poly(n) {
27
- return (t) => t ** n;
28
- }
29
- static sin(t) {
30
- return 1 - Math.cos((t * Math.PI) / 2);
31
- }
32
- static circle(t) {
33
- return 1 - Math.sqrt(1 - t * t);
34
- }
35
- static exp(t) {
36
- return 2 ** (10 * (t - 1));
37
- }
38
- static elastic(bounciness = 1) {
39
- const p = bounciness * Math.PI;
40
- return (t) => 1 - Math.cos((t * Math.PI) / 2) ** 3 * Math.cos(t * p);
41
- }
42
- static back(s = 1.70158) {
43
- return (t) => t * t * ((s + 1) * t - s);
44
- }
45
- static bounce(t) {
46
- if (t < 1 / 2.75) {
47
- return 7.5625 * t * t;
48
- }
49
- if (t < 2 / 2.75) {
50
- const t2_ = t - 1.5 / 2.75;
51
- return 7.5625 * t2_ * t2_ + 0.75;
52
- }
53
- if (t < 2.5 / 2.75) {
54
- const t2_ = t - 2.25 / 2.75;
55
- return 7.5625 * t2_ * t2_ + 0.9375;
56
- }
57
- const t2 = t - 2.625 / 2.75;
58
- return 7.5625 * t2 * t2 + 0.984375;
59
- }
60
- static bezier(x1, y1, x2, y2) {
61
- return bezier(x1, y1, x2, y2);
62
- }
63
- static in(easing) {
64
- return easing;
65
- }
66
- static out(easing) {
67
- return (t) => 1 - easing(1 - t);
68
- }
69
- static inOut(easing) {
70
- return (t) => {
71
- if (t < 0.5) {
72
- return easing(t * 2) / 2;
73
- }
74
- return 1 - easing((1 - t) * 2) / 2;
75
- };
76
- }
77
- }
@@ -1,34 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useContext, useMemo } from 'react';
3
- import { SequenceContext } from './SequenceContext.js';
4
- import { TimelineContext } from './timeline-position-state.js';
5
- /**
6
- * @description This method freezes all of its children to the frame that you specify as a prop
7
- * @see [Documentation](https://www.remotion.dev/docs/freeze)
8
- */
9
- export const Freeze = ({ frame, children }) => {
10
- if (typeof frame === 'undefined') {
11
- throw new Error(`The <Freeze /> component requires a 'frame' prop, but none was passed.`);
12
- }
13
- if (typeof frame !== 'number') {
14
- throw new Error(`The 'frame' prop of <Freeze /> must be a number, but is of type ${typeof frame}`);
15
- }
16
- if (Number.isNaN(frame)) {
17
- throw new Error(`The 'frame' prop of <Freeze /> must be a real number, but it is NaN.`);
18
- }
19
- if (!Number.isFinite(frame)) {
20
- throw new Error(`The 'frame' prop of <Freeze /> must be a finite number, but it is ${frame}.`);
21
- }
22
- const context = useContext(TimelineContext);
23
- const value = useMemo(() => {
24
- return {
25
- ...context,
26
- playing: false,
27
- imperativePlaying: {
28
- current: false,
29
- },
30
- frame,
31
- };
32
- }, [context, frame]);
33
- return (_jsx(TimelineContext.Provider, { value: value, children: _jsx(SequenceContext.Provider, { value: null, children: children }) }));
34
- };
@@ -1,10 +0,0 @@
1
- export const getAssetDisplayName = (filename) => {
2
- if (/data:|blob:/.test(filename.substring(0, 5))) {
3
- return 'Data URL';
4
- }
5
- const splitted = filename
6
- .split('/')
7
- .map((s) => s.split('\\'))
8
- .flat(1);
9
- return splitted[splitted.length - 1];
10
- };
@@ -1,29 +0,0 @@
1
- import { useIsPlayer } from './is-player.js';
2
- export const getRemotionEnvironment = () => {
3
- if (process.env.NODE_ENV === 'production') {
4
- if (typeof window !== 'undefined' && window.remotion_isPlayer) {
5
- return 'player-production';
6
- }
7
- return 'rendering';
8
- }
9
- // The Vitest framework sets NODE_ENV as test.
10
- // Right now we don't need to treat it in a special
11
- // way which is good - defaulting to `rendering`.
12
- if (process.env.NODE_ENV === 'test') {
13
- return 'rendering';
14
- }
15
- if (typeof window !== 'undefined' && window.remotion_isPlayer) {
16
- return 'player-development';
17
- }
18
- return 'preview';
19
- };
20
- export const useRemotionEnvironment = () => {
21
- const isPlayer = useIsPlayer();
22
- if (isPlayer) {
23
- if (process.env.NODE_ENV === 'production') {
24
- return 'player-production';
25
- }
26
- return 'player-development';
27
- }
28
- return getRemotionEnvironment();
29
- };