@remotion/media-utils 4.0.286 → 4.0.287
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/fft/max-value-cached.d.ts +2 -2
- package/dist/get-audio-data.d.ts +2 -2
- package/dist/get-waveform-portion.d.ts +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/probe-wave-file.js +4 -5
- package/dist/types.d.ts +5 -1
- package/dist/use-audio-data.d.ts +2 -2
- package/dist/use-windowed-audio-data.d.ts +2 -2
- package/dist/visualize-audio-waveform.d.ts +2 -2
- package/dist/visualize-audio.d.ts +2 -2
- package/package.json +3 -3
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare const getMaxPossibleMagnitude: (metadata:
|
|
1
|
+
import type { MediaUtilsAudioData } from '../types';
|
|
2
|
+
export declare const getMaxPossibleMagnitude: (metadata: MediaUtilsAudioData) => number;
|
package/dist/get-audio-data.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { MediaUtilsAudioData } from './types';
|
|
2
2
|
type Options = {
|
|
3
3
|
sampleRate?: number;
|
|
4
4
|
};
|
|
5
|
-
export declare const getAudioData: (src: string, options?: Options) => Promise<
|
|
5
|
+
export declare const getAudioData: (src: string, options?: Options) => Promise<MediaUtilsAudioData>;
|
|
6
6
|
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { SampleOutputRange } from './get-wave-form-samples';
|
|
2
|
-
import type {
|
|
2
|
+
import type { MediaUtilsAudioData } from './types';
|
|
3
3
|
type Bar = {
|
|
4
4
|
index: number;
|
|
5
5
|
amplitude: number;
|
|
6
6
|
};
|
|
7
7
|
export type GetWaveformPortion = {
|
|
8
|
-
audioData:
|
|
8
|
+
audioData: MediaUtilsAudioData;
|
|
9
9
|
startTimeInSeconds: number;
|
|
10
10
|
durationInSeconds: number;
|
|
11
11
|
numberOfSamples: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export { getVideoMetadata } from './get-video-metadata';
|
|
|
8
8
|
export { getWaveformPortion } from './get-waveform-portion';
|
|
9
9
|
export { WaveProbe, probeWaveFile } from './probe-wave-file';
|
|
10
10
|
export * from './types';
|
|
11
|
-
export type { AudioData, VideoMetadata as VideoData } from './types';
|
|
11
|
+
export type { AudioData, MediaUtilsAudioData, VideoMetadata as VideoData, } from './types';
|
|
12
12
|
export { useAudioData } from './use-audio-data';
|
|
13
13
|
export { UseWindowedAudioDataOptions, UseWindowedAudioDataReturnValue, useWindowedAudioData, } from './use-windowed-audio-data';
|
|
14
14
|
export { VisualizeAudioOptions, visualizeAudio } from './visualize-audio';
|
package/dist/probe-wave-file.js
CHANGED
|
@@ -34,14 +34,14 @@ exports.getInt8AsFloat = getInt8AsFloat;
|
|
|
34
34
|
const probeWaveFile = async (src) => {
|
|
35
35
|
const response = await (0, fetch_with_cors_catch_1.fetchWithCorsCatch)(src, {
|
|
36
36
|
headers: {
|
|
37
|
-
range: 'bytes=0-
|
|
37
|
+
range: 'bytes=0-1024',
|
|
38
38
|
},
|
|
39
39
|
});
|
|
40
40
|
if (response.status === 416) {
|
|
41
|
-
throw new Error(`Tried to read bytes 0-
|
|
41
|
+
throw new Error(`Tried to read bytes 0-1024 from ${src}, but the response status code was 416 "Range Not Satisfiable". Is the file at least 256 bytes long?`);
|
|
42
42
|
}
|
|
43
43
|
if (response.status !== 206) {
|
|
44
|
-
throw new Error(`Tried to read bytes 0-
|
|
44
|
+
throw new Error(`Tried to read bytes 0-1024 from ${src}, but the response status code was ${response.status} (expected was 206). This means the server might not support returning a partial response.`);
|
|
45
45
|
}
|
|
46
46
|
const buffer = await response.arrayBuffer();
|
|
47
47
|
const uintArray = new Uint8Array(buffer);
|
|
@@ -65,7 +65,6 @@ const probeWaveFile = async (src) => {
|
|
|
65
65
|
}
|
|
66
66
|
const numberOfChannels = getUint16(uintArray, 22);
|
|
67
67
|
const sampleRate = getUint32(uintArray, 24);
|
|
68
|
-
// const byteRate = toUint32(uintArray.slice(28, 32));
|
|
69
68
|
const blockAlign = getUint16(uintArray, 32);
|
|
70
69
|
const bitsPerSample = getUint16(uintArray, 34);
|
|
71
70
|
let offset = 36;
|
|
@@ -77,7 +76,7 @@ const probeWaveFile = async (src) => {
|
|
|
77
76
|
}
|
|
78
77
|
const shouldBeData = new TextDecoder().decode(uintArray.slice(offset, offset + 4));
|
|
79
78
|
if (shouldBeData !== 'data') {
|
|
80
|
-
throw new Error(
|
|
79
|
+
throw new Error(`getPartialAudioData() requires a WAVE file, but the bytes ${offset}-${offset + 4} are not "data". `);
|
|
81
80
|
}
|
|
82
81
|
const dataSize = getUint32(uintArray, offset + 4);
|
|
83
82
|
return {
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type
|
|
1
|
+
export type MediaUtilsAudioData = {
|
|
2
2
|
channelWaveforms: Float32Array[];
|
|
3
3
|
sampleRate: number;
|
|
4
4
|
durationInSeconds: number;
|
|
@@ -6,6 +6,10 @@ export type AudioData = {
|
|
|
6
6
|
resultId: string;
|
|
7
7
|
isRemote: boolean;
|
|
8
8
|
};
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated renamed to MediaUtilsAudioData instead
|
|
11
|
+
*/
|
|
12
|
+
export type AudioData = MediaUtilsAudioData;
|
|
9
13
|
export type VideoMetadata = {
|
|
10
14
|
durationInSeconds: number;
|
|
11
15
|
width: number;
|
package/dist/use-audio-data.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare const useAudioData: (src: string) =>
|
|
1
|
+
import type { MediaUtilsAudioData } from './types';
|
|
2
|
+
export declare const useAudioData: (src: string) => MediaUtilsAudioData | null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { MediaUtilsAudioData } from './types';
|
|
2
2
|
export type UseWindowedAudioDataOptions = {
|
|
3
3
|
src: string;
|
|
4
4
|
frame: number;
|
|
@@ -7,7 +7,7 @@ export type UseWindowedAudioDataOptions = {
|
|
|
7
7
|
channelIndex?: number;
|
|
8
8
|
};
|
|
9
9
|
export type UseWindowedAudioDataReturnValue = {
|
|
10
|
-
audioData:
|
|
10
|
+
audioData: MediaUtilsAudioData | null;
|
|
11
11
|
dataOffsetInSeconds: number;
|
|
12
12
|
};
|
|
13
13
|
export declare const useWindowedAudioData: ({ src, frame, fps, windowInSeconds, channelIndex, }: UseWindowedAudioDataOptions) => UseWindowedAudioDataReturnValue;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { OptimizeFor } from './fft/get-visualization';
|
|
2
|
-
import type {
|
|
2
|
+
import type { MediaUtilsAudioData } from './types';
|
|
3
3
|
type MandatoryVisualizeAudioOptions = {
|
|
4
|
-
audioData:
|
|
4
|
+
audioData: MediaUtilsAudioData;
|
|
5
5
|
frame: number;
|
|
6
6
|
fps: number;
|
|
7
7
|
numberOfSamples: number;
|
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.
|
|
6
|
+
"version": "4.0.287",
|
|
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.
|
|
16
|
+
"remotion": "4.0.287"
|
|
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.
|
|
24
|
+
"@remotion/eslint-config-internal": "4.0.287"
|
|
25
25
|
},
|
|
26
26
|
"keywords": [
|
|
27
27
|
"remotion",
|