o_zz_rtc_call 0.0.3
o_zz_rtc_call: ^0.0.3 copied to clipboard
Simple Call Kit from zegocloud.
ZegoCallKit #
Add ZegoCallKit into your project #
Add ZegoCallKit dependencies #
$ flutter pub add o_zz_rtc_call
Import the library #
import 'package:o_zz_rtc_call/o_zz_rtc_call.dart';
Setup permission configuration #
- Android
Add the lines to [project/android/app/src/main/AndroidManifest.xml]
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.zego_call_kit_example">
<!-- Add the lines below to your project\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ -->
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CAMERA" />
<!-- Add the lines above to your project/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ -->
<application
- iOS
Add the lines to [your_project/ios/Runner/Info.plist]
<dict>
<key>NSCameraUsageDescription</key>
<string>We need to use your camera to help you join the voice interaction.</string>
<key>NSMicrophoneUsageDescription</key>
<string>We need to use your mic to help you join the voice interaction.</string>
How to add 1v1 call functionality into my app? #
Using prebuilt UI widget #
Check completed example code: https://pub.dev/packages/o_zz_rtc_call/example
- Init ZegoCallKit on your application start up
ZegoCallKit().init(appID, appSign);
- Enable 1v1 call component on callkit
ZegoCallKit().enableComponent([Component.k1v1Call]);
- Listening button click callback
ZegoCallKit().component1v1Call.handUpButton.onClicked = (bool stateOn) {
// Back to home page
Navigator.pushReplacementNamed(context, '/home_page');
};
- Add participant view to your UI
child: Stack(
children: <Widget>[
SizedBox.expand(
child:
ZegoCallKit().component1v1Call.remoteView, // Get from ZegoCallKit
),
Positioned(
top: 100,
right: 16,
child: SizedBox(
width: 114,
height: 170,
child: ZegoCallKit().component1v1Call.localView, // Get from ZegoCallKit
)),
- Add call control buttons to your UI
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
// You can call Button.click in your own style button instead using the prebuilt button provided by the ZegoCallComponent.
ElevatedButton(onPressed: () {
ZegoCallKit().component1v1Call.cameraSwitchButton.click(false);
}, child: const Text('Camera Off')),
// Microphone control button
ZegoCallKit().component1v1Call.micSwitchButton,
// End call button
ZegoCallKit().component1v1Call.handUpButton,
// Camera control button
ZegoCallKit().component1v1Call.cameraSwitchButton,
],
- Start the call
ZegoCallKit().component1v1Call.startVideoCall(callID, userID, userName);