Video Conferencing
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.
Features supported
- 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)
- Switch audio input device (microphone)
Get started with SDK
Follow the Getting Started guide on how to connect ConnectyCube SDK and start building your first app.
Code samples
There is ready-to-go FREE code sample to help you better understand how to integrate video calling capabilities in your apps:
- Video Chat code sample for React Native src code
Preparations
Set up config
In order to start working with Multiparty Video Conferencing API you need to initialize a client:
Default multiparty server endpoint is wss://janus.connectycube.com:8989 (see).
Connect WebRTC lib
To make calling works under React Native, we use react-native-webrtc lib.
You need to strictly follow the react-native-webrtc Installation guide in order to make it works properly. You need to follow the Manual linking part. If you face any troubles - this issue might help you https://github.com/ConnectyCube/connectycube-reactnative-samples/issues/274
RN 0.62
In a case you face any unexpected crashes with React Native 0.62 and WebRTC lib - there is a Flipper related crash and a working solution.
Connect WebRTC lib
For Android - there is nothing extra required. Android Cordova WebView supports all the WebRTC API stack.
For iOS - a cordova-plugin-iosrtc has to be used.
Create meeting
In order to have a conference call, a meeting object has to be created.
- As for
attendees
- either ConnectyCube users ids or external emails can be provided. - If you want to schedule a meeting - pass
start_date
andend_date
. - Pass
chat: true
if you want to have a chat connected to meeting. - Pass
record: true
if you want to have a meeting call recorded. Read more about Recording feature https://connectycube.com/2021/02/23/connectycube-releases-server-side-calls-recording-along-with-new-meetings-api/
Once meeting is created, you can use meeting._id
as a conf room identifier in the below requests when join a call.
Create call session
Once a meeting is created/retrieved, you can create a conf call session:
Once a session is created, you can interact with a Video Conferencing API.
Access local media stream
In order to have a video chat session you need to get an access to the user’s devices (webcam / microphone):
This method lets the browser ask the user for permission to use devices. You should allow this dialog to access the stream. Otherwise, the browser can’t obtain access and will throw an error for getUserMedia
callback function.
For more information about possible audio/video constraints, here is a good code sample from WebRTC team how to work with getUserMedia constraints: https://webrtc.github.io/samples/src/content/getusermedia/resolution/
Attach local media stream
Then you should attach your local media stream to a video element:
Join room
To jump into video chat with users you should join it:
To check current joined video room use the following property:
Join as listener
It can be a requirement where it needs to join a room as listener only, w/o publishing own media stream. It can be useful for a case with a teacher and many students where normally students join a call as listeners and only a teacher publishes own media stream:
List online participants
To list online users in a room:
Events
There are 6 events you can listen for:
Mute/Unmute audio
You can mute/unmute your own audio:
Mute/Unmute video
You can mute/unmute your own video:
List of devices
Switch video cameras
Switch audio output
- connect and install https://github.com/react-native-webrtc/react-native-incall-manager lib
- Use
InCallManager
class to switch audio output:
Also, pay attention to InCall Manager lib if you need to use one of the options below:
- Manage devices events like wired-headset plugged-in state, proximity sensors and expose functionalities to javascript.
- Automatically route audio to proper devices based on events and platform API.
- Toggle speaker or microphone on/off, toggle flashlight on/off
- Play ringtone/ringback/dtmftone
Screen Sharing
Request a desktop stream by calling getDisplayMedia
:
In React Native, the getDisplayMedia method does not accept constrains as a parameter due to react-native-webrtc limitations.
If the local stream already exists, the next call to getUserMedia or getDisplayMedia will update the tracks in the stream and preserve the track’s enabled state for the audio track.
Screen Sharing on Android
Follow this guide to configure Screen Sharing on Android and this to support Screen Capture on Android 10+. Call the getDisplayMedia
after starting a ForegroundService:
Screen Sharing on iOS
Preform the Screen Sharing integration for iOS guide from Jitsi. Use <ScreenCapturePickerView>
component from ‘react-native-webrtc’ to prepare:
Get remote user bitrate
Get remote user mic level
Leave room and destroy conf session
To leave current joined video room:
Retrieve meetings
Retrieve a meeting by id:
Retrieve a list of meetings:
Edit meeting
A meeting creator can edit a meeting:
Delete meeting
A meeting creator can delete a meeting:
Recording
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/
Retrieve recordings with download url
Continue call in background
If you are developing dedicated apps for iOS and Android - it’s required to apply additional configuration for the app to keeping the call alive when it goes into the background.
**iOS: **
There is no way to continue a video call in background because of some OS restrictions. What is supported there is to continue with voice calling while an app is in background. Basically, the recommended to achieve this is to switch off device camera when an app goes to background and then switch camera on back when an app goes to foreground.
Furthermore, even voice background call are blocked by default on iOS. To unblock - you need to setup proper background mode capabilities in your project. Please find the Enabling Background Audio link with more information how to do it properly. Generally speaking, you need to enable Voice over IP
and Remote notifications
capabilities:
**Android: **
For Android, we also recommend to implement the same camera switch flow when go to background and then return to foreground.
To keep the call while in background, we recomment to use the react-native-background-actions library.
The flow is the following:
- when start a call or go background -> display notification
- when stop call or return to foreground -> hide notification