@idealyst/audio 1.2.49 → 1.2.50
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/package.json +1 -1
- package/src/recording/Recorder.native.ts +17 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@idealyst/audio",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.50",
|
|
4
4
|
"description": "Unified cross-platform audio for React and React Native - recording, playback, and PCM streaming",
|
|
5
5
|
"documentation": "https://github.com/IdealystIO/idealyst-framework/tree/main/packages/audio#readme",
|
|
6
6
|
"readme": "README.md",
|
|
@@ -105,19 +105,23 @@ export class NativeRecorder implements IRecorder {
|
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
// Create AudioRecorder from react-native-audio-api
|
|
108
|
-
this.audioRecorder = new AudioRecorder(
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
108
|
+
this.audioRecorder = new AudioRecorder();
|
|
109
|
+
|
|
110
|
+
// Set up audio data callback with config options
|
|
111
|
+
this.audioRecorder.onAudioReady(
|
|
112
|
+
{
|
|
113
|
+
sampleRate: this.config.sampleRate,
|
|
114
|
+
bufferLength: 4096,
|
|
115
|
+
channelCount: this.config.channels,
|
|
116
|
+
},
|
|
117
|
+
(event) => {
|
|
118
|
+
if (this._status.state !== 'recording') return;
|
|
119
|
+
|
|
120
|
+
// Get audio data from the event buffer
|
|
121
|
+
const float32Samples = event.buffer.getChannelData(0);
|
|
122
|
+
this.handleAudioData(new Float32Array(float32Samples));
|
|
123
|
+
}
|
|
124
|
+
);
|
|
121
125
|
|
|
122
126
|
// Set up error callback
|
|
123
127
|
this.audioRecorder.onError((error) => {
|