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.
Dependencies for browser
For the library to work, you need to include a webrtc-adapter in your html beforequickblox-multiparty-video-conferencing-client-0.8.6.min.js
.
JavaScript
Initialize
In order to start working with Multiparty Video Conferencing API, you need to initialize a client.JavaScript
config
object:
Field | Required | Description |
---|---|---|
server | yes | A conference server endpoint or array of endpoints. |
debug | no | Enables logging. true is enabled. false is disabled. |
iceServers | no | A list of ICE servers. |
To request your server endpoint, contact us by mail: enterprise@quickblox.com.
Create session
Once the library has been initialized, you can start creating a session. Typically, each browser tab will need a single session with the server. Once the session is created, you can interact with a Video Conferencing API.JavaScript
Attach video conferencing plugin
Video conferencing allows you to exploit features of the plugin to manipulate the media sent and/or received by peer connection on your web page. This method will create a plugin handle that you can subscribe to and handle events. You also have to attach the plugin to each remote user.JavaScript
To attach the plugin to a local user plugin, set
userId
to null
and isRemote
to false
.JavaScript
Event | Description |
---|---|
plugin.events.CONSENT_DIALOG | This event is triggered just before the getUserMedia() method is called and after it is completed. This means it can be used to modify the UI accordingly. For example, to prompt the user to accept the device access requests. |
plugin.events.MEDIA_STATE | This event is triggered when the media server starts or stops receiving your media. For example, a mediaState with type=audio and on=true means that the media server started receiving your audio stream or started getting it again after a pause of more than a second. A mediaState with type=video and on=false means that the media server hasn’t received any video from you in the last second after a start. This event is useful to figure out when the media server actually started handling your media, or to detect problems on the media path (for example,, media never started, or stopped at some point of time time). |
plugin.events.WEBRTC_STATE | This event is triggered with a true value when the PeerConnection associated with a handle becomes active (so ICE, DTLS and everything else succeeded) from the media server perspective. A false value is triggered when the PeerConnection goes down instead. This event is useful to figure out when WebRTC is actually up and running between you and the media server. In case of the false value, a reason of the String type may be present as an optional parameter. |
plugin.events.SLOW_LINK | This event is triggered when the media server reports trouble associated with either sending or receiving media on the specified PeerConnection. Typically, it is triggered as a consequence of too many NACKs received from/sent to the user in the last second. For example, a slowLink with uplink=true means you notified several missing packets from the media server, while uplink=false means the media server is not receiving all your packets. This event is useful to figure out when there are problems on the media path (for example,, excessive loss), in order to react accordingly (for example,, decrease the bitrate if most of our packets are getting lost). |
plugin.events.ICE_STATE | This event is triggered when the ICE state for the PeerConnection associated with the handle changes. Thus, the argument of the callback is a new state of the String type (for example,, “connected” or “failed”). |
plugin.events.DETACHED | The plugin handle has been detached by the plugin itself, and so should not be used anymore. |
plugin.events.CLEANUP | The WebRTC peer connection with the plugin was closed. |
Join video room
To jump into a video conference room, join it using thejoin()
method.
JavaScript
joinParams
object:
Field | Required | Description |
---|---|---|
roomId | yes | A room ID, should be of String type. |
userId | yes | A user ID, should be of Number type. |
display | no | A name to be shown to other participants, should be of String type. |
onlyAudio | no | Specifies whether to use the audio only. A Boolean parameter. Default: false . |
role | no | A user role. Possible values are subscriber or publisher . Default: publisher . |
video | no | A video property. Default: lowres . See this section for more information. |
QBVideoConferencingClient
.
JavaScript
QBVideoConferencingClient
has the following properties:
Property | Description |
---|---|
connected | Returns a boolean indicating whether the client is connected to the server or not. |
pluginId | Returns a unique plugin ID for the current user. |
sessionId | Returns a current session ID indicating if there is a session. |
currentRoomId | Returns a current room ID. |
List online participants
To list online users in a video conference room, use thelistOnlineParticipants()
method.
JavaScript
Events
There is a number of events you can subscribe to. You can inspect the propertyevents
to check the list of supported events. To assign an event handler, you can use the same API as for NodeJS EventEmitter.
JavaScript
Event | Description |
---|---|
client.events.PARTICIPANT_JOINED | A participant has joined a conference room. |
client.events.PARTICIPANT_LEFT | A participant has left a conference room. |
client.events.LOCAL_STREAM | A local MediaStream is available and ready to be displayed. |
client.events.REMOTE_STREAM | A remote MediaStream is available and ready to be displayed. |
client.events.SESSION_DESTROYED | A conference session has been destroyed. |
JavaScript
Mute remote audio
You also can mute/unmute a remote user’s audio.JavaScript
Disable local video
You can enable/disable your own video.JavaScript
Disable remote video
You also can enable/disable a remote user’s video.JavaScript
Display bitrate
There is a way to show a video bitrate of a remote user. It will start updating theinnerText
of the video element every second with the bitrate in ‘kbps’ for the remote user (if found by userId
). Thus, the following string will be shown in the video element: 180 kbits/sec.
JavaScript
innerText
of the video element and stop updating the bitrate.
JavaScript
List video input devices
To get a list of all video input devices (cameras), use the following code snippet.JavaScript
List audio input devices
To get a list of all audio input devices (microphones), use the following code snippet.JavaScript
Switch video input device
In order to switch a video camera, you have to obtain a list of currently plugged video cameras withlistVideoInputDevices()
method. See this section to learn how to list video input devices. Then, call the switchVideoInput()
.
JavaScript
Switch audio input device
In order to switch a microphone, you have to obtain a list of currently plugged microphones with thelistAudioInputDevices()
method. See this section to learn how to list audio input devices. Then, call the switchAudioInput()
.
JavaScript
Screen sharing
In order to start sharing your screen call thetoggleScreenSharing()
method.
JavaScript
screenSharingEnabled()
method.
JavaScript
ICE Restart
Initiate ICE restart for a peer. This is typically needed whenever something in your network changes. For example, you move from Wi-Fi to a mobile or a different Wi-Fi but want to keep the conversation going. In this case, an ICE restart needs to take place, as peers need to exchange new candidates they can be reached on.JavaScript
Leave video room
To leave the video room, use theleave()
method.
JavaScript
Detach video conferencing plugin
When the job is done, you should detach the video conferencing plugin. ThedetachVideoConferencingPlugin()
method detaches the plugin and destroys the handle tearing down to the related peer connection if it exists.
JavaScript
Destroy session
To destroy a session, use thedestroySession()
method.
JavaScript
Camera resolution
Set a camera resolution when joining a video room using thevideo
property of the joinParams
object.
JavaScript
video
property are the following:
Property | Description |
---|---|
video | A video property. Default: lowres. The possible values are:For a small resolutionlowres (240 × 320)lowres-16:9 (180 × 320)For a normal resolutionstdres (480 × 640)stdres-16:9 (360 × 640)For a High(HD) resolutionhires, hires-16:9, hdres (720 × 1280). High(HD) resolution is only 16:9.For a full HD resolutionfhdres (1080 × 1920). Full HD resolution is only 16:9.For a 4K resolution4kres (2160 × 3840). 4K resolution is only 16:9. |