remotion 4.0.322 → 4.0.324

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.
@@ -88,21 +88,24 @@ const useBufferManager = (logLevel, mountTime) => {
88
88
  // and trigger again
89
89
  // eslint-disable-next-line react-hooks/exhaustive-deps
90
90
  }, [blocks]);
91
- (0, react_1.useLayoutEffect)(() => {
92
- if (blocks.length === 0) {
93
- onResumeCallbacks.forEach((c) => c());
94
- (0, playback_logging_1.playbackLogging)({
95
- logLevel,
96
- message: 'Player is exiting buffer state',
97
- mountTime,
98
- tag: 'player',
99
- });
100
- }
101
- // Intentionally only firing when blocks change, not the callbacks
102
- // otherwise a resume callback might remove itself after being called
103
- // and trigger again
104
- // eslint-disable-next-line react-hooks/exhaustive-deps
105
- }, [blocks]);
91
+ if (typeof window !== 'undefined') {
92
+ // eslint-disable-next-line react-hooks/rules-of-hooks
93
+ (0, react_1.useLayoutEffect)(() => {
94
+ if (blocks.length === 0) {
95
+ onResumeCallbacks.forEach((c) => c());
96
+ (0, playback_logging_1.playbackLogging)({
97
+ logLevel,
98
+ message: 'Player is exiting buffer state',
99
+ mountTime,
100
+ tag: 'player',
101
+ });
102
+ }
103
+ // Intentionally only firing when blocks change, not the callbacks
104
+ // otherwise a resume callback might remove itself after being called
105
+ // and trigger again
106
+ // eslint-disable-next-line react-hooks/exhaustive-deps
107
+ }, [blocks]);
108
+ }
106
109
  return (0, react_1.useMemo)(() => {
107
110
  return { addBlock, listenForBuffering, listenForResume, buffering };
108
111
  }, [addBlock, buffering, listenForBuffering, listenForResume]);
@@ -30,41 +30,44 @@ const useVolume = ({ mediaRef, volume, logLevel, source, shouldUseWebAudioApi, }
30
30
  throw new Error('useAmplification must be used within a SharedAudioContext');
31
31
  }
32
32
  const { audioContext } = sharedAudioContext;
33
- (0, react_1.useLayoutEffect)(() => {
34
- var _a, _b;
35
- if (!audioContext) {
36
- return;
37
- }
38
- if (!mediaRef.current) {
39
- return;
40
- }
41
- if (!shouldUseWebAudioApi) {
42
- return;
43
- }
44
- // [1]
45
- if (mediaRef.current.playbackRate !== 1 && (0, video_fragment_1.isSafari)()) {
46
- warnSafariOnce(logLevel);
47
- return;
48
- }
49
- if (!source) {
50
- return;
51
- }
52
- const gainNode = new GainNode(audioContext, {
53
- gain: currentVolumeRef.current,
54
- });
55
- source.attemptToConnect();
56
- source.get().connect(gainNode);
57
- gainNode.connect(audioContext.destination);
58
- audioStuffRef.current = {
59
- gainNode,
60
- };
61
- log_1.Log.trace(logLevel, `Starting to amplify ${(_a = mediaRef.current) === null || _a === void 0 ? void 0 : _a.src}. Gain = ${currentVolumeRef.current}, playbackRate = ${(_b = mediaRef.current) === null || _b === void 0 ? void 0 : _b.playbackRate}`);
62
- return () => {
63
- audioStuffRef.current = null;
64
- gainNode.disconnect();
65
- source.get().disconnect();
66
- };
67
- }, [logLevel, mediaRef, audioContext, source, shouldUseWebAudioApi]);
33
+ if (typeof window !== 'undefined') {
34
+ // eslint-disable-next-line react-hooks/rules-of-hooks
35
+ (0, react_1.useLayoutEffect)(() => {
36
+ var _a, _b;
37
+ if (!audioContext) {
38
+ return;
39
+ }
40
+ if (!mediaRef.current) {
41
+ return;
42
+ }
43
+ if (!shouldUseWebAudioApi) {
44
+ return;
45
+ }
46
+ // [1]
47
+ if (mediaRef.current.playbackRate !== 1 && (0, video_fragment_1.isSafari)()) {
48
+ warnSafariOnce(logLevel);
49
+ return;
50
+ }
51
+ if (!source) {
52
+ return;
53
+ }
54
+ const gainNode = new GainNode(audioContext, {
55
+ gain: currentVolumeRef.current,
56
+ });
57
+ source.attemptToConnect();
58
+ source.get().connect(gainNode);
59
+ gainNode.connect(audioContext.destination);
60
+ audioStuffRef.current = {
61
+ gainNode,
62
+ };
63
+ log_1.Log.trace(logLevel, `Starting to amplify ${(_a = mediaRef.current) === null || _a === void 0 ? void 0 : _a.src}. Gain = ${currentVolumeRef.current}, playbackRate = ${(_b = mediaRef.current) === null || _b === void 0 ? void 0 : _b.playbackRate}`);
64
+ return () => {
65
+ audioStuffRef.current = null;
66
+ gainNode.disconnect();
67
+ source.get().disconnect();
68
+ };
69
+ }, [logLevel, mediaRef, audioContext, source, shouldUseWebAudioApi]);
70
+ }
68
71
  if (audioStuffRef.current) {
69
72
  const valueToSet = volume;
70
73
  if (!(0, is_approximately_the_same_1.isApproximatelyTheSame)(audioStuffRef.current.gainNode.gain.value, valueToSet)) {
@@ -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.322";
6
+ export declare const VERSION = "4.0.324";
@@ -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.322';
10
+ exports.VERSION = '4.0.324';
@@ -104,7 +104,7 @@ function truthy(value) {
104
104
  }
105
105
 
106
106
  // src/version.ts
107
- var VERSION = "4.0.322";
107
+ var VERSION = "4.0.324";
108
108
 
109
109
  // src/multiple-versions-warning.ts
110
110
  var checkMultipleRemotionVersions = () => {
@@ -3196,39 +3196,41 @@ var useVolume = ({
3196
3196
  throw new Error("useAmplification must be used within a SharedAudioContext");
3197
3197
  }
3198
3198
  const { audioContext } = sharedAudioContext;
3199
- useLayoutEffect3(() => {
3200
- if (!audioContext) {
3201
- return;
3202
- }
3203
- if (!mediaRef.current) {
3204
- return;
3205
- }
3206
- if (!shouldUseWebAudioApi) {
3207
- return;
3208
- }
3209
- if (mediaRef.current.playbackRate !== 1 && isSafari()) {
3210
- warnSafariOnce(logLevel);
3211
- return;
3212
- }
3213
- if (!source) {
3214
- return;
3215
- }
3216
- const gainNode = new GainNode(audioContext, {
3217
- gain: currentVolumeRef.current
3218
- });
3219
- source.attemptToConnect();
3220
- source.get().connect(gainNode);
3221
- gainNode.connect(audioContext.destination);
3222
- audioStuffRef.current = {
3223
- gainNode
3224
- };
3225
- Log.trace(logLevel, `Starting to amplify ${mediaRef.current?.src}. Gain = ${currentVolumeRef.current}, playbackRate = ${mediaRef.current?.playbackRate}`);
3226
- return () => {
3227
- audioStuffRef.current = null;
3228
- gainNode.disconnect();
3229
- source.get().disconnect();
3230
- };
3231
- }, [logLevel, mediaRef, audioContext, source, shouldUseWebAudioApi]);
3199
+ if (typeof window !== "undefined") {
3200
+ useLayoutEffect3(() => {
3201
+ if (!audioContext) {
3202
+ return;
3203
+ }
3204
+ if (!mediaRef.current) {
3205
+ return;
3206
+ }
3207
+ if (!shouldUseWebAudioApi) {
3208
+ return;
3209
+ }
3210
+ if (mediaRef.current.playbackRate !== 1 && isSafari()) {
3211
+ warnSafariOnce(logLevel);
3212
+ return;
3213
+ }
3214
+ if (!source) {
3215
+ return;
3216
+ }
3217
+ const gainNode = new GainNode(audioContext, {
3218
+ gain: currentVolumeRef.current
3219
+ });
3220
+ source.attemptToConnect();
3221
+ source.get().connect(gainNode);
3222
+ gainNode.connect(audioContext.destination);
3223
+ audioStuffRef.current = {
3224
+ gainNode
3225
+ };
3226
+ Log.trace(logLevel, `Starting to amplify ${mediaRef.current?.src}. Gain = ${currentVolumeRef.current}, playbackRate = ${mediaRef.current?.playbackRate}`);
3227
+ return () => {
3228
+ audioStuffRef.current = null;
3229
+ gainNode.disconnect();
3230
+ source.get().disconnect();
3231
+ };
3232
+ }, [logLevel, mediaRef, audioContext, source, shouldUseWebAudioApi]);
3233
+ }
3232
3234
  if (audioStuffRef.current) {
3233
3235
  const valueToSet = volume;
3234
3236
  if (!isApproximatelyTheSame(audioStuffRef.current.gainNode.gain.value, valueToSet)) {
@@ -3518,17 +3520,19 @@ var useBufferManager = (logLevel, mountTime) => {
3518
3520
  });
3519
3521
  }
3520
3522
  }, [blocks]);
3521
- useLayoutEffect4(() => {
3522
- if (blocks.length === 0) {
3523
- onResumeCallbacks.forEach((c) => c());
3524
- playbackLogging({
3525
- logLevel,
3526
- message: "Player is exiting buffer state",
3527
- mountTime,
3528
- tag: "player"
3529
- });
3530
- }
3531
- }, [blocks]);
3523
+ if (typeof window !== "undefined") {
3524
+ useLayoutEffect4(() => {
3525
+ if (blocks.length === 0) {
3526
+ onResumeCallbacks.forEach((c) => c());
3527
+ playbackLogging({
3528
+ logLevel,
3529
+ message: "Player is exiting buffer state",
3530
+ mountTime,
3531
+ tag: "player"
3532
+ });
3533
+ }
3534
+ }, [blocks]);
3535
+ }
3532
3536
  return useMemo16(() => {
3533
3537
  return { addBlock, listenForBuffering, listenForResume, buffering };
3534
3538
  }, [addBlock, buffering, listenForBuffering, listenForResume]);
@@ -1,5 +1,5 @@
1
1
  // src/version.ts
2
- var VERSION = "4.0.322";
2
+ var VERSION = "4.0.324";
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.322",
6
+ "version": "4.0.324",
7
7
  "description": "Make videos programmatically",
8
8
  "main": "dist/cjs/index.js",
9
9
  "types": "dist/cjs/index.d.ts",
@@ -28,7 +28,7 @@
28
28
  "webpack": "5.96.1",
29
29
  "zod": "3.22.3",
30
30
  "eslint": "9.19.0",
31
- "@remotion/eslint-config-internal": "4.0.322"
31
+ "@remotion/eslint-config-internal": "4.0.324"
32
32
  },
33
33
  "keywords": [
34
34
  "remotion",