@remotion/media-utils 4.0.0-webhook.27 → 4.1.0-alpha2
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/audio-buffer/audio-buffer-to-wav.d.ts +0 -0
- package/dist/audio-buffer/audio-buffer-to-wav.js +0 -0
- package/dist/audio-buffer/audio-url-helpers.d.ts +4 -0
- package/dist/audio-buffer/audio-url-helpers.js +4 -0
- package/dist/fft/complex.d.ts +0 -0
- package/dist/fft/complex.js +0 -0
- package/dist/fft/exponent.d.ts +0 -0
- package/dist/fft/exponent.js +0 -0
- package/dist/fft/fft-freq.d.ts +0 -0
- package/dist/fft/fft-freq.js +0 -0
- package/dist/fft/fft.d.ts +0 -0
- package/dist/fft/fft.js +0 -0
- package/dist/fft/get-visualization.d.ts +0 -0
- package/dist/fft/get-visualization.js +0 -0
- package/dist/fft/mag.d.ts +0 -0
- package/dist/fft/mag.js +0 -0
- package/dist/fft/max-value-cached.d.ts +0 -0
- package/dist/fft/max-value-cached.js +0 -0
- package/dist/fft/smoothing.d.ts +0 -0
- package/dist/fft/smoothing.js +0 -0
- package/dist/fft/to-int-16.d.ts +0 -0
- package/dist/fft/to-int-16.js +0 -0
- package/dist/get-audio-data.d.ts +4 -0
- package/dist/get-audio-data.js +4 -0
- package/dist/get-audio-duration-in-seconds.d.ts +2 -1
- package/dist/get-audio-duration-in-seconds.js +2 -1
- package/dist/get-video-metadata.d.ts +4 -0
- package/dist/get-video-metadata.js +4 -0
- package/dist/get-wave-form-samples.d.ts +0 -0
- package/dist/get-wave-form-samples.js +0 -0
- package/dist/get-waveform-portion.d.ts +5 -1
- package/dist/get-waveform-portion.js +4 -0
- package/dist/index.d.ts +0 -0
- package/dist/index.js +0 -0
- package/dist/is-remote-asset.d.ts +0 -0
- package/dist/is-remote-asset.js +0 -0
- package/dist/p-limit.d.ts +0 -0
- package/dist/p-limit.js +0 -0
- package/dist/types.d.ts +2 -2
- package/dist/types.js +0 -0
- package/dist/use-audio-data.d.ts +7 -0
- package/dist/use-audio-data.js +7 -0
- package/dist/visualize-audio.d.ts +1 -1
- package/dist/visualize-audio.js +5 -0
- package/package.json +46 -47
- package/.prettierrc.js +0 -14
- package/tsconfig.json +0 -10
|
File without changes
|
|
File without changes
|
|
@@ -1 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description This API takes an AudioBuffer instance and converts it to a Base 64 Data URL so it can be passed to an <Audio /> tag.
|
|
3
|
+
* @see [Documentation](https://www.remotion.dev/docs/audio-buffer-to-data-url)
|
|
4
|
+
*/
|
|
1
5
|
export declare const audioBufferToDataUrl: (buffer: AudioBuffer) => string;
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.audioBufferToDataUrl = void 0;
|
|
4
4
|
const audio_buffer_to_wav_1 = require("./audio-buffer-to-wav");
|
|
5
|
+
/**
|
|
6
|
+
* @description This API takes an AudioBuffer instance and converts it to a Base 64 Data URL so it can be passed to an <Audio /> tag.
|
|
7
|
+
* @see [Documentation](https://www.remotion.dev/docs/audio-buffer-to-data-url)
|
|
8
|
+
*/
|
|
5
9
|
const audioBufferToDataUrl = (buffer) => {
|
|
6
10
|
const wavAsArrayBuffer = (0, audio_buffer_to_wav_1.audioBufferToWav)(buffer, {
|
|
7
11
|
float32: true,
|
package/dist/fft/complex.d.ts
CHANGED
|
File without changes
|
package/dist/fft/complex.js
CHANGED
|
File without changes
|
package/dist/fft/exponent.d.ts
CHANGED
|
File without changes
|
package/dist/fft/exponent.js
CHANGED
|
File without changes
|
package/dist/fft/fft-freq.d.ts
CHANGED
|
File without changes
|
package/dist/fft/fft-freq.js
CHANGED
|
File without changes
|
package/dist/fft/fft.d.ts
CHANGED
|
File without changes
|
package/dist/fft/fft.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/fft/mag.d.ts
CHANGED
|
File without changes
|
package/dist/fft/mag.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/fft/smoothing.d.ts
CHANGED
|
File without changes
|
package/dist/fft/smoothing.js
CHANGED
|
File without changes
|
package/dist/fft/to-int-16.d.ts
CHANGED
|
File without changes
|
package/dist/fft/to-int-16.js
CHANGED
|
File without changes
|
package/dist/get-audio-data.d.ts
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
import type { AudioData } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* @description Takes an audio src, loads it and returns data and metadata for the specified source.
|
|
4
|
+
* @see [Documentation](https://www.remotion.dev/docs/get-audio-data)
|
|
5
|
+
*/
|
|
2
6
|
export declare const getAudioData: (src: string) => Promise<AudioData>;
|
package/dist/get-audio-data.js
CHANGED
|
@@ -54,6 +54,10 @@ const fn = async (src) => {
|
|
|
54
54
|
metadataCache[src] = metadata;
|
|
55
55
|
return metadata;
|
|
56
56
|
};
|
|
57
|
+
/**
|
|
58
|
+
* @description Takes an audio src, loads it and returns data and metadata for the specified source.
|
|
59
|
+
* @see [Documentation](https://www.remotion.dev/docs/get-audio-data)
|
|
60
|
+
*/
|
|
57
61
|
const getAudioData = (src) => {
|
|
58
62
|
return limit(fn, src);
|
|
59
63
|
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Get the audio file passed in parameter duration in seconds
|
|
2
|
+
* @default Get the audio file passed in parameter duration in seconds
|
|
3
3
|
* @async
|
|
4
4
|
* @param src path to the audio file
|
|
5
5
|
* @return {number} duration of the audio file in seconds
|
|
6
|
+
* @see [Documentation](https://www.remotion.dev/docs/get-audio-duration-in-seconds)
|
|
6
7
|
*/
|
|
7
8
|
export declare const getAudioDurationInSeconds: (src: string) => Promise<number>;
|
|
8
9
|
/**
|
|
@@ -33,10 +33,11 @@ const fn = (src) => {
|
|
|
33
33
|
});
|
|
34
34
|
};
|
|
35
35
|
/**
|
|
36
|
-
* Get the audio file passed in parameter duration in seconds
|
|
36
|
+
* @default Get the audio file passed in parameter duration in seconds
|
|
37
37
|
* @async
|
|
38
38
|
* @param src path to the audio file
|
|
39
39
|
* @return {number} duration of the audio file in seconds
|
|
40
|
+
* @see [Documentation](https://www.remotion.dev/docs/get-audio-duration-in-seconds)
|
|
40
41
|
*/
|
|
41
42
|
const getAudioDurationInSeconds = (src) => {
|
|
42
43
|
return limit(fn, src);
|
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
import type { VideoMetadata } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* @description Takes a src to a video, loads it and returns metadata for the specified source.
|
|
4
|
+
* @see [Documentation](https://www.remotion.dev/docs/get-video-metadata)
|
|
5
|
+
*/
|
|
2
6
|
export declare const getVideoMetadata: (src: string) => Promise<VideoMetadata>;
|
|
@@ -45,6 +45,10 @@ const fn = (src) => {
|
|
|
45
45
|
video.addEventListener('error', onError, { once: true });
|
|
46
46
|
});
|
|
47
47
|
};
|
|
48
|
+
/**
|
|
49
|
+
* @description Takes a src to a video, loads it and returns metadata for the specified source.
|
|
50
|
+
* @see [Documentation](https://www.remotion.dev/docs/get-video-metadata)
|
|
51
|
+
*/
|
|
48
52
|
const getVideoMetadata = (src) => {
|
|
49
53
|
return limit(fn, src);
|
|
50
54
|
};
|
|
File without changes
|
|
File without changes
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import type { AudioData } from './types';
|
|
2
|
-
|
|
2
|
+
type Bar = {
|
|
3
3
|
index: number;
|
|
4
4
|
amplitude: number;
|
|
5
5
|
};
|
|
6
|
+
/**
|
|
7
|
+
* @description Takes bulky waveform data (for example fetched by getAudioData()) and returns a trimmed and simplified version of it, for simpler visualization
|
|
8
|
+
* @see [Documentation](https://www.remotion.dev/docs/get-waveform-portion)
|
|
9
|
+
*/
|
|
6
10
|
export declare const getWaveformPortion: ({ audioData, startTimeInSeconds, durationInSeconds, numberOfSamples, }: {
|
|
7
11
|
audioData: AudioData;
|
|
8
12
|
startTimeInSeconds: number;
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getWaveformPortion = void 0;
|
|
4
4
|
const get_wave_form_samples_1 = require("./get-wave-form-samples");
|
|
5
|
+
/**
|
|
6
|
+
* @description Takes bulky waveform data (for example fetched by getAudioData()) and returns a trimmed and simplified version of it, for simpler visualization
|
|
7
|
+
* @see [Documentation](https://www.remotion.dev/docs/get-waveform-portion)
|
|
8
|
+
*/
|
|
5
9
|
const getWaveformPortion = ({ audioData, startTimeInSeconds, durationInSeconds, numberOfSamples, }) => {
|
|
6
10
|
const startSample = Math.floor((startTimeInSeconds / audioData.durationInSeconds) *
|
|
7
11
|
audioData.channelWaveforms[0].length);
|
package/dist/index.d.ts
CHANGED
|
File without changes
|
package/dist/index.js
CHANGED
|
File without changes
|
|
File without changes
|
package/dist/is-remote-asset.js
CHANGED
|
File without changes
|
package/dist/p-limit.d.ts
CHANGED
|
File without changes
|
package/dist/p-limit.js
CHANGED
|
File without changes
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type AudioData = {
|
|
2
2
|
channelWaveforms: Float32Array[];
|
|
3
3
|
sampleRate: number;
|
|
4
4
|
durationInSeconds: number;
|
|
@@ -6,7 +6,7 @@ export declare type AudioData = {
|
|
|
6
6
|
resultId: string;
|
|
7
7
|
isRemote: boolean;
|
|
8
8
|
};
|
|
9
|
-
export
|
|
9
|
+
export type VideoMetadata = {
|
|
10
10
|
durationInSeconds: number;
|
|
11
11
|
width: number;
|
|
12
12
|
height: number;
|
package/dist/types.js
CHANGED
|
File without changes
|
package/dist/use-audio-data.d.ts
CHANGED
|
@@ -1,2 +1,9 @@
|
|
|
1
1
|
import type { AudioData } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* @description Wraps the getAudioData() function into a hook and does 3 things:
|
|
4
|
+
* @description Keeps the audio data in a state
|
|
5
|
+
* @description Wraps the function in a delayRender() / continueRender() pattern.
|
|
6
|
+
* @description Handles the case where the component gets unmounted while the fetching is in progress and a React error is thrown.
|
|
7
|
+
* @see [Documentation](https://www.remotion.dev/docs/use-audio-data)
|
|
8
|
+
*/
|
|
2
9
|
export declare const useAudioData: (src: string) => AudioData | null;
|
package/dist/use-audio-data.js
CHANGED
|
@@ -4,6 +4,13 @@ exports.useAudioData = void 0;
|
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const remotion_1 = require("remotion");
|
|
6
6
|
const get_audio_data_1 = require("./get-audio-data");
|
|
7
|
+
/**
|
|
8
|
+
* @description Wraps the getAudioData() function into a hook and does 3 things:
|
|
9
|
+
* @description Keeps the audio data in a state
|
|
10
|
+
* @description Wraps the function in a delayRender() / continueRender() pattern.
|
|
11
|
+
* @description Handles the case where the component gets unmounted while the fetching is in progress and a React error is thrown.
|
|
12
|
+
* @see [Documentation](https://www.remotion.dev/docs/use-audio-data)
|
|
13
|
+
*/
|
|
7
14
|
const useAudioData = (src) => {
|
|
8
15
|
if (!src) {
|
|
9
16
|
throw new TypeError("useAudioData requires a 'src' parameter");
|
package/dist/visualize-audio.js
CHANGED
|
@@ -4,6 +4,11 @@ exports.visualizeAudio = void 0;
|
|
|
4
4
|
const get_visualization_1 = require("./fft/get-visualization");
|
|
5
5
|
const max_value_cached_1 = require("./fft/max-value-cached");
|
|
6
6
|
const cache = {};
|
|
7
|
+
/**
|
|
8
|
+
* @description Takes in AudioData (preferably fetched by the useAudioData() hook) and processes it in a way that makes visualizing the audio that is playing at the current frame easy.
|
|
9
|
+
* @description part of @remotion/media-utils
|
|
10
|
+
* @see [Documentation](https://www.remotion.dev/docs/visualize-audio)
|
|
11
|
+
*/
|
|
7
12
|
const visualizeAudioFrame = ({ audioData: metadata, frame, fps, numberOfSamples, }) => {
|
|
8
13
|
const cacheKey = metadata.resultId + frame + fps + numberOfSamples;
|
|
9
14
|
if (cache[cacheKey]) {
|
package/package.json
CHANGED
|
@@ -1,48 +1,47 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
2
|
+
"name": "@remotion/media-utils",
|
|
3
|
+
"version": "4.1.0-alpha2",
|
|
4
|
+
"description": "Utility functions for audio and video",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"author": "Jonny Burger <jonny@remotion.dev>",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"repository": {
|
|
10
|
+
"url": "https://github.com/remotion-dev/remotion"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/remotion-dev/remotion/issues"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"remotion": "4.1.0-alpha2"
|
|
17
|
+
},
|
|
18
|
+
"peerDependencies": {
|
|
19
|
+
"react": ">=16.8.0",
|
|
20
|
+
"react-dom": ">=16.8.0"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@jonny/eslint-config": "3.0.266",
|
|
24
|
+
"@types/node": "18.14.6",
|
|
25
|
+
"@types/react": "18.0.26",
|
|
26
|
+
"eslint": "8.42.0",
|
|
27
|
+
"prettier": "^2.7.1",
|
|
28
|
+
"prettier-plugin-organize-imports": "^2.3.4",
|
|
29
|
+
"typescript": "4.9.5"
|
|
30
|
+
},
|
|
31
|
+
"keywords": [
|
|
32
|
+
"remotion",
|
|
33
|
+
"ffmpeg",
|
|
34
|
+
"video",
|
|
35
|
+
"react",
|
|
36
|
+
"player"
|
|
37
|
+
],
|
|
38
|
+
"publishConfig": {
|
|
39
|
+
"access": "public"
|
|
40
|
+
},
|
|
41
|
+
"scripts": {
|
|
42
|
+
"formatting": "prettier src --check",
|
|
43
|
+
"lint": "eslint src --ext ts,tsx",
|
|
44
|
+
"watch": "tsc -w",
|
|
45
|
+
"build": "tsc -d"
|
|
46
|
+
}
|
|
47
|
+
}
|
package/.prettierrc.js
DELETED