コンテンツへスキップ

Getting Started

このコンテンツはまだあなたの言語で利用できません。

  1. Install the plugin

    Terminal window
    npm i @capgo/capacitor-twilio-video
  2. Sync native platforms

    Terminal window
    npx cap sync
  3. Issue a short-lived Twilio access token from your backend

    • The plugin expects a valid Twilio Video access token before it can connect to a room.
    • Keep room creation and token issuance on your server instead of hardcoding credentials in the app.

Add the required usage descriptions on iOS:

<key>NSCameraUsageDescription</key>
<string>This app uses the camera for video calls.</string>
<key>NSMicrophoneUsageDescription</key>
<string>This app uses the microphone for video calls.</string>

On Android, request camera and microphone access before joining a room.

import { CapacitorTwilioVideo } from '@capgo/capacitor-twilio-video';
await CapacitorTwilioVideo.requestMicrophonePermission();
await CapacitorTwilioVideo.requestCameraPermission();
await CapacitorTwilioVideo.login({
accessToken: 'TWILIO_ACCESS_TOKEN',
});
await CapacitorTwilioVideo.joinRoom({
roomName: 'support-room',
enableAudio: true,
enableVideo: true,
});
await CapacitorTwilioVideo.addListener('roomConnected', ({ roomName, participantCount }) => {
console.log('Connected to room', roomName, participantCount);
});
await CapacitorTwilioVideo.addListener('participantConnected', (event) => {
console.log('Participant joined', event);
});
await CapacitorTwilioVideo.addListener('roomReconnecting', () => {
console.log('Reconnecting to Twilio Video');
});
await CapacitorTwilioVideo.setMicrophoneEnabled({ enabled: false });
await CapacitorTwilioVideo.setCameraEnabled({ enabled: true });
const status = await CapacitorTwilioVideo.getCallStatus();
console.log(status.callState, status.participantCount);
await CapacitorTwilioVideo.leaveRoom();
await CapacitorTwilioVideo.logout();
  • Use this plugin for room connection and media state, not for token generation.
  • Keep your visual call UI in your framework layer and react to plugin events.
  • Rotate access tokens from your backend so reconnects and multi-device use stay secure.