remotion 4.0.363 → 4.0.365

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/Img.js CHANGED
@@ -110,34 +110,27 @@ const ImgRefForwarding = ({ onError, maxRetries = 2, src, pauseWhenLoading, dela
110
110
  onImageFrame === null || onImageFrame === void 0 ? void 0 : onImageFrame(current);
111
111
  }
112
112
  unblock();
113
- requestAnimationFrame(() => {
114
- continueRender(newHandle);
115
- });
113
+ continueRender(newHandle);
116
114
  };
117
115
  if (!imageRef.current) {
118
116
  onComplete();
119
117
  return;
120
118
  }
121
119
  current.src = actualSrc;
122
- if (current.complete) {
123
- onComplete();
124
- }
125
- else {
126
- current
127
- .decode()
128
- .then(onComplete)
129
- .catch((err) => {
130
- // fall back to onload event if decode() fails
131
- // eslint-disable-next-line no-console
132
- console.warn(err);
133
- if (current.complete) {
134
- onComplete();
135
- }
136
- else {
137
- current.addEventListener('load', onComplete);
138
- }
139
- });
140
- }
120
+ current
121
+ .decode()
122
+ .then(onComplete)
123
+ .catch((err) => {
124
+ // fall back to onload event if decode() fails
125
+ // eslint-disable-next-line no-console
126
+ console.warn(err);
127
+ if (current.complete) {
128
+ onComplete();
129
+ }
130
+ else {
131
+ current.addEventListener('load', onComplete);
132
+ }
133
+ });
141
134
  // If tag gets unmounted, clear pending handles because image is not going to load
142
135
  return () => {
143
136
  unmounted = true;
@@ -163,7 +156,7 @@ const ImgRefForwarding = ({ onError, maxRetries = 2, src, pauseWhenLoading, dela
163
156
  requestsVideoFrame: false,
164
157
  });
165
158
  // src gets set once we've loaded and decoded the image.
166
- return ((0, jsx_runtime_1.jsx)("img", { ...props, ref: imageRef, crossOrigin: crossOriginValue, onError: didGetError }));
159
+ return ((0, jsx_runtime_1.jsx)("img", { ...props, ref: imageRef, crossOrigin: crossOriginValue, onError: didGetError, decoding: "sync" }));
167
160
  };
168
161
  /*
169
162
  * @description Works just like a regular HTML img tag. When you use the <Img> tag, Remotion will ensure that the image is loaded before rendering the frame.
@@ -5,12 +5,12 @@ const cancel_render_js_1 = require("./cancel-render.js");
5
5
  const get_remotion_environment_js_1 = require("./get-remotion-environment.js");
6
6
  const log_js_1 = require("./log.js");
7
7
  const truthy_js_1 = require("./truthy.js");
8
- if (typeof window !== 'undefined') {
9
- window.remotion_renderReady = false;
10
- }
11
8
  let handles = [];
12
9
  if (typeof window !== 'undefined') {
13
- window.remotion_delayRenderTimeouts = {};
10
+ window.remotion_renderReady = false;
11
+ if (!window.remotion_delayRenderTimeouts) {
12
+ window.remotion_delayRenderTimeouts = {};
13
+ }
14
14
  }
15
15
  exports.DELAY_RENDER_CALLSTACK_TOKEN = 'The delayRender was called:';
16
16
  exports.DELAY_RENDER_RETRIES_LEFT = 'Retries left: ';
@@ -57,12 +57,15 @@ const Freeze = ({ frame: frameToFreeze, children, active = true, }) => {
57
57
  if (!sequenceContext) {
58
58
  return null;
59
59
  }
60
+ if (!isActive) {
61
+ return sequenceContext;
62
+ }
60
63
  return {
61
64
  ...sequenceContext,
62
65
  relativeFrom: 0,
63
66
  cumulatedFrom: 0,
64
67
  };
65
- }, [sequenceContext]);
68
+ }, [sequenceContext, isActive]);
66
69
  return ((0, jsx_runtime_1.jsx)(timeline_position_state_js_1.TimelineContext.Provider, { value: timelineValue, children: (0, jsx_runtime_1.jsx)(SequenceContext_js_1.SequenceContext.Provider, { value: newSequenceContext, children: children }) }));
67
70
  };
68
71
  exports.Freeze = Freeze;
@@ -356,5 +356,19 @@ export declare const Internals: {
356
356
  readonly setInputPropsOverride: (override: Record<string, unknown> | null) => void;
357
357
  readonly useVideoEnabled: () => boolean;
358
358
  readonly useAudioEnabled: () => boolean;
359
+ readonly useIsPlayerBuffering: (bufferManager: {
360
+ addBlock: (block: {
361
+ id: string;
362
+ }) => {
363
+ unblock: () => void;
364
+ };
365
+ listenForBuffering: (callback: () => void) => {
366
+ remove: () => void;
367
+ };
368
+ listenForResume: (callback: () => void) => {
369
+ remove: () => void;
370
+ };
371
+ buffering: React.MutableRefObject<boolean>;
372
+ }) => boolean;
359
373
  };
360
374
  export type { CompositionManagerContext, CompProps, LoggingContextValue, MediaVolumeContextValue, RemotionEnvironment, SerializedJSONWithCustomFields, SetMediaVolumeContextValue, SetTimelineContextValue, TCompMetadata, TComposition, TimelineContextValue, TRenderAsset, TSequence, WatchRemotionStaticFilesPayload, };
@@ -182,4 +182,5 @@ exports.Internals = {
182
182
  setInputPropsOverride: input_props_override_js_1.setInputPropsOverride,
183
183
  useVideoEnabled: use_media_enabled_js_1.useVideoEnabled,
184
184
  useAudioEnabled: use_media_enabled_js_1.useAudioEnabled,
185
+ useIsPlayerBuffering: buffering_js_1.useIsPlayerBuffering,
185
186
  };
@@ -52,7 +52,7 @@ const validateTrimProps = (trimBefore, trimAfter) => {
52
52
  throw new TypeError(`trimAfter must be a positive number, instead got ${trimAfter}.`);
53
53
  }
54
54
  }
55
- if (trimAfter < trimBefore) {
55
+ if (trimAfter <= trimBefore) {
56
56
  throw new TypeError('trimAfter prop must be greater than trimBefore prop.');
57
57
  }
58
58
  };
@@ -3,4 +3,4 @@
3
3
  * @see [Documentation](https://remotion.dev/docs/version)
4
4
  * @returns {string} The current version of the remotion package
5
5
  */
6
- export declare const VERSION = "4.0.363";
6
+ export declare const VERSION = "4.0.365";
@@ -7,4 +7,4 @@ exports.VERSION = void 0;
7
7
  * @see [Documentation](https://remotion.dev/docs/version)
8
8
  * @returns {string} The current version of the remotion package
9
9
  */
10
- exports.VERSION = '4.0.363';
10
+ exports.VERSION = '4.0.365';
@@ -110,7 +110,7 @@ function truthy(value) {
110
110
  }
111
111
 
112
112
  // src/version.ts
113
- var VERSION = "4.0.363";
113
+ var VERSION = "4.0.365";
114
114
 
115
115
  // src/multiple-versions-warning.ts
116
116
  var checkMultipleRemotionVersions = () => {
@@ -1367,12 +1367,15 @@ var Freeze = ({
1367
1367
  if (!sequenceContext) {
1368
1368
  return null;
1369
1369
  }
1370
+ if (!isActive) {
1371
+ return sequenceContext;
1372
+ }
1370
1373
  return {
1371
1374
  ...sequenceContext,
1372
1375
  relativeFrom: 0,
1373
1376
  cumulatedFrom: 0
1374
1377
  };
1375
- }, [sequenceContext]);
1378
+ }, [sequenceContext, isActive]);
1376
1379
  return /* @__PURE__ */ jsx7(TimelineContext.Provider, {
1377
1380
  value: timelineValue,
1378
1381
  children: /* @__PURE__ */ jsx7(SequenceContext.Provider, {
@@ -1711,12 +1714,12 @@ var Log = {
1711
1714
  };
1712
1715
 
1713
1716
  // src/delay-render.ts
1714
- if (typeof window !== "undefined") {
1715
- window.remotion_renderReady = false;
1716
- }
1717
1717
  var handles = [];
1718
1718
  if (typeof window !== "undefined") {
1719
- window.remotion_delayRenderTimeouts = {};
1719
+ window.remotion_renderReady = false;
1720
+ if (!window.remotion_delayRenderTimeouts) {
1721
+ window.remotion_delayRenderTimeouts = {};
1722
+ }
1720
1723
  }
1721
1724
  var DELAY_RENDER_CALLSTACK_TOKEN = "The delayRender was called:";
1722
1725
  var DELAY_RENDER_RETRIES_LEFT = "Retries left: ";
@@ -2697,7 +2700,7 @@ var validateTrimProps = (trimBefore, trimAfter) => {
2697
2700
  throw new TypeError(`trimAfter must be a positive number, instead got ${trimAfter}.`);
2698
2701
  }
2699
2702
  }
2700
- if (trimAfter < trimBefore) {
2703
+ if (trimAfter <= trimBefore) {
2701
2704
  throw new TypeError("trimAfter prop must be greater than trimBefore prop.");
2702
2705
  }
2703
2706
  };
@@ -5687,27 +5690,21 @@ var ImgRefForwarding = ({
5687
5690
  onImageFrame?.(current);
5688
5691
  }
5689
5692
  unblock();
5690
- requestAnimationFrame(() => {
5691
- continueRender2(newHandle);
5692
- });
5693
+ continueRender2(newHandle);
5693
5694
  };
5694
5695
  if (!imageRef.current) {
5695
5696
  onComplete();
5696
5697
  return;
5697
5698
  }
5698
5699
  current.src = actualSrc;
5699
- if (current.complete) {
5700
- onComplete();
5701
- } else {
5702
- current.decode().then(onComplete).catch((err) => {
5703
- console.warn(err);
5704
- if (current.complete) {
5705
- onComplete();
5706
- } else {
5707
- current.addEventListener("load", onComplete);
5708
- }
5709
- });
5710
- }
5700
+ current.decode().then(onComplete).catch((err) => {
5701
+ console.warn(err);
5702
+ if (current.complete) {
5703
+ onComplete();
5704
+ } else {
5705
+ current.addEventListener("load", onComplete);
5706
+ }
5707
+ });
5711
5708
  return () => {
5712
5709
  unmounted = true;
5713
5710
  current.removeEventListener("load", onComplete);
@@ -5735,7 +5732,8 @@ var ImgRefForwarding = ({
5735
5732
  ...props2,
5736
5733
  ref: imageRef,
5737
5734
  crossOrigin: crossOriginValue,
5738
- onError: didGetError
5735
+ onError: didGetError,
5736
+ decoding: "sync"
5739
5737
  });
5740
5738
  };
5741
5739
  var Img = forwardRef8(ImgRefForwarding);
@@ -7056,7 +7054,8 @@ var Internals = {
7056
7054
  getInputPropsOverride,
7057
7055
  setInputPropsOverride,
7058
7056
  useVideoEnabled,
7059
- useAudioEnabled
7057
+ useAudioEnabled,
7058
+ useIsPlayerBuffering
7060
7059
  };
7061
7060
  // src/interpolate-colors.ts
7062
7061
  var NUMBER = "[-+]?\\d*\\.?\\d+";
@@ -139,9 +139,9 @@ function truthy(value) {
139
139
  // src/delay-render.ts
140
140
  if (typeof window !== "undefined") {
141
141
  window.remotion_renderReady = false;
142
- }
143
- if (typeof window !== "undefined") {
144
- window.remotion_delayRenderTimeouts = {};
142
+ if (!window.remotion_delayRenderTimeouts) {
143
+ window.remotion_delayRenderTimeouts = {};
144
+ }
145
145
  }
146
146
  var DELAY_RENDER_CALLSTACK_TOKEN = "The delayRender was called:";
147
147
  var DELAY_RENDER_RETRIES_LEFT = "Retries left: ";
@@ -1,5 +1,5 @@
1
1
  // src/version.ts
2
- var VERSION = "4.0.363";
2
+ var VERSION = "4.0.365";
3
3
  export {
4
4
  VERSION
5
5
  };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/core"
4
4
  },
5
5
  "name": "remotion",
6
- "version": "4.0.363",
6
+ "version": "4.0.365",
7
7
  "description": "Make videos programmatically",
8
8
  "main": "dist/cjs/index.js",
9
9
  "types": "dist/cjs/index.d.ts",
@@ -34,7 +34,7 @@
34
34
  "react-dom": "19.0.0",
35
35
  "webpack": "5.96.1",
36
36
  "zod": "3.22.3",
37
- "@remotion/eslint-config-internal": "4.0.363",
37
+ "@remotion/eslint-config-internal": "4.0.365",
38
38
  "eslint": "9.19.0"
39
39
  },
40
40
  "keywords": [
package/bundle.ts DELETED
@@ -1,52 +0,0 @@
1
- import {build, semver, version} from 'bun';
2
-
3
- if (process.env.NODE_ENV !== 'production') {
4
- throw new Error('This script must be run using NODE_ENV=production');
5
- }
6
-
7
- if (!semver.satisfies(version, '^1.1.7')) {
8
- // eslint-disable-next-line no-console
9
- console.error(
10
- `There is a bug with bundling when using Bun <1.1.7. You use ${version}. Please use a newer version`,
11
- );
12
- process.exit(1);
13
- }
14
-
15
- const output = await build({
16
- entrypoints: ['src/index.ts'],
17
- naming: '[name].mjs',
18
- target: 'browser',
19
- external: ['remotion', 'remotion/no-react', 'react', 'react-dom'],
20
- });
21
-
22
- const [file] = output.outputs;
23
- const text = await file.text();
24
- await Bun.write('dist/esm/index.mjs', text);
25
-
26
- const versionOutput = await build({
27
- entrypoints: ['src/version.ts'],
28
- naming: '[name].mjs',
29
- target: 'browser',
30
- });
31
-
32
- const [versionFile] = versionOutput.outputs;
33
- await Bun.write('dist/esm/version.mjs', await versionFile.text());
34
-
35
- const noReactOutput = await build({
36
- entrypoints: ['src/no-react.ts'],
37
- naming: '[name].mjs',
38
- target: 'browser',
39
- external: ['remotion', 'react', 'react-dom'],
40
- });
41
- const [noReactFile] = noReactOutput.outputs;
42
- const noReactText = await noReactFile.text();
43
-
44
- if (noReactText.includes('createContext')) {
45
- throw new Error('remotion/no-react.mjs should not import React');
46
- }
47
-
48
- await Bun.write('dist/esm/no-react.mjs', noReactText);
49
-
50
- export {};
51
-
52
- console.log('Done.');
@@ -1,48 +0,0 @@
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
-
11
- /**
12
- * @description Provides the current version number of the Remotion library.
13
- * @see [Documentation](https://remotion.dev/docs/version)
14
- * @returns {string} The current version of the remotion package
15
- */
16
- export const VERSION = '${version}';
17
- `.trim() + '\n';
18
-
19
- fs.writeFileSync(path.resolve(process.cwd(), 'src/version.ts'), src);
20
-
21
- cp.execSync('bun run make');
22
- cp.execSync('bun x tsc -d');
23
-
24
- const distFile = fs.readFileSync('dist/esm/version.mjs', 'utf-8');
25
-
26
- if (!distFile.includes(version)) {
27
- console.log('In dist file, did not include ' + JSON.stringify(version));
28
- process.exit(1);
29
- }
30
-
31
- const distFileCjs = fs.readFileSync('dist/cjs/version.js', 'utf-8');
32
-
33
- if (!distFileCjs.includes(version)) {
34
- console.log('In dist file, did not include ' + JSON.stringify(version));
35
- process.exit(1);
36
- }
37
-
38
- console.log('Updated version to v' + version);
39
-
40
- const wrongDistFileExists = fs.existsSync('dist/index.js', 'utf-8');
41
- if (wrongDistFileExists) {
42
- throw new Error('Wrong dist file exists');
43
- }
44
-
45
- const wrongDistFileExists2 = fs.existsSync('dist/index.mjs', 'utf-8');
46
- if (wrongDistFileExists2) {
47
- throw new Error('Wrong dist file exists');
48
- }
package/eslint.config.mjs DELETED
@@ -1,11 +0,0 @@
1
- import {remotionFlatConfig} from '@remotion/eslint-config-internal';
2
-
3
- const config = remotionFlatConfig({react: true});
4
-
5
- export default {
6
- ...config,
7
- rules: {
8
- ...config.rules,
9
- 'no-console': 'error',
10
- },
11
- };
package/happydom.ts DELETED
@@ -1,6 +0,0 @@
1
- import {GlobalRegistrator} from '@happy-dom/global-registrator';
2
-
3
- GlobalRegistrator.register();
4
- window.origin = 'http://localhost:3000';
5
- // @ts-expect-error
6
- window.remotion_staticBase = '/static-abcdef';
package/test.ts DELETED
@@ -1 +0,0 @@
1
- import 'whatwg-mimetype';