@remotion/media-utils 4.0.0-webhook.27 → 4.1.0-alpha1

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.
Files changed (47) hide show
  1. package/dist/audio-buffer/audio-buffer-to-wav.d.ts +0 -0
  2. package/dist/audio-buffer/audio-buffer-to-wav.js +0 -0
  3. package/dist/audio-buffer/audio-url-helpers.d.ts +4 -0
  4. package/dist/audio-buffer/audio-url-helpers.js +4 -0
  5. package/dist/fft/complex.d.ts +0 -0
  6. package/dist/fft/complex.js +0 -0
  7. package/dist/fft/exponent.d.ts +0 -0
  8. package/dist/fft/exponent.js +0 -0
  9. package/dist/fft/fft-freq.d.ts +0 -0
  10. package/dist/fft/fft-freq.js +0 -0
  11. package/dist/fft/fft.d.ts +0 -0
  12. package/dist/fft/fft.js +0 -0
  13. package/dist/fft/get-visualization.d.ts +0 -0
  14. package/dist/fft/get-visualization.js +0 -0
  15. package/dist/fft/mag.d.ts +0 -0
  16. package/dist/fft/mag.js +0 -0
  17. package/dist/fft/max-value-cached.d.ts +0 -0
  18. package/dist/fft/max-value-cached.js +0 -0
  19. package/dist/fft/smoothing.d.ts +0 -0
  20. package/dist/fft/smoothing.js +0 -0
  21. package/dist/fft/to-int-16.d.ts +0 -0
  22. package/dist/fft/to-int-16.js +0 -0
  23. package/dist/get-audio-data.d.ts +4 -0
  24. package/dist/get-audio-data.js +4 -0
  25. package/dist/get-audio-duration-in-seconds.d.ts +2 -1
  26. package/dist/get-audio-duration-in-seconds.js +2 -1
  27. package/dist/get-video-metadata.d.ts +4 -0
  28. package/dist/get-video-metadata.js +4 -0
  29. package/dist/get-wave-form-samples.d.ts +0 -0
  30. package/dist/get-wave-form-samples.js +0 -0
  31. package/dist/get-waveform-portion.d.ts +5 -1
  32. package/dist/get-waveform-portion.js +4 -0
  33. package/dist/index.d.ts +0 -0
  34. package/dist/index.js +0 -0
  35. package/dist/is-remote-asset.d.ts +0 -0
  36. package/dist/is-remote-asset.js +0 -0
  37. package/dist/p-limit.d.ts +0 -0
  38. package/dist/p-limit.js +0 -0
  39. package/dist/types.d.ts +2 -2
  40. package/dist/types.js +0 -0
  41. package/dist/use-audio-data.d.ts +7 -0
  42. package/dist/use-audio-data.js +7 -0
  43. package/dist/visualize-audio.d.ts +1 -1
  44. package/dist/visualize-audio.js +5 -0
  45. package/package.json +46 -47
  46. package/.prettierrc.js +0 -14
  47. 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,
File without changes
File without changes
File without changes
File without changes
File without changes
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
File without changes
File without changes
File without changes
File without changes
@@ -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>;
@@ -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
- declare type Bar = {
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
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 declare type AudioData = {
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 declare type VideoMetadata = {
9
+ export type VideoMetadata = {
10
10
  durationInSeconds: number;
11
11
  width: number;
12
12
  height: number;
package/dist/types.js CHANGED
File without changes
@@ -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;
@@ -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");
@@ -1,5 +1,5 @@
1
1
  import type { AudioData } from './types';
2
- declare type FnParameters = {
2
+ type FnParameters = {
3
3
  audioData: AudioData;
4
4
  frame: number;
5
5
  fps: number;
@@ -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
- "name": "@remotion/media-utils",
3
- "version": "4.0.0-webhook.27+eb81308ee",
4
- "description": "Utility functions for audio and video",
5
- "main": "dist/index.js",
6
- "sideEffects": false,
7
- "scripts": {
8
- "lint": "eslint src --ext ts,tsx",
9
- "watch": "tsc -w",
10
- "build": "tsc -d"
11
- },
12
- "author": "",
13
- "license": "MIT",
14
- "repository": {
15
- "url": "https://github.com/remotion-dev/remotion"
16
- },
17
- "bugs": {
18
- "url": "https://github.com/remotion-dev/remotion/issues"
19
- },
20
- "dependencies": {
21
- "remotion": "4.0.0-webhook.27+eb81308ee"
22
- },
23
- "peerDependencies": {
24
- "react": ">=16.8.0",
25
- "react-dom": ">=16.8.0"
26
- },
27
- "devDependencies": {
28
- "@jonny/eslint-config": "3.0.266",
29
- "@types/node": "^16.7.5",
30
- "@types/react": "18.0.1",
31
- "eslint": "8.13.0",
32
- "prettier": "^2.0.5",
33
- "prettier-plugin-organize-imports": "^2.3.4",
34
- "typescript": "^4.7.0"
35
- },
36
- "keywords": [
37
- "remotion",
38
- "ffmpeg",
39
- "video",
40
- "react",
41
- "puppeteer",
42
- "player"
43
- ],
44
- "publishConfig": {
45
- "access": "public"
46
- },
47
- "gitHead": "eb81308ee07a402f4a8dd9ff24306bb07dd78175"
48
- }
2
+ "name": "@remotion/media-utils",
3
+ "version": "4.1.0-alpha1",
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-alpha1"
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
@@ -1,14 +0,0 @@
1
- module.exports = {
2
- singleQuote: true,
3
- bracketSpacing: false,
4
- useTabs: true,
5
- overrides: [
6
- {
7
- files: ['*.yml'],
8
- options: {
9
- singleQuote: false,
10
- },
11
- },
12
- ],
13
- plugins: [require.resolve('prettier-plugin-organize-imports')],
14
- };
package/tsconfig.json DELETED
@@ -1,10 +0,0 @@
1
- {
2
- "extends": "../tsconfig.settings.json",
3
- "compilerOptions": {
4
- "composite": true,
5
- "rootDir": "src",
6
- "outDir": "dist"
7
- },
8
- "include": ["src"],
9
- "references": [{"path": "../core"}]
10
- }