vorqard-ai-sdk 1.0.3 → 1.0.4
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vorqard-ai-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "Standalone React Native SDK for VORQARD AI Health Assistant and Report Analyzer",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"repository": {
|
|
@@ -32,8 +32,6 @@
|
|
|
32
32
|
"author": "VORQARD Developer",
|
|
33
33
|
"license": "Abhivorn Technologies",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"expo-av": "^16.0.8",
|
|
36
|
-
"expo-file-system": "~18.0.0",
|
|
37
35
|
"react-native-live-audio-stream": "^1.1.1"
|
|
38
36
|
}
|
|
39
37
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useState, useEffect, useRef, useCallback } from 'react';
|
|
2
2
|
import { Platform, PermissionsAndroid } from 'react-native';
|
|
3
3
|
import { mediaDevices, RTCPeerConnection, RTCSessionDescription } from 'react-native-webrtc';
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
|
|
6
6
|
export const VOICE_STATE = {
|
|
7
7
|
IDLE: 'idle',
|
|
@@ -30,14 +30,6 @@ export const useRealtimeVoice = ({ onMessageAdded, backendUrl, userToken } = {})
|
|
|
30
30
|
setAiResponse('');
|
|
31
31
|
setUiAction(null);
|
|
32
32
|
|
|
33
|
-
// 1. Audio Session permissions (mostly needed for iOS routing)
|
|
34
|
-
const { status } = await Audio.requestPermissionsAsync();
|
|
35
|
-
if (status !== 'granted') {
|
|
36
|
-
setError('Microphone permission denied by Expo AV.');
|
|
37
|
-
setVoiceState(VOICE_STATE.ERROR);
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
33
|
// 1b. Explicitly request Android microphone permission using PermissionsAndroid
|
|
42
34
|
if (Platform.OS === 'android') {
|
|
43
35
|
const granted = await PermissionsAndroid.request(
|
|
@@ -57,13 +49,6 @@ export const useRealtimeVoice = ({ onMessageAdded, backendUrl, userToken } = {})
|
|
|
57
49
|
}
|
|
58
50
|
}
|
|
59
51
|
|
|
60
|
-
await Audio.setAudioModeAsync({
|
|
61
|
-
allowsRecordingIOS: true,
|
|
62
|
-
playsInSilentModeIOS: true,
|
|
63
|
-
playThroughEarpieceAndroid: false, // FORCE SPEAKERPHONE ON ANDROID
|
|
64
|
-
staysActiveInBackground: true,
|
|
65
|
-
});
|
|
66
|
-
|
|
67
52
|
// 2. Setup WebRTC Peer Connection
|
|
68
53
|
const pc = new RTCPeerConnection({
|
|
69
54
|
iceServers: [{ urls: 'stun:stun.l.google.com:19302' }],
|
|
@@ -228,9 +213,7 @@ export const useRealtimeVoice = ({ onMessageAdded, backendUrl, userToken } = {})
|
|
|
228
213
|
dcRef.current.close();
|
|
229
214
|
dcRef.current = null;
|
|
230
215
|
}
|
|
231
|
-
|
|
232
|
-
await Audio.setAudioModeAsync({ allowsRecordingIOS: false });
|
|
233
|
-
} catch (_) {}
|
|
216
|
+
|
|
234
217
|
|
|
235
218
|
setVoiceState(VOICE_STATE.IDLE);
|
|
236
219
|
}, []);
|