EnterpriseFeatures/videoconf/android

Ask tech team
From QuickBlox Developers (API docs, code samples, SDK)
Jump to: navigation, search

Contents

Multiparty Video Conferencing feature overview

Quickblox provides the Multiparty Video Conferencing solution which allows setting up video conference between 10-12 people. It's built on top of WebRTC SFU technologies.

Multi-conference server is available only for Enterprise plans, with additional fee. For more information and if you want request a Demo please contact us at https://quickblox.com/contact/ .

Features supported

  • Video/Audio Conference with 10-12 people
  • Join-Rejoin video room functionality (like Skype)
  • Mute/Unmute audio/video stream (own and opponents)
  • Display bitrate
  • Switch video input device (camera)

Code samples

There are ready-to-go FREE code samples to help you better understand how to integrate multiparty video conferencing capabilities in your apps:

Prerequisites

Multiparty Video Conferencing API is based on top of regular Video Calling API, so it's good to learn its API as well.

Connect SDK

For using Video Conferencing feature you should add a dependency: сompile “com.quickblox:quickblox-android-sdk-conference:$rootProject.qbSdkVersion”

Create session

ConferenceClient client = ConferenceClient.getInstance(getApplicationContext());
 
 // Create session with Video or Audio type conference 
QBRTCTypes.QBConferenceType conferenceType = isVideoCall
       ? QBRTCTypes.QBConferenceType.QB_CONFERENCE_TYPE_VIDEO
       : QBRTCTypes.QBConferenceType.QB_CONFERENCE_TYPE_AUDIO;
 
client.createSession(userID, conferenceType, new ConferenceEntityCallback<ConferenceSession>() {
   @Override
 
   public void onSuccess(ConferenceSession session) {
       ProgressDialogFragment.hide(getSupportFragmentManager());
       webRtcSessionManager.setCurrentSession(session);
       Log.d(TAG, "DialogActivity setCurrentSession onSuccess() session getCurrentUserID= " + session.getCurrentUserID());
 
       CallActivity.start(DialogsActivity.this, dialogID, occupants, asListener);
   }
 
   @Override
   public void onError(WsException responseException) {
       ProgressDialogFragment.hide(getSupportFragmentManager());
       showErrorSnackbar(R.string.join_conference_error, null, null);
   }
});

ConferenceClient instance is a client model responsible for managing conference session.

ConferenceClient has a setAutoSubscribeAfterJoin option, which means your client will be subscribing to all online publishers after join to some room.

ConferenceSession is a session within certain video room, managing all current processes.

Callbacks

In order to have an ability to receive callbacks about current ConferenceSession instance state and conference events, you should implement appropriate interfaces:

Implement RTCSessionStateCallback for tracking connection stat:

QBRTCSessionStateCallback sessionStateCallback = new QBRTCSessionStateCallback<ConferenceSession>() {
   @Override
   public void onStateChanged(ConferenceSession conferenceSession, BaseSession.QBRTCSessionState qbrtcSessionState) {
 
   }
QBRTCSessionStateCallback sessionStateCallback = new QBRTCSessionStateCallback<ConferenceSession>() {
 
/** * Called when session state is changed */             
@Override
            public void onStateChanged(ConferenceSession conferenceSession, BaseSession.QBRTCSessionState qbrtcSessionState) {
 
            }
 
/** * Called in case when connection closed with certain user. */
            @Override
            public void onConnectedToUser(ConferenceSession conferenceSession, Integer integer) {
 
            }
 
            @Override
            public void onDisconnectedFromUser(ConferenceSession conferenceSession, Integer integer) {
 
            }
 
            @Override
            public void onConnectionClosedForUser(ConferenceSession conferenceSession, Integer integer) {
 
            }
        };
 
currentSession.addSessionCallbacksListener(sessionStateCallback); 
currentSession.removeSessionCallbacksListener(sessionStateCallback);
 
 
Implement ConferenceSessionCallbacks for tracking conference events:
ConferenceSessionCallbacks conferenceSessionCallbacks = new ConferenceSessionCallbacks() { 
 
/** * Called when some publisher (user) joined to the video room */
 @Override public void onPublishersReceived(ArrayList<Integer> arrayList) { } 
 
/** * Called when some publisher left room */
 @Override public void onPublisherLeft(Integer integer) { } 
 
/** * Called when media - audio or video type, is received */
 @Override public void onMediaReceived(String type, boolean success) { } 
 
/** * Called when slowLink is received. SlowLink with uplink=true means you notified several missing packets from server, while uplink=false means server is not receiving all your packets. */
 @Override public void onSlowLinkReceived(boolean b, int i) { } 
 
/** * Called when received errors from server */
 @Override public void onError(WsException e) { } 
 
/** * Called when ConferenceSession is closed */ 
@Override public void onSessionClosed(ConferenceSession conferenceSession) { } }; currentSession.addConferenceSessionListener(conferenceSessionCallbacks); currentSession.removeConferenceSessionListener(conferenceSessionCallbacks);

Video and Audio tracks

For obtaining video and audio tracks implement interface RTCClientVideoTracksCallbacks and RTCClientAudioTracksCallback.

For setting video track - the ConferenceSurfaceView class is provided.

Join video room

You can join room as a listener or as a publisher. As listener you subscribe only to the publishers, not giving own video and audio streams.

QBConferenceRole conferenceRole = asListenerRole ?
 ConferenceRole.LISTENER : ConferenceRole.PUBLISHER;
 currentSession.joinDialog(dialogID, conferenceRole, new
 ConferenceEntityCallback<ArrayList<Integer>> { ... });

Subscribe/unsubscribe

For subscribing to the active publisher:

currentSession.subscribeToPublisher(publisherUserId);

Note: You should subscribe to publishers only when session state becomes connected. Use onStateChangedcallback method to track session states.

If you are a listener, then you can subscribe to publishers right after successful joinDialog.

For unsubscribing from publisher:

currentSession.unSubscribeFromPublisher(publisherUserId);

Leave

To leave current room session:

currentSession.leave();