React Native video calling: step by step, no backend needed
Add metered 1:1 video and voice calls to a React Native app on Android and iOS in three steps: get your App Key, install the package, then TitliVideo.init() and start or join a call. The app renders <TitliCallScreen /> or drives its own UI with a hook. Server tokens are optional hardening.
What you will build
A screen that starts or joins a 1:1 call with only the App Key. The prebuilt screen joins, starts the Android ongoing-call notification, and shows the video or audio layout, a timer, the reconnecting state and an end screen. On Android the SDK asks for the microphone and camera while connecting. You do not need a server; the App Key is publishable, and a project key secret, if you add a server later, never goes into the app.
The React Native SDK is in beta (version 0.2.0 adds Quick mode). Requirements: React Native 0.76 or later (the new architecture is supported), Android 7.0 or later (minSdk 24) and iOS 15.1 or later. With Expo, use a development build; Expo Go is not supported. It installs from npm as titli-video-sdk-react-native.
Product details: React Native video call SDK.
Prerequisites
- A console account. Sign-up is self-serve. A new account starts with a welcome credit of ₹100 (INR accounts) or $1.20 (USD accounts), once per person or company, so your first test calls need no recharge.
- No backend. Quick mode needs only the App Key in your app. A server of your own is optional, for production hardening.
- A React Native 0.76+ app that builds for Android 7.0 or later (
minSdk24) and iOS 15.1 or later. - The package from npm (
titli-video-sdk-react-native).
Quick mode: add your App Key, make a call in 5 minutes
No backend needed: add your App Key in the app and start calling. A server is optional, for production hardening.
- Get your App Key. In the console, open Projects → Quick mode and add your app's package name and bundle ID. Your App Key is shown there.
- Install the package from npm (the console download is only a fallback).terminal
npm install titli-video-sdk-react-native - Init with the App Key, then start or join a call. That is all: no server, no tokens.App.tsx
import { TitliVideo } from 'titli-video-sdk-react-native'; // 1. Once, at app start TitliVideo.init({ appKey: 'tak_…', userId: 'user-42', userName: 'Asha' }); // 2. Start a video call const call = await TitliVideo.startCall({ type: 'video' }); // share call.callId with the other person // 3. On the other phone await TitliVideo.joinCall(callId);
The App Key is publishable, not a secret: it can only reach the app-facing routes, it is bound to your package name, bundle ID or website, and spend and usage caps fence it. The binding is a deterrent, not a lock (a determined attacker can copy an app's identity), so the caps are what limit the damage. For strict control, add server tokens (production hardening below). Quick mode: bindings, caps and error codes · Read the Client API (Quick mode).
Finish the install: peer packages, Android and iOS
Install the package together with the LiveKit peer packages it builds on (the SDK wraps the open-source LiveKit React Native SDK, Apache-2.0):
npm install titli-video-sdk-react-native \
@livekit/react-native@3.1.0 @livekit/react-native-webrtc@150.1.1 \
livekit-client@2.22.4 react-native-svg
cd ios && pod installThen register the WebRTC globals in index.js, before anything else:
import { setupTitliVideoSdk } from 'titli-video-sdk-react-native';
setupTitliVideoSdk(); // registers the WebRTC globalsAndroid
In MainApplication.kt, set LiveKit up before React Native starts:
import com.livekit.reactnative.LiveKitReactNative
import com.livekit.reactnative.audio.AudioType
override fun onCreate() {
super.onCreate()
LiveKitReactNative.setup(this, AudioType.CommunicationAudioType())
loadReactNative(this)
}Permissions merge in from the package's manifest (internet, microphone, camera, notifications and the foreground-service types), together with the TitliCallService foreground service that keeps a call alive when the user switches apps. If you publish on Google Play, declare the microphone and camera foreground-service use in the Play Console.
iOS
At the top of ios/Podfile, add LiveKit's spec repository, then run pod install:
source 'https://github.com/livekit/podspecs.git'
source 'https://cdn.cocoapods.org/'import livekit_react_native
// first line of didFinishLaunchingWithOptions:
LivekitReactNative.setup()Add the usage strings and the audio background mode to Info.plist. The audio mode keeps the call's sound going in the background; iOS stops the camera in the background and resumes it when the app returns.
<key>NSMicrophoneUsageDescription</key>
<string>We use the microphone so the other person can hear you on calls.</string>
<key>NSCameraUsageDescription</key>
<string>We use the camera so the other person can see you on video calls.</string>
<key>UIBackgroundModes</key>
<array><string>audio</string></array>Init and show the call screen
Init once with the App Key. On iOS, pass your bundle ID as appId; Android reads the package name itself.
import { TitliVideo } from 'titli-video-sdk-react-native';
// Once, when you know who the user is (your own id for them).
TitliVideo.init({
appKey: 'tak_…', // console → Projects → Quick mode
userId: 'user-42', // 1 to 128 of A-Z a-z 0-9 _ . : @ -
userName: 'Asha',
appId: 'com.example.app', // iOS: your bundle ID (required on iOS). Android reads it itself.
});import { TitliVideo, TitliCallScreen } from 'titli-video-sdk-react-native';
// Caller: creates the call (this user is the payer) and joins it.
const call = await TitliVideo.startCall({ type: 'video' }); // or 'audio'
sendToTheOtherPerson(call.callId); // your push, your chat, or Titli Chat calls
// The other person: joins the same call.
// const call = await TitliVideo.joinCall(callId); // { role: 'host' } joins as host
// Either side: the prebuilt screen.
<TitliCallScreen call={call} title="Asha" onClose={() => navigation.goBack()} />startCall and joinCall resolve with the same TitliCall as a token join, plus call.callId, and take the same options (audioOnly, startWithCamera, quality…). When the call ends the screen shows why, with a Close button. Theme it with brandColor and appearance (system, light or dark); every label can be replaced through the strings prop.
Build your own UI (optional)
Listen to the call's events:
import { TitliVideo, useTitliCall } from 'titli-video-sdk-react-native';
const call = await TitliVideo.startCall({
type: 'video',
audioOnly: false, // forced on for audio-call tokens
startWithMicrophone: true,
startWithCamera: true,
frontCamera: true,
foregroundService: true, // Android ongoing-call service
});
const off = call.on('callEnded', ({ reason, serverReason }) => { /* … */ });
call.on('participantJoined', ({ participant }) => {});
call.on('participantLeft', ({ participant }) => {});
call.on('reconnecting', () => {});
call.on('reconnected', () => {});
call.on('error', ({ error }) => {}); // TitliError: code + message
await call.toggleMicrophone(); // setMicrophoneEnabled(bool)
await call.toggleCamera(); // setCameraEnabled(bool)
await call.switchCamera();
await call.toggleSpeaker(); // setSpeakerOn(bool)
await call.leave();In a component, const snap = useTitliCall(call) gives state, participants, isMicrophoneEnabled, isCameraEnabled, isSpeakerOn, isAudioOnly, duration (display only), endReason and serverReason. Video quality follows your account's maximum, which is carried in the join token; our video is capped at 720p.
Audio calls
Start the call with TitliVideo.startCall({ type: 'audio' }). The call then allows only the microphone, the SDK switches to audio-only by itself, and the prebuilt screen shows the audio layout.
End the call and keep the receipt
Either person hangs up from the call screen. To end the call for everyone from the app, a participant calls TitliVideo.calls.end(callId). A call also ends by itself 30 seconds after everyone has left (a quick reconnect inside that window continues the same call), when its maximum length is reached (in Quick mode the project's Quick-mode call limit applies), or when your balance reaches zero.
Every ended call has an Ed25519-signed receipt you can keep for disputes. Receipts, like balance and usage reports, are read with the project key, so they are server-only; you also see every call in the console. With a server (production hardening), your backend can end any call and fetch its receipt:
curl -s -u "$AUTH" -X POST $API/v1/calls/<call_id>/end
curl -s -u "$AUTH" $API/v1/calls/<call_id>/receiptMore in Webhooks and signed receipts.
How billing applies
- Measured on our servers. Minutes come from the media server's own join and leave events. Nothing the app reports changes the bill.
- Per participant-minute by default: ₹0.05 for audio and ₹0.20 for video (up to 720p). A 10-minute 1:1 video call is 2 × 10 = 20 participant-minutes, so 20 × ₹0.20 = ₹4.00.
- Billed per second, and only while at least two people are connected. A person waiting alone is not billed.
- Free seconds for your users (first call and daily), if you set them on your account, are used before your balance.
- Prepaid balance. A new call or token is refused with
402when the balance cannot cover it, and live calls end when the balance runs out. It never goes below zero. - Quick-mode caps. With the App Key, the project's Quick-mode daily spend cap and each user's daily minutes, both set in the console, fence what one app or one user can spend.
The arithmetic, including call-minute billing, is worked through in Per-minute pricing explained. The rules are in Billing and usage and the price list is on the pricing page.
Troubleshooting
When a call ends, the SDK tells you why:
| End reason | When |
|---|---|
hungUp | This device left the call. |
endedByServer | The call was ended for everyone (by a participant, or by your backend if you use one), the balance reached zero, the maximum length was reached, a Quick-mode limit was hit, or an operator ended it. The exact end_reason is on the call (TitliVideo.calls.get) and in the call.ended webhook. |
removed | The call's creator (or your backend) removed this participant. |
joinedElsewhere | The same end_user_id joined from another device. |
connectionLost | The network dropped and did not recover. |
failedToConnect | The join token was invalid or expired, or there was no network. |
In Quick mode, every failed request raises one error type (TitliVideoError) carrying errorCode, userCode, userMessage (and the Hindi userMessageHi), a developer message and httpStatus. Show userMessage to your user as it is. The Quick-mode codes:
| Error code | Shown as | HTTP | When |
|---|---|---|---|
APP_KEY_INVALID | AK-401 | 401 | The App Key is missing, wrong, rotated away or disabled. |
QUICK_MODE_OFF | QM-403 | 403 | Quick mode is switched off for the project. |
APP_NOT_ALLOWED | AB-403 | 403 | This package name, bundle ID, website or signing certificate is not on the App Key's list. Add it under Projects → Quick mode. |
QUICK_DAILY_CAP_REACHED | QC-402 | 402 | The project's Quick-mode daily spend cap is reached. |
END_USER_DAILY_LIMIT | UM-429 | 429 | This user has used today's minutes. |
FORBIDDEN | FB-403 | 403 | Acting as another user, or on a call this user is not in. |
RATE_LIMITED | RL-429 | 429 | Too many requests from one device or network; wait for Retry-After. |
Retry only 429 (after Retry-After) and server errors (back off 1, 2 and 4 seconds); never retry the others. With server tokens, the API answers your server with { "error": { "code", "message" } }. The codes you are most likely to meet there:
| HTTP | Code | What to do |
|---|---|---|
401 | invalid_api_key, key_revoked, key_expired | The key ID or secret is wrong, or the key was revoked or has expired. unauthorized means no Basic auth header was sent. Check the key ID and secret on your server. |
402 | insufficient_balance, project_cap_reached | The balance is too low and the payer has no free seconds, or the project reached the daily spending cap set in the console. |
403 | calls_disabled, audio_disabled, video_disabled | The account, project or call type is switched off. |
409 | call_ended | You asked for a token on a call that has ended. Create a new call. |
429 | concurrency_limit, rate_limited | Up to 5 calls at once per account unless support raises it; 20 requests per second per key (burst 40). |
The full list is in the REST API reference and on Errors.
The native SDKs report these errors: invalidToken, tokenExpired (checked before connecting), permissionDenied (microphone or camera), connectionFailed, audioOnly (the camera was requested in an audio call) and mediaFailed. In Quick mode the SDK fetches a fresh join token itself. With server tokens, a token that expired before the user tapped Join is the most common one: mint tokens right before joining.
Production hardening (optional): server tokens
You do not need a server to start: Quick mode works with the App Key alone. Add a server when you want strict control over every call (who joins which call, for how long, in which role): keep the project key on your server and mint a short-lived join token per person there. The app uses the same SDK and hands it a token instead of the App Key. Both ways can run side by side.
The app keeps the same SDK, hook and <TitliCallScreen>; it joins with a token from your server instead of the App Key.
Create a project key
Server tokens use a project key, not the App Key. In the console, open Projects. Each project has these server values:
| Value | Where it goes |
|---|---|
App ID (app_…) | Identifies the project. Safe to log. |
Key ID (tk_…) and key secret (ts_…) | Your backend only. The secret is shown once. |
Webhook secret (whsec_…) | Your backend only, to verify webhooks. |
A project can hold two active keys, so you can rotate without downtime: create the new key, deploy it, then revoke the old one. More in Authentication and tokens.
Add a token endpoint to your server
Your server keeps the API key and calls our REST API: POST /v1/calls, then POST /v1/calls/{call_id}/tokens. This complete Node endpoint has no dependencies (Node 20 or newer) and works for every platform. It returns the two values the app needs, token and livekit_url.
// token-server.js: POST /titli/token {"type":"video"} -> {token, livekit_url, call_id}
import http from 'node:http';
const API = 'https://api-videosdk.titliapp.com';
const AUTH = 'Basic ' + Buffer.from(`${process.env.TITLI_KEY_ID}:${process.env.TITLI_KEY_SECRET}`).toString('base64');
const titli = async (path, body) => {
const r = await fetch(API + path, { method: 'POST', headers: { Authorization: AUTH, 'Content-Type': 'application/json' }, body: JSON.stringify(body) });
if (!r.ok) throw new Error(`${r.status} ${await r.text()}`);
return r.json();
};
http.createServer(async (req, res) => {
let raw = ''; for await (const c of req) raw += c;
try {
const { type = 'video' } = JSON.parse(raw || '{}');
const me = 'user_1001'; // YOUR signed-in user's id (from your own session/auth), not from the request body
const call = await titli('/v1/calls', { type, payer_end_user_id: me, max_duration_seconds: 1800 });
const t = await titli(`/v1/calls/${call.id}/tokens`, { end_user_id: me, role: 'user', name: 'Ravi' });
// Mint the other person's token the same way (role "host") and deliver it to them (push, socket, ...).
res.writeHead(200, { 'Content-Type': 'application/json' }).end(JSON.stringify({ token: t.token, livekit_url: t.livekit_url, call_id: call.id }));
} catch (e) { res.writeHead(502).end(JSON.stringify({ error: String(e.message) })); }
}).listen(8080);Take the user's identity from your own session, never from the request body, and mint the other person's token the same way with role: "host". end_user_id is your own stable, pseudonymous id (1 to 128 characters of letters, digits and _ . : @ -). Tokens expire after 10 minutes by default (ttl_seconds); that limits when a person can join, not how long they stay. Fields and limits are in the REST API reference and Authentication and tokens.
Fetch the token and show the call screen
async function fetchToken(type: 'video' | 'audio') {
const res = await fetch('https://your-server.example/titli/token', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ type }),
});
return (await res.json()) as { token: string; livekit_url: string };
}import { TitliCallScreen } from 'titli-video-sdk-react-native';
export function CallScreen({ route, navigation }) {
const { token, livekit_url } = route.params; // from fetchToken()
return (
<TitliCallScreen
url={livekit_url}
token={token}
title="Asha"
theme={{ brandColor: '#6D4AFF', appearance: 'system' }}
onEnded={(reason, serverReason) => console.log('ended', reason, serverReason)}
onClose={() => navigation.goBack()}
/>
);
}To join with your own UI, use TitliCall.join(livekitUrl, token, options); it takes the same options as startCall. For an audio call, create it with "type": "audio" on your server; fetchToken('audio') is the only change in the app.
FAQ
Do I need a backend to add video calls to a React Native app?
No. Get your App Key from the console (Projects, then Quick mode), add your package name and bundle ID, install the package, init with the App Key and start a call. A server is optional: add one later for production hardening with server tokens.
Is it safe to put the App Key in my app?
Yes, it is publishable, not a secret. It can only start and join calls and use the other app-facing features, it is bound to your package name, bundle ID or website, and the spend and usage caps you set in the console fence it. The binding is a deterrent, not a lock, so the caps are what limit any damage. For strict control, add server tokens.
What does a test call cost?
Nothing out of pocket at first: a new account gets a welcome credit of ₹100 or $1.20, once per person or company. After that, video is ₹0.20 and audio ₹0.05 per participant-minute, billed per second, only while two people are connected.
When should I add server tokens?
When you want strict control over who joins which call, for how long and in which role, or when your app charges its users per minute from a wallet. Wallet debits belong on a server you trust, not in the app. Calls themselves work with the App Key alone.
Next steps
- See requirements and the FAQ on the React Native video call SDK page.
- Everything the app can do with the App Key (calls, Live Hosts, live streams, gifts): the Client API (Quick mode).
- Optional, with a server endpoint: verify webhooks and store receipts. See Webhooks and signed receipts and the webhooks reference.
- Read the quickstart, and the REST API reference for the server routes.
- Let your users call verified hosts without running hosts yourself: the Live Hosts API uses the same join code.
- Other platforms: all SDKs, including the web SDK.
