|
1 | 1 | # ultravox-client-sdk-react-native |
2 | | -React native client SDK for Ultravox. |
| 2 | +React Native client SDK for [Ultravox](https://ultravox.ai). |
| 3 | + |
| 4 | +[](https://www.npmjs.com/package/ultravox-react-native) |
| 5 | + |
| 6 | +## Installation |
| 7 | + |
| 8 | + |
| 9 | +```sh |
| 10 | +npm install ultravox-react-native |
| 11 | +``` |
| 12 | + |
| 13 | + |
| 14 | +## Usage |
| 15 | + |
| 16 | + |
| 17 | +```js |
| 18 | +import { useUltravox } from 'ultravox-react-native'; |
| 19 | + |
| 20 | +// ... |
| 21 | + |
| 22 | + const { joinCall, leaveCall } = useUltravox(); |
| 23 | + |
| 24 | + useEffect(() => { |
| 25 | + joinCall(joinUrl).catch((error) => { |
| 26 | + console.error('Failed to join call:', error); |
| 27 | + }); |
| 28 | + |
| 29 | + return () => { |
| 30 | + leaveCall().catch((error) => { |
| 31 | + console.error('Failed to leave call:', error); |
| 32 | + }); |
| 33 | + }; |
| 34 | + }, [joinUrl, joinCall, leaveCall]); |
| 35 | +``` |
| 36 | + |
| 37 | +See the included example app for a more complete example. To get a `joinUrl`, you'll want to integrate your server with the [Ultravox REST API](https://docs.ultravox.ai) |
| 38 | + |
| 39 | +## Testing SDK Changes |
| 40 | + |
| 41 | +This repo includes a basic example application that can be used with the SDK. To run it from the main directory: |
| 42 | + |
| 43 | +```bash |
| 44 | +npm install --force |
| 45 | +cd example |
| 46 | +npm run android |
| 47 | +npm run start -- --tunnel |
| 48 | +``` |
| 49 | + |
| 50 | +An Expo server will start, from which you can open an Android build on your connected device. |
| 51 | + |
| 52 | +## Publishing |
| 53 | + |
| 54 | +1. Test using the example app. |
| 55 | +1. Bump version in `package.json`. |
| 56 | +1. `npm publish --dry-run --git-checks=false` |
| 57 | +1. Open PR, get changes merged, then continue from `main`. |
| 58 | +1. `npm publish` |
| 59 | +1. Create a new Tag and Release on GitHub please. |
0 commit comments