web-audio-recorder-ts 1.0.6 → 1.0.7
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/README.md +9 -1
- package/dist/encoders/OggVorbisEncoder.d.ts +0 -5
- package/dist/index.cjs.js +262 -288
- package/dist/index.esm.js +262 -287
- package/dist/index.umd.js +262 -288
- package/dist/utils/encoderLoader.d.ts +8 -8
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -84,9 +84,17 @@ recorder.setOnComplete((event) => {
|
|
|
84
84
|
});
|
|
85
85
|
|
|
86
86
|
await recorder.start(stream);
|
|
87
|
-
|
|
87
|
+
|
|
88
|
+
// ⚠️ IMPORTANT: OGG and MP3 require at least 0.5 seconds of audio data
|
|
89
|
+
// Recording for less than 0.5s will cause an error
|
|
90
|
+
setTimeout(async () => {
|
|
91
|
+
const blob = await recorder.stop();
|
|
92
|
+
// Recording complete!
|
|
93
|
+
}, 500); // Minimum 500ms
|
|
88
94
|
```
|
|
89
95
|
|
|
96
|
+
> **⚠️ Important**: OGG Vorbis and MP3 encoders require **at least 0.5 seconds** of audio data to create a valid file. Recording for less than 0.5 seconds will throw an error: `"Insufficient audio data for encoding"`. See [MINIMUM_RECORDING_DURATION.md](./MINIMUM_RECORDING_DURATION.md) for details.
|
|
97
|
+
|
|
90
98
|
### MP3 Recording
|
|
91
99
|
|
|
92
100
|
```typescript
|
|
@@ -24,15 +24,10 @@ export declare class OggVorbisEncoderWrapper implements AudioEncoder {
|
|
|
24
24
|
constructor(sampleRate: number, numChannels: number, options?: OggVorbisOptions);
|
|
25
25
|
/**
|
|
26
26
|
* Codifica buffers de áudio
|
|
27
|
-
*
|
|
28
|
-
* @param buffers - Array de buffers Float32Array, um por canal
|
|
29
27
|
*/
|
|
30
28
|
encode(buffers: Float32Array[]): void;
|
|
31
29
|
/**
|
|
32
30
|
* Finaliza o encoding e retorna o Blob OGG
|
|
33
|
-
*
|
|
34
|
-
* @param mimeType - Tipo MIME (padrão: 'audio/ogg')
|
|
35
|
-
* @returns Blob contendo o arquivo OGG
|
|
36
31
|
*/
|
|
37
32
|
finish(mimeType?: string): Blob;
|
|
38
33
|
/**
|