omnitalk_sdk 0.0.6 copy "omnitalk_sdk: ^0.0.6" to clipboard
omnitalk_sdk: ^0.0.6 copied to clipboard

omnitalk-webrtc-sdk

Omnitalk SDK #

Flutter package for real-time communication API, based on WebRTC.

Easy way to integrate flutter_webrtc in your app.

Features #

  • create session
  • create room
  • join room
  • publish
  • subscribe

Pre-Requisite #

  • flutter_webrtc ^0.9.24
  • This sdk is developed under Flutter 3.7.6, Dart 2.19.3
  • omnitalk service id, service key
  • compatible library version 21+

Getting started #

0. Set your minimum sdk requirements #

Go to android>app>build.gradle in your working directory.

// compileSdkVersion flutter.compileSdkVersion
compileSdkVersion 33

// minSdkVersion flutter.minSdkVersion
minSdkVersion 21

1. Omnitalk Service ID, Key #

  1. Visit omnitalk.io
  2. Sign up for an Omnitalk account
  3. Create service card to get service id and service key
  • You can get a test key for 1 hour
Test Key
Click orange button

2. Import omnitalk_sdk in your app #

Add following lines to pubspec.yaml under dependencies

dependencies:
    omnitalk_sdk: ^0.0.6
    flutter_webrtc ^0.9.24

or you can add it by runnning code below in terminal.

flutter pub add omnitalk_sdk

3. Initialize Omnitalk instance with your service id and key #

final Omnitalk omnitalk;
omnitalk = Omnitalk(service id, service key)

4. Get your RTCVideoRenderer #

Omnitalk supports 32 users at the same time.

Declare renderers and pass them publish() for local or subscribe() for remote according to its use.

Usage #

To establish a real time video conference using Omnitalk's platform (with plans to introduce features such as audio calls, conferences, and more), the following methods may be useful.

1) create session

Argument 'user_id' is optional. If you don't put user_id, omnitalk will give you a random id.

session = await omnitalk.createSession(user_id);

2) create room & join the room

Make a room and join the room. You can get a room list first before make a room. You can also pass a room subject, room secret if you want.

roomObj = await omnitalk.createRoom(subject: roomSubject);
roomId = roomObj?["room_id"];
await omnitalk.joinRoom(room_id: roomId);

3) publish

By publishing you start broadcasting. Pass the RTCVideoRenderer localrenderer and add it in your UI widget.

publishIdx = await omnitalk.publish(
        callType: "videocall", record: false, localRenderer: localVideo);



 //in your widget
Container(
            color: Colors.grey,
            height: 200,
            width: 160,
            child: displayOn ? RTCVideoView(localVideo) : null,
          ),

4) subscribe

To subscribe other broadcasting, pass the publish index. You can get publish_index by listening 'BROADCASTING_EVENT' from server. Or you can get participants' list before you subscribe.

 var partiResult = await omnitalk.partiList(roomId);

    for (var parti in partiResult) {
      int pubIdx = parti["publish_idx"];
      partiList.add(pubIdx);
    }

    for (int i = 0; i < partiList.length; i++) {
        int pubidx = partiList[i];

        await omnitalk.subscribe(
            publishIdx: pubidx, remoteRenderer: remoteVideos[i]);
        setState(() {
        flags[i] = true;
        count++;
    });
    }

Feedback #

If you have any issues or suggestions, visit our github repo and create an issue.

Additional information #

For more information, visit omnitalk.io