Skip to content

Multiparty Video Conferencing feature overview

ConnectyCube Multiparty Video Conferencing API is built on top of WebRTC protocol and based on top of WebRTC SFU architecture.

Max people per Conference call is 12.

Video Conferencing is available starting from Advanced plan.

To get a difference between P2P calling and Conference calling please read our ConnectyCube Calling API comparison blog page.

  • Video/Audio Conference with up to 12 people
  • Join-Rejoin video room functionality (like Skype)
  • Guest rooms
  • Mute/Unmute audio/video streams
  • Display bitrate
  • Switch video input device (camera)

ConferenceConfig class introduces new setting for Conference - conference endpoint.

ConferenceConfig.companion.url = ""

Note

Endpoint should be a correct ConnectyCube Conference server endpoint.

Use this method to get a current conference endpoint (default is nil):

ConferenceConfig.companion.url

In order to have a conference call, a meeting object has to be created.

let now = Int64(Date().timeIntervalSince1970) / 1000
let meeting = ConnectycubeMeeting()
meeting.name = "My meeting"
meeting.startDate = now
meeting.endDate = now + 60 * 60
meeting.attendees = [ConnectycubeAttendee(id: 123, email: "superman@mail.com"), ConnectycubeAttendee(id: 124, email: "superman2@mail.com")]
meeting.record = false
meeting.chat = false
meeting.public_ = true
meeting.scheduled = false
// meeting.notify = true //notify feature is available starting from the [Advanced plan](https://connectycube.com/pricing/)
// meeting.notifyBefore = ConnectycubeNotifyBefore(metric: ConnectycubeMeetingMetric.hours, value: 1) //notify feature is available starting from the [Advanced plan](https://connectycube.com/pricing/)
ConnectyCube().createMeeting(meeting: meeting, successCallback: { createdMeeting in
let confRoomId = createdMeeting.id
}, errorCallback: { error in })

Once meeting is created, you can use meeting.id as a conf room identifier in the below requests when join a call.

Conference module has its own client which is described in current part.

Conference client delegate is inherited from base client delegate and has all of its protocol methods implemented as well.

All protocol methods below have their own explanation inlined and are optional.

/**
* Called when session state has been changed.
*
* @param session P2PSession instance
* @param state session state
*
*/
func onStateChanged(session: BaseSession<AnyObject>, state: BaseSessionRTCSessionState) {}
/**
* Called in case when connection with opponent is established
*
* @param session P2PSession instance
* @param userId ID of opponent
*/
func onConnectedToUser(session: BaseSession<AnyObject>, userId: Int32) {}
/**
*
* Called in case when connection failed with user
*
* @param session P2PSession instance
* @param userId ID of opponent
*/
func onDisconnectedFromUser(session: BaseSession<AnyObject>, userId: Int32) {}
/**
*
* Called in case when connection is closed for user
*
* @param session P2PSession
* @param userId ID of opponent
*/
func onConnectionClosedForUser(session: BaseSession<AnyObject>, userId: Int32) {}
/**
*
* Called when received remote video track from user
*
* @param videoTrack ConnectycubeVideoTrack instance
* @param userId ID of user
*/
func onRemoteVideoTrackReceive(session: BaseSession<AnyObject>, videoTrack: ConnectycubeVideoTrack, userId: Int32) {}
/**
*
* Called when received remote audio track from user
*
* @param videoTrack ConnectycubeAudioTrack instance
* @param userId ID of user
*/
func onRemoteAudioTrackReceive(session: BaseSession<AnyObject>, audioTrack: ConnectycubeAudioTrack, userId: Int32) {}

Conference client delegate protocol methods

Section titled “Conference client delegate protocol methods”

All protocol methods below are conference client specific, optional to be implemented and have their own explanation inlined.

/**
* Called when some publisher (user) joined to the video room
*/
func onPublisherLeft(userId: KotlinInt?) {}
/**
*Called when some publisher left room
*/
func onPublishersReceived(publishers: [KotlinInt]?) {}
/**
*Called when media - audio or video type, is received
*/
func onMediaReceived(type: String?, success\_ success: Bool) {}
/**
* 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.
*/
func onSlowLinkReceived(uplink: Bool, lost: Int32) {}
/**
* Called when received errors from server
*/
func onError(ex\_ ex: WsException?) {}
/**
* Called when ConferenceSession is closed
*/
func onSessionClosed(session: ConferenceBaseSession) {}

ConferenceCalls is a singleton based class which is used to create and operate with conference sessions.

//MARK: ConferenceCallback
let conferenceType = CallType.video
ConnectyCube().conferenceCalls.createSession(userId: userId, callType: conferenceType, callback: self)
extension YourClass: ConferenceCallback {
func onSuccess(result: Any?) {
let conferenceSession = result as! ConferenceSession
}
func onError(ex: WsException) {
}
}

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.

class ConferenceCallbackJoinDialog: ConferenceCallback {
func onSuccess(result: Any?) {
let userIds: [Int] = result as! [Int]
}
func onError(ex: WsException) {
}
}
let conferenceRole = ConferenceRole.publisher // or ConferenceRole.listener
conferenceSession.joinDialog(dialogId: dialogId, conferenceRole: conferenceRole, callback: ConferenceCallbackJoinDialog())

To list online users in a room:

class CallbackOnlineParticipants: ConferenceCallback<NSDictionary> {
override func onSuccess(result: NSDictionary?) {
// the result contains the dictionary where key is the userId and value is true if this user is publisher and false if listener
}
override func onError(ex: WsException) {}
}
conferenceSession.getOnlineParticipants(callback: CallbackOnlineParticipants())

ConferenceSession is inherited from base session class, and has all of its basics, such as state, currentUserId, localMediaStream, ability to get remote audio and video tracks for a specific user IDs.

You can subscribe and unsubscribe from publishers using methods below.

conferenceSession.subscribeToPublisher(publisherId: publisherId)
conferenceSession.unsubscribeFromPublisher(publisherId: publisherId)

And in order to close/leave session you can perform the following method:

conferenceSession.leave()

Note

You do not need to be joined as publisher in order to perform subscription based operations in session.

You can disable/enable audio during a call:

conferenceSession?.mediaStreamManager?.localAudioTrack?.enabled = !(conferenceSession?.mediaStreamManager?.localAudioTrack!.enabled)!

You can disable/enable video during a call:

conferenceSession?.mediaStreamManager?.localVideoTrack?.enabled = !(conferenceSession?.mediaStreamManager?.localVideoTrack!.enabled)!

You can switch the video capture position during a call (default: front camera):

conferenceSession?.mediaStreamManager?.videoCapturer?.switchCamera()

Stats reporting is an insanely powerful tool which can help to debug a call if there are any problems with it (e.g. lags, missing audio/video etc.). To enable stats report you should first set stats reporting frequency using WebRTCConfig method below:

//Coming soon
//ConnectycubeStatsReport

Monitoring mic level and video bitrate using Stats

Section titled “Monitoring mic level and video bitrate using Stats”

Also, we prepared the helpful manager ConnectycubeStatsReport for processing Stats reports and getting some helpful information like the opponent’s mic level and video bitrate.

For its work, you just need to configure the WebRTCConfig as described above. Then create the instance of ConnectycubeStatsReportsManager and initialize it with the call session.

//Coming soon
//ConnectycubeStatsReportsManager

Server-side recording is available. Read more about Recording feature https://connectycube.com/2021/02/23/connectycube-releases-server-side-calls-recording-along-with-new-meetings-api/

sample-videochat-conference-objc is a great example of our ConnectyCubeCalls Conference module, classes to look at: CallViewController.