React Native
Stork Live · tested 2026-12-02
Stork Live in a React Native or Expo app.
Before you start
A React Native or Expo app. In a native build (a bare React Native app or an Expo development build) the avatar is drawn by the native iOS and Android SDKs. In Expo Go, which cannot load native code, it is drawn by the web client in a web view. The component and its calls are the same either way. The face (about 8 MB) is downloaded on first use and then cached, so the first load needs a network connection.
Install
npm install stork-live-react-nativeiOS: React Native 0.75 or newer, and platform :ios, '16.0' in your Podfile (React Native's default is lower), then pod install. A warning about static linking is expected.
Android: minSdkVersion 26 (React Native's template has 24) and a device with OpenGL ES 3.0.
Expo Go only: also run npx expo install react-native-webview.
Code
// npm install stork-live-react-native
// Native iOS and Android view; in Expo Go also: npx expo install react-native-webview
import { StorkLiveAvatar } from 'stork-live-react-native'
const face = useRef(null)
<StorkLiveAvatar
ref={face}
avatar="a"
style={{ width: 340, height: 340 }}
onReady={() => face.current.speak({ url: 'https://example.com/reply.mp3' })}
/>| Call | Use it for |
|---|---|
| face.current.speak({ url }) | An audio file, such as a text-to-speech reply. |
| face.current.pushAudio(base64Pcm16, sampleRate) | A live voice agent. Forward each piece of 16-bit mono PCM as it arrives; the default rate is 24000. |
| face.current.stop() | Stop speaking and drop queued audio, for example when the user interrupts. |
Check it works
A face that blinks, with the Powered by stork.ai mark in the corner. When your audio plays, the lips move.
If it does not
- You hear the voice twice. The avatar plays the sound itself. Do not also play the same audio in the app.
- The iOS build fails on the deployment target. Set platform :ios, '16.0' in the Podfile and run pod install again.
- The Android build fails on minSdkVersion. Set minSdkVersion to 26.
- A call does nothing or reports an error. Calls made before onReady are not queued. Wait for onReady.
- In Expo Go, the lips do not move for a file. The page inside the web view must be allowed to fetch the file (CORS).
- In Expo Go, nothing is drawn. The system web view has no WebGL 2, or there was no network on the first load.
Next
Change the letter to change the face: 'a' to 'h' are free. To use a face of your own without the mark, see Your own avatar.
