Learn how to mute audio, disable video, switch camera, share your screen, configure media settings, etc.
localMediaStream.audioTrack.enabled()
method. 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.
QBRTCSession
methods (assuming that they are existent).
localMediaStream.videoTrack.enabled()
. Using this method, we can tell SDK not to send video data either from a local or remote peer in the specified call session.
QBRTCAudioSession
class. This class is represented as singleton and you can always access a shared session by calling the instance()
method.
QBRTCAudioSession
class header for more information.
setConfiguration()
method.
setConfiguration()
method accepts the configuration
argument of the object type with the following fields:
Field | Required | Description |
---|---|---|
categoryOptions | no | Audio session category options allow to tailor the behavior of the active audio session category. Default: allowBluetooth. See Apple documentation to learn about supported values. |
mode | no | Audio session mode allows to assign specialized behavior to an audio session category. Default: videoChat. See Apple documentation to learn about supported values. |
setActive()
, method accepts the following argument:
Agrument | Required | Description |
---|---|---|
isActive | yes | Boolean paramater. Set the true to activate an audio session. |
setConfiguration()
accepts the following arguments:
Argument | Required | Description |
---|---|---|
configuration | yes | Audio session configuration object. You can set the configuration object fields. See this section to learn how to set audio session configuration. |
isActive | yes | Boolean paramater. Set the true to activate an audio session. |
Argument | Required | Description |
---|---|---|
isActive | yes | Boolean paramater. Set the true to activate an audio session. |
AVAudioSessionModeVideoChat
mode or speaker.
Argument | Required | Descriotion |
---|---|---|
receiver/speaker | yes | State for the current audio category. |
self.screenCapture
should be a property of QBRTCVideoCapture
class type.
RPScreenRecorder
supports 60 fps, you must set it to 30 or lower.QBRTCVideoCapture
class allows sending frames to your opponents. By inheriting this class you are able to provide custom logic to create frames, modify them, and then send to your opponents. Below you can find an example of how to implement a custom video capture and send frames to your opponents (this class is designed to share 5 screenshots per second).
setStatsReportTimeInterval()
method below.
QBRTCStatsReport
instance for the current period of time.
statsString()
, you will receive a generic report string, which will contain the most useful data to debug a call, for example:
CN
Connection info.VS
Video sent.VR
Video received.AvgQP
Average quantization parameter (only valid for video; it is calculated as a fraction of the current delta sum over the current delta of encoded frames; low value corresponds with good quality; the range of the value per frame is defined by the codec being used).AS
Audio sent.AR
Audio received.audioReceivedOutputLevel
for that.
Take a look at the QBRTCStatsReport
header file to see all of the other stats properties that can be useful for you.
QBRTCAudioSession
instance for that task. See Manage audio session section for more information.
Initializing audio session
You must initialize audio session every time before you call the reportNewIncomingCall(with:update:completion:)
method of CXProvider
showing the incoming call screen. Before initializing the audio session, set useManualAudio
property value to YES
. This will not activate WebRTC audio before iOS allows it. You will need to activate audio manually later. See Manage audio session section for more information.
Managing audio session activations
CXProviderDelegate
has 2 delegate methods that you must conform to:
provider(_:didActivate:)
provider(_:didDeactivate:)
QBRTCAudioSessionActivationDelegate
protocol of QBRTCAudioSession
class, you need to notify that the session was activated outside of it. The provider(_:didActivate:)
is a CXProviderDelegate
where we need to activate our audio manually. Set audioEnabled
property of QBRTCAudioSession
class in here, to enable WebRTC audio as iOS has pushed audio session priority of our app to the top.
CXProvider
deactivates it in provider(_:didDeactivate)
of CXProviderDelegate
. Deinitializing audio session earlier would lead to issues with the audio session.
QBRTCAudioSession
somewhere else in your app, you can check and ignore it with QBRTCAudioSessionActivationDelegate
audioSessionIsActivatedOutside()
method. By this, you will know for sure that CallKit is in charge of your audio session. Do not forget to restore QBRTCAudioSession
properties to default values in provider(_:perform:)
method of CXProviderDelegate
.
QBRTCConfig
class. All of them are listed below.
session(_:userDidNotRespond:)
and session(_:connectionClosedForUser:)
delegate methods will be called. 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.
QBRTCVideoCodecVP8
- VP8 video codecQBRTCVideoCodecH264Baseline
- h264 baseline video codecQBRTCVideoCodecH264High
- h264 high video codecformatsWithPosition()
method in order to get all supported formats for a current device.
QBRTCVideoFormat
.
Parameters | Description |
---|---|
width | Video width. Default: 640. |
height | Video hight. Default: 480. |
frameRate | Video frames per second. Default: 30. |
pixelFormat | Video pixel format. Default: QBRTCPixelFormat420f |
formats(with:)
. Set a needed one from the list using the snippet below,
QBRTCAudioCodecOpus
QBRTCAudioCodecISAC
QBRTCAudioCodeciLBC
QBRTCAudioCodecOpus
is set.