ガイド
Capacitor で Streamcall を使う方法
@capgo/capacitor-stream-call の使い方
使用: https://getstream.io/ Capacitor で通話機能を実装するには SDK を使用します。
インストール
bun add @capgo/capacitor-stream-call
bunx cap sync
bunx cap sync プラグインのネイティブcodeをネイティブプロジェクトにコピーします。プラグインをアップグレードするたびに再度実行してください。
インポート
import { StreamCall } from '@capgo/capacitor-stream-call';
API の概要
| メソッド | 説明 |
|---|---|
login |
Stream Video サービスにログインします。 |
logout |
Stream Video サービスからログアウトします。 |
call |
他のユーザーへの通話を開始します。 |
endCall |
現在の通話を終了します。 |
joinCall |
既存の通話に参加します。 |
setMicrophoneEnabled |
マイクを有効化/無効化します。 |
setCameraEnabled |
カメラの有効/無効を切り替えます。 |
enableBluetooth |
Bluetoothオーディオを有効にします。 |
acceptCall |
着信に応答します。 |
rejectCall |
着信を拒否します。 |
isCameraEnabled |
カメラが有効かどうかを確認します。 |
getCallStatus |
現在の通話ステータスを取得します。 |
getRingingCall |
現在着信中の通話を取得します。 |
toggleViews |
利用可能なビデオレイアウトを切り替えます。 |
setSpeaker |
スピーカーフォンをオンにします。 |
switchCamera |
カメラを切り替えます。 |
getCallInfo |
発信者情報を含む、アクティブな通話の詳細を取得します。 |
setDynamicStreamVideoApikey |
静的なキーを上書きする動的な Stream Video API キーを設定します。 |
getDynamicStreamVideoApikey |
現在設定されている動的な Stream Video API キーを取得します。 |
getCurrentUser |
現在のユーザーの情報を取得します。 |
例
login()
Stream Video サービスにログインします。
import { StreamCall } from '@capgo/capacitor-stream-call';
await StreamCall.login({
token: 'your-token',
userId: 'user-123',
name: 'John Doe',
apiKey: 'your-api-key'
});
logout()
Stream Video サービスからログアウトします。
import { StreamCall } from '@capgo/capacitor-stream-call';
await StreamCall.logout();
call()
他のユーザーへの通話を開始します。
import { StreamCall } from '@capgo/capacitor-stream-call';
await StreamCall.call({
userId: 'user-456',
type: 'video',
ring: true
});
endCall()
現在の通話を終了します。
import { StreamCall } from '@capgo/capacitor-stream-call';
await StreamCall.endCall();
joinCall()
既存の通話に参加します。
import { StreamCall } from '@capgo/capacitor-stream-call';
await StreamCall.joinCall({ callId: 'call001', callType: 'default' });
setMicrophoneEnabled()
マイクを有効化/無効化します。
import { StreamCall } from '@capgo/capacitor-stream-call';
await StreamCall.setMicrophoneEnabled({ enabled: false });
上記の表は20個のコアメソッドを一覧にしたものです。リスナーとバージョンヘルパー、および各メソッドの完全なコントラクトは、次のドキュメントに記載されています。 GitHub リポジトリ.
イベントをリッスンする
addListener ハンドルを返します。画面がアンマウントされるときに handle.remove() 画面がアンマウントされるとき、または StreamCall.removeAllListeners() すべてのリスナーを解除します。
完全なリファレンス
@capgo/capacitor-stream-call の使用方法から続ける
使用している場合 @capgo/capacitor-stream-call の使い方 ネイティブプラグインの作業を計画するには、次と連携してください: @capgo/capacitor-stream-call @capgo/capacitor-stream-call の実装詳細については、 スタートガイド スタートガイドの実装詳細については、 Capgo プラグインディレクトリ Capgo プラグインディレクトリのプロダクトワークフローについては、 Capgo による Capacitor プラグイン Capgo による Capacitor Plugins の実装詳細、および プラグインの追加または更新 プラグインの追加または更新に関する実装詳細についてはこちら。