React Native SDK
Live voice with a VoiceMint agent from a React Native app, wrapping the native SDKs.
React Native 0.71+, Android and iOS (Expo: a development build, not Expo Go). Wraps the Android and iOS SDKs. Source: github.com/alphaaiservice/voicemint-react-native (MIT).
Install#
Not on npm yet:
npm install github:alphaaiservice/voicemint-react-native#0.1.0
cd ios && pod installUntil the native SDKs are published, also build voicemint-android into Maven Local (./gradlew publishToMavenLocal) and add the two VoiceMintCore / VoiceMint pods from GitHub to your Podfile, as on the iOS page. Once published: npm install @voicemint/react-native.
Talk#
import { VoiceMintSession, requestMicrophonePermission } from '@voicemint/react-native';
if (!(await requestMicrophonePermission())) return;
const { ws_url, token } = await myApi.voicemintToken(agentId); // from YOUR backend
const session = new VoiceMintSession({ token, wsUrl: ws_url });
session.onTranscript((role, text, isFinal) => isFinal && console.log(role, text));
await session.start();Also mute, sendText, stop, and onState, onAgentAudioLevel, onError, onEnd (each returns an unsubscribe function).