@remotion/media-utils 4.0.287 → 4.0.289

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.
@@ -9,4 +9,4 @@ export type WaveProbe = {
9
9
  fileSize: number;
10
10
  durationInSeconds: number;
11
11
  };
12
- export declare const probeWaveFile: (src: string) => Promise<WaveProbe>;
12
+ export declare const probeWaveFile: (src: string, probeSize?: number) => Promise<WaveProbe>;
@@ -31,10 +31,10 @@ const getInt8AsFloat = (bytes, offset) => {
31
31
  return bytes[offset] / 128;
32
32
  };
33
33
  exports.getInt8AsFloat = getInt8AsFloat;
34
- const probeWaveFile = async (src) => {
34
+ const probeWaveFile = async (src, probeSize = 1024) => {
35
35
  const response = await (0, fetch_with_cors_catch_1.fetchWithCorsCatch)(src, {
36
36
  headers: {
37
- range: 'bytes=0-1024',
37
+ range: `bytes=0-${probeSize - 1}`,
38
38
  },
39
39
  });
40
40
  if (response.status === 416) {
@@ -74,6 +74,9 @@ const probeWaveFile = async (src) => {
74
74
  offset += listSize;
75
75
  offset += 8;
76
76
  }
77
+ if (offset + 4 > probeSize) {
78
+ return (0, exports.probeWaveFile)(src, offset + 4);
79
+ }
77
80
  const shouldBeData = new TextDecoder().decode(uintArray.slice(offset, offset + 4));
78
81
  if (shouldBeData !== 'data') {
79
82
  throw new Error(`getPartialAudioData() requires a WAVE file, but the bytes ${offset}-${offset + 4} are not "data". `);
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.287",
6
+ "version": "4.0.289",
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.287"
16
+ "remotion": "4.0.289"
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.287"
24
+ "@remotion/eslint-config-internal": "4.0.289"
25
25
  },
26
26
  "keywords": [
27
27
  "remotion",