Skip to content

Commit 90731d2

Browse files
msluszniakclaude
andcommitted
fix: update react-native-audio-api usage for v0.11.6 API changes
- AudioRecorder constructor no longer accepts options - Move sampleRate/bufferLength/channelCount to onAudioReady options - Rename 'allowBluetooth' iOS option to 'allowBluetoothHFP' Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent ba31249 commit 90731d2

1 file changed

Lines changed: 8 additions & 11 deletions

File tree

apps/llm/app/voice_chat/index.tsx

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,7 @@ function VoiceChatScreen() {
3737
const [isRecording, setIsRecording] = useState(false);
3838
const [liveTranscription, setLiveTranscription] = useState('');
3939

40-
const [recorder] = useState(
41-
() =>
42-
new AudioRecorder({
43-
sampleRate: 16000,
44-
bufferLengthInSamples: 1600,
45-
})
46-
);
40+
const [recorder] = useState(() => new AudioRecorder());
4741

4842
const { setGlobalGenerating } = useContext(GeneratingContext);
4943

@@ -60,7 +54,7 @@ function VoiceChatScreen() {
6054
AudioManager.setAudioSessionOptions({
6155
iosCategory: 'playAndRecord',
6256
iosMode: 'spokenAudio',
63-
iosOptions: ['allowBluetooth', 'defaultToSpeaker'],
57+
iosOptions: ['allowBluetoothHFP', 'defaultToSpeaker'],
6458
});
6559
AudioManager.requestRecordingPermissions();
6660
}, []);
@@ -74,9 +68,12 @@ function VoiceChatScreen() {
7468
setIsRecording(true);
7569
setLiveTranscription('');
7670

77-
recorder.onAudioReady(({ buffer }) => {
78-
speechToText.streamInsert(buffer.getChannelData(0));
79-
});
71+
recorder.onAudioReady(
72+
{ sampleRate: 16000, bufferLength: 1600, channelCount: 1 },
73+
({ buffer }) => {
74+
speechToText.streamInsert(buffer.getChannelData(0));
75+
}
76+
);
8077
recorder.start();
8178

8279
let finalResult = '';

0 commit comments

Comments
 (0)