QuickBlox Documentation

QuickBlox provides powerful Chat API and SDK to add real-time messaging and video calls to your web and mobile apps. Learn how to integrate QuickBlox across multiple platforms.

Advanced

Learn how to mute audio, disable video, switch camera and audio output, etc.

🚧

This is our new documentation for beta version of QuickBlox React Native SDK. Please contact our Customer Support Team to provide your feedback, suggestions, and requests to improve this page.

Mute audio

Mute the audio by calling enableAudio() method with sessionId, userId, and enable parameters. Using this method we can tell SDK to send/not send audio data either from a local or remote peer in the specified call session.

QB.webrtc
  .enableAudio({ sessionId, userId, enable: false })
  .then(() => { /* muted audio successfully */ })
  .catch(e => { /* handle error */ })

Parameters

Description

sessionId

Call session identifier.

userId

ID of the user. This is an optional parameter. If userId is not passed to this method, a local audio stream is muted/unmuted. If userId is passed, a remote audio stream is muted/unmuted (by userid provided).

enable

Boolean parameter. true is enabled, false is disabled.

Disable video

Turn off the video by calling the enableVideo() method with sessionId, userId, and enable parameters. Using this method we can tell SDK not to send video data either from a local or remote peer in the specified call session. The video is disabled when the argument is set to false and enabled when true.

QB.webrtc
  .enableVideo({ sessionId, userId, enable: false })
  .then(() => { /* muted video successfully */ })
  .catch(e => { /* handle error */ })

Parameters

Description

sessionId

Call session identifier.

userId

(optional) ID of the user. If userId is not passed to this method, a local video stream is turned on/off. If userId is passed, a remote video stream is rendered/not rendered (by userId provided).

enable

Boolean parameter. true is enabled, false is disabled.

Switch camera

You can switch the video camera during a call (by default is front camera) by passing switchCamera() with sessionId parameter.

QB.webrtc
  .switchCamera({ sessionId })
  .then(() => { /* camera switched successfully */ })
  .catch(e => { /* handle error */ })

Parameters

Description

sessionId

Call session identifier.

Mirror local video

Mirror functionality allows to flip the video horizontally. Enable the mirror by setting mirror prop as true.

import WebRTCView from 'quickblox-react-native-sdk/RTCView'
//...
render() {
  //...
  <WebRTCView
    mirror={true}
    sessionId={sessionId}
    style={styles.video}
    userId={userId}
  />
  //...
}

Parameters

Description

mirror

Boolean parameter. true is enabled, false is disabled.

sessionId

Call session identifier.

style

View style.

userId

ID of the user.

Switch audio output

You can switch the audio output to a loudspeaker or to ear-speaker during a call.

QB.webrtc
  .switchAudioOutput({ output: QB.webrtc.AUDIO_OUTPUT.LOUDSPEAKER })
  .then(() => { /* audio should now go through loudspeaker */ })
  .catch(e => { /* handle error */ })

Custom ICE servers

🚧

This feature is coming soon. Please check back later. For more updates and questions, feel free to contact our Customer Support Team.

General settings

You can change different settings for your calls using QB.rtcconfig class. All of them are listed below.

Answer time interval

If an opponent hasn't answered you within an answer time interval, the QB.webrtc.EVENT_TYPE.NOT_ANSWER event type will be received. The answer time interval shows how much time an opponent has to answer your call. Set the answer time interval using the code snippet below.

QB.rtcconfig
  .setAnswerTimeInterval(30) // value should be a number and should be >= 10
  .then(function () { /* success */ })
  .catch(function (error) { /* handle error */ }

Get the answer time interval using the code snippet below.

QB.rtcconfig
  .getAnswerTimeInterval()
  .then(function (interval) { })
  .catch(function (error) { /* handle error */ })

📘

By default, the answer time interval is 60 seconds.
The minimum value is 10 seconds.

Dialing time interval

Dialing time interval indicates how often to notify your opponents about your call. Set the dialing time interval using the code snippet below.

QB.rtcconfig
  .setDialingTimeInterval(5) // value should be a number and should be >= 3
  .then(function () { /* success */ })
  .catch(function (error) { /* handle error */ })

Get the dialing time interval using the code snippet below.

QB.rtcconfig
  .getDialingTimeInterval()
  .then(function (interval) { })
  .catch(function (error) { /* handle error */ })

📘

By default, the dialing time interval is 5 seconds.
The minimum value is 3 seconds.

Updated 3 months ago


What's Next

Video Conference

Advanced


Learn how to mute audio, disable video, switch camera and audio output, etc.

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.