@remotion/media-utils 4.0.341 → 4.0.345

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.
@@ -21,8 +21,9 @@ const useAudioData = (src) => {
21
21
  };
22
22
  }, []);
23
23
  const [metadata, setMetadata] = (0, react_1.useState)(null);
24
+ const { delayRender, continueRender } = (0, remotion_1.useDelayRender)();
24
25
  const fetchMetadata = (0, react_1.useCallback)(async () => {
25
- const handle = (0, remotion_1.delayRender)(`Waiting for audio metadata with src="${src}" to be loaded`);
26
+ const handle = delayRender(`Waiting for audio metadata with src="${src}" to be loaded`);
26
27
  try {
27
28
  const data = await (0, get_audio_data_1.getAudioData)(src);
28
29
  if (mountState.current.isMounted) {
@@ -32,8 +33,8 @@ const useAudioData = (src) => {
32
33
  catch (err) {
33
34
  (0, remotion_1.cancelRender)(err);
34
35
  }
35
- (0, remotion_1.continueRender)(handle);
36
- }, [src]);
36
+ continueRender(handle);
37
+ }, [src, delayRender, continueRender]);
37
38
  (0, react_1.useLayoutEffect)(() => {
38
39
  fetchMetadata();
39
40
  }, [fetchMetadata]);
@@ -22,10 +22,11 @@ const useWindowedAudioData = ({ src, frame, fps, windowInSeconds, channelIndex =
22
22
  isMounted.current = false;
23
23
  };
24
24
  }, []);
25
+ const { delayRender, continueRender } = (0, remotion_1.useDelayRender)();
25
26
  const fetchMetadata = (0, react_1.useCallback)(async (signal) => {
26
- const handle = (0, remotion_1.delayRender)(`Waiting for audio metadata with src="${src}" to be loaded`);
27
+ const handle = delayRender(`Waiting for audio metadata with src="${src}" to be loaded`);
27
28
  const cont = () => {
28
- (0, remotion_1.continueRender)(handle);
29
+ continueRender(handle);
29
30
  };
30
31
  signal.addEventListener('abort', cont, { once: true });
31
32
  try {
@@ -33,7 +34,7 @@ const useWindowedAudioData = ({ src, frame, fps, windowInSeconds, channelIndex =
33
34
  if (isMounted.current) {
34
35
  setWaveProbe(data);
35
36
  }
36
- (0, remotion_1.continueRender)(handle);
37
+ continueRender(handle);
37
38
  }
38
39
  catch (err) {
39
40
  (0, remotion_1.cancelRender)(err);
@@ -41,7 +42,7 @@ const useWindowedAudioData = ({ src, frame, fps, windowInSeconds, channelIndex =
41
42
  finally {
42
43
  signal.removeEventListener('abort', cont);
43
44
  }
44
- }, [src]);
45
+ }, [src, delayRender, continueRender]);
45
46
  (0, react_1.useLayoutEffect)(() => {
46
47
  const controller = new AbortController();
47
48
  fetchMetadata(controller.signal);
@@ -153,11 +154,11 @@ const useWindowedAudioData = ({ src, frame, fps, windowInSeconds, channelIndex =
153
154
  if (currentAudioData) {
154
155
  return;
155
156
  }
156
- const handle = (0, remotion_1.delayRender)(`Waiting for audio data with src="${src}" to be loaded`);
157
+ const handle = delayRender(`Waiting for audio data with src="${src}" to be loaded`);
157
158
  return () => {
158
- (0, remotion_1.continueRender)(handle);
159
+ continueRender(handle);
159
160
  };
160
- }, [currentAudioData, src]);
161
+ }, [currentAudioData, src, delayRender, continueRender]);
161
162
  return {
162
163
  audioData: currentAudioData,
163
164
  dataOffsetInSeconds: windowsToFetch[0] * windowInSeconds,
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/media-utils"
4
4
  },
5
5
  "name": "@remotion/media-utils",
6
- "version": "4.0.341",
6
+ "version": "4.0.345",
7
7
  "description": "Utilities for working with media files",
8
8
  "main": "dist/index.js",
9
9
  "sideEffects": false,
@@ -13,7 +13,7 @@
13
13
  "url": "https://github.com/remotion-dev/remotion/issues"
14
14
  },
15
15
  "dependencies": {
16
- "remotion": "4.0.341"
16
+ "remotion": "4.0.345"
17
17
  },
18
18
  "peerDependencies": {
19
19
  "react": ">=16.8.0",
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "devDependencies": {
23
23
  "eslint": "9.19.0",
24
- "@remotion/eslint-config-internal": "4.0.341"
24
+ "@remotion/eslint-config-internal": "4.0.345"
25
25
  },
26
26
  "keywords": [
27
27
  "remotion",