@vidtreo/recorder 1.1.0 → 1.2.0

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 CHANGED
@@ -833,15 +833,16 @@ The following browsers support core recording features but may have limitations:
833
833
 
834
834
  - **WebCodecs API** - Required for real-time MP4 transcoding (via mediabunny)
835
835
  - **Web Workers** - Required for video processing (no fallback available)
836
+ - **AudioWorklet** - Required for audio processing and PCM capture
837
+ - **AudioContext** - Required for AudioWorklet pipelines
836
838
  - **MediaStreamTrackProcessor** - Required for track processing in workers
837
839
  - **VideoFrame** - Required for video frame processing in workers
838
- - **AudioData** - Required for audio processing in workers
839
840
  - **Screen Capture API** (`getDisplayMedia`) - Required for screen recording
840
841
  - **MediaDevices API** (`getUserMedia`) - Required for camera/microphone access
841
842
  - **IndexedDB** - Required for persistent upload queue
842
843
  - **Storage API** - Required for storage quota management
843
844
 
844
- **Note:** This package requires modern browsers with full Web Worker support. There is no fallback for browsers without Web Workers, MediaStreamTrackProcessor, VideoFrame, or AudioData APIs.
845
+ **Note:** This package requires modern browsers with full Web Worker and AudioWorklet support. There is no fallback for browsers without Worker, AudioWorklet, MediaStreamTrackProcessor, VideoFrame, or OffscreenCanvas APIs.
845
846
 
846
847
  ### Feature Support by Browser
847
848
 
@@ -876,7 +877,7 @@ The following browsers support core recording features but may have limitations:
876
877
 
877
878
  1. **HTTPS Required**: Media capture APIs require HTTPS (or localhost) in most browsers
878
879
  2. **User Permissions**: Camera, microphone, and screen capture require explicit user permission
879
- 3. **Web Workers Required**: This package requires Web Workers for video processing. Browsers without Web Worker support (or missing MediaStreamTrackProcessor, VideoFrame, AudioData APIs) are not supported
880
+ 3. **Web Workers Required**: This package requires Web Workers and AudioWorklet for video processing. Browsers without Worker support (or missing MediaStreamTrackProcessor, VideoFrame, or OffscreenCanvas) are not supported
880
881
  4. **No Fallback**: The package does not include a fallback for browsers without Web Worker support. Ensure your target browsers meet the minimum requirements
881
882
 
882
883
  For detailed browser compatibility information, API requirements, and known limitations, see [BROWSER_COMPATIBILITY.md](./BROWSER_COMPATIBILITY.md).
@@ -0,0 +1,37 @@
1
+ class AudioCaptureProcessor extends AudioWorkletProcessor {
2
+ process(inputs) {
3
+ const input = inputs[0];
4
+ if (!input?.length) {
5
+ return true;
6
+ }
7
+
8
+ const bufferLength = input[0].length;
9
+ const numberOfChannels = input.length;
10
+ const combinedBuffer = new Float32Array(bufferLength * numberOfChannels);
11
+
12
+ for (let channel = 0; channel < numberOfChannels; channel++) {
13
+ combinedBuffer.set(input[channel], channel * bufferLength);
14
+ }
15
+
16
+ const arrayBuffer = combinedBuffer.buffer.slice(
17
+ 0,
18
+ combinedBuffer.length * Float32Array.BYTES_PER_ELEMENT
19
+ );
20
+
21
+ this.port.postMessage(
22
+ {
23
+ type: "audioData",
24
+ data: arrayBuffer,
25
+ sampleRate,
26
+ numberOfChannels,
27
+ duration: bufferLength / sampleRate,
28
+ bufferLength: combinedBuffer.length,
29
+ },
30
+ [arrayBuffer]
31
+ );
32
+
33
+ return true;
34
+ }
35
+ }
36
+
37
+ registerProcessor("audio-capture-processor", AudioCaptureProcessor);