This feature is available for customers on the Enterprise plan only. Take advantage of Enterprise features to unlock new value and opportunities for users. For more information and if you want to request a Demo, please contact us by mail: enterprise@quickblox.com.
- Video/Audio Conference with 10-12 people.
- Join/Rejoin video room functionality (like Skype).
- Mute/Unmute audio/video stream.
- Switch video input device (camera).
Initialize
In order to start working with Multiparty Video Conferencing API, you need to initialize the conference module by calling theinit() method. The conference module allows to process conference calls. If the module is not initialized, it will not be able to create the session and process calls consequently.
You must call the
init() method before calling any other methods. If you attempt to call a method without initializing the module, the error is returned.Dart
| Argument | Required | Description |
|---|---|---|
| conferenceServer | yes | A conference server endpoint. |
Manage calls
To process events such as a received video track, you should subscribe to an event(s) first and assign an event handler. If you’ve subscribed to the event(s), you receiveStreamSubscription that you should unsubscribe when you need, for example, in the dispose() method.
You can subscribe to several events at the same time. However, you should handle these events as different subscriptions. For example, if you subscribe to three events, you should call three subscribeConferenceEvent() methods. And if you need to unsubscribe from these three events, you should have the same number of unsubscriptions.
Dart
| Event | Description |
|---|---|
| QBConferenceEventTypes.CONFERENCE_VIDEO_TRACK_RECEIVED | A remote video track has been received by the remote participant. |
| QBConferenceEventTypes.CONFERENCE_PARTICIPANT_RECEIVED | A new participant has joined a conference session. |
| QBConferenceEventTypes.CONFERENCE_PARTICIPANT_LEFT | A participant has left a conference session. |
| QBConferenceEventTypes.CONFERENCE_ERROR_RECEIVED | An error was received. |
| QBConferenceEventTypes.CONFERENCE_CLOSED | A conference session was closed. |
| QBConferenceEventTypes.CONFERENCE_STATE_CHANGED | A conference session state has been changed. |
Create session
To be able to interact with the Video Conferencing API, you need to create a conference session by calling thecreate() method. Each conference session is tied to a specific dialogId taken from the QuickBlox Chat. See this section for more information about dialogs.
It is important to store the current session in the
session variable to be able to interact with the current conference session. For example, if you don’t store the current session, you won’t be able to hang up or reject a call.Dart
| Argument | Required | Description |
|---|---|---|
| sessionType | yes | Conference session type: QBConferenceSessionTypes.VIDEO, QBConferenceSessionTypes.AUDIO. |
| dialogId | yes | ID of the dialog. Taken from the QuickBlox Chat. |
Join video room
Once a conference session is created, you need to establish a call. To establish a call, you need to join an already-created conference session by calling thejoinAsPublisher() method. This method joins the session and publishes your feed making you an active publisher in the room. Everyone in the room will be able to subscribe and receive your feed. Once the room is joined, you receive an array of participants’ IDs.
Make sure to subscribe to each participant to be able to receive video/audio tracks from them. If you don’t subscribe, you won’t receive audio and video of the participant joined to the room. See this section for more information.
Dart
| Argument | Required | Description |
|---|---|---|
| sessionId | yes | Conference session ID. Received from the QBConferenceRTCSession object that is returned in the response to the create() method. |
Subscribe
Use thesubscribeToParticipant() method to subscribe to a participant.
Dart
| Argument | Required | Description |
|---|---|---|
| sessionId | yes | Conference session ID. |
| userId | yes | User ID. Taken from the array of participants’ IDs received in the responce to the joinAsPublisher() method. |
Unsubscribe
Use theunsubscribeFromParticipant() method to unsubscribe from the participant’s audio/video track.
Dart
| Argument | Required | Description |
|---|---|---|
| sessionId | yes | Conference session ID. |
| userId | yes | User ID. Taken from the array of participants’ IDs received in the responce to the joinAsPublisher() mthod. |
Set up video view
Set up theConferenceVideoView for remote and local video tracks to be able to show the video. The ConferenceVideoView allows displaying the video stream while the ConferenceVideoViewController allows to control the video view. Thus, you can play, release the video stream from video view.
- A remote video track represents a remote peer video stream from a remote camera app. Specify the initial value to
ConferenceVideoView-RTCVideoViewControllerfor the remote camera app of the remote peer. There can be multiple remote video tracks in the conference call. In this case, you should set up theConferenceVideoViewfor each remote video track individually. - A local video track represents a local peer video stream from a local camera app. Specify the initial value to
ConferenceVideoView-RTCVideoViewControllerfor the local camera app of the remote peer. There can be only one local video track in the conference call.
Dart
QBConferenceEventTypes.CONFERENCE_VIDEO_TRACK_RECEIVED event. Thus, once the SDK receives data that a remote video track was received, it creates the event of CONFERENCE_VIDEO_TRACK_RECEIVED type with userId and sessionId properties. See this section to learn how to subscribe the event.
After this, invoke method play() and pass sessionId and userId parameters to it. If the userId matches with the one in properties, the video starts playing.
Dart
| Argument | Required | Description |
|---|---|---|
| sessionId | yes | Conference session ID. |
| userId | yes | The ID of the local peer. |
| opponentId | yes | The ID of the remote peer. |
Mute local audio
You can mute/unmute your own audio by using theenableAudio() method.
Dart
| Argument | Required | Description |
|---|---|---|
| sesssionId | yes | Conference session ID. |
| enabled | no | Boolean parameter. Allows to enable/disable a local audio. |
Disable local video
You can enable/disable your own video by using theenableVideo() method.
Dart
| Argument | Required | Description |
|---|---|---|
| sessionId | yes | Conference session ID. |
| enabled | no | Boolean parameter. Allows to enable/disable a local video. |
Switch video input device
You can switch a video input to the rear or front camera. The SDK automatically finds all cameras and chooses the two cameras with the highest video quality. Call theswitchCamera() method to switch between the two cameras.
Dart
| Argument | Required | Description |
|---|---|---|
| sessionId | yes | Conference session ID. |
Switch audio output device
You can switch an audio output. Call theswitchAudioOutput() method and pass the type of the audio device to it.
You can switch the audio input only after calling the
create() method.Dart
| Argument | Required | Description |
|---|---|---|
| output | yes | Type of the audio device:QBConferenceAudioOutputTypes.EARSPEAKER ,QBConferenceAudioOutputTypes.LOUDSPEAKER ,QBConferenceAudioOutputTypes.HEADPHONES,QBConferenceAudioOutputTypes.BLUETOOTH. |
Leave video room
To leave the video room, use theleave() method. After calling this method, the current session is deleted from SDK and you can’t access this session any more.
Dart
| Argument | Required | Description |
|---|---|---|
| sessionId | yes | Conference session ID. |
Release resource
If you don’t want to receive and process video calls, for example, when a user is logged out or theConferenceVideoView is going to close, you have to release the conference module. Call the release() method that allows to unregister the conference module from receiving any video conference events and closes existing signaling channels.
If you want to create another conference session after the release() method, you should call the init() method first to initialize the conference module. After the module is initialized, you can create another conference session by calling the create() method.
Dart
The
release() method should be called when a video track is no more valid. If you don’t call this method, you will get a memory leak.