WebRTC
Channelize.io Calls SDK includes a WebRTC service that has properties and functions related to WebRTC. This section comprises all the functions and properties related to WebRTC.
Check System Requirements
This method checks web browser compatibility. The function returns true if SDK is compatible with the current browser otherwise return false.
channelizeCall.webrtc.checkSystemRequirements();
Get Devices
This method lists the available media input and output devices such as a microphone, camera, headset, and so on.
NOTE: Some browsers allow fetching of device information only if the user has granted permissions for audio/video input devices. So you can ask the user for permissions before using the getDevices
function.
channelizeCall.webrtc.getDevices(function (devices) {
});
Callback Params
devices
Indicates a list of devices.
Set Permissions
This method ask the user for browser permissions.
channelizeCall.webrtc.setPermissions(options, function (err, res) {
if (err) {
// Permissions denied
} else {
// Permissions granted
}
});
Function Params
options
Indicates the permissions you are asking for. By default, it asks for both audio and video permissions. Set it{ audio: true, video: false }
if you only want permission for microphone.
on
This method lets you subscribe to WebRTC events.
channelizeCall.webrtc.on(event, (res) => {
});
The list of supported events is given below:
mute audio
This occurs when a user mutes the audio.
channelizeCall.webrtc.on('mute-audio', function(evt) {
var uid = evt.uid; // UserId who mutes the audio
});
unmute audio
This occurs when a user unmutes the audio.
channelizeCall.webrtc.on('unmute-audio', function(evt) {
var uid = evt.uid; // UserId who unmutes the audio
});
mute video
This occurs when a user mutes the video.
channelizeCall.webrtc.on('mute-video', function(evt) {
var uid = evt.uid; // UserId who mutes the video
});
unmute video
This occurs when a user unmutes the video.
channelizeCall.webrtc.on('unmute-video', function(evt) {
var uid = evt.uid; // user id who unmutes the video
});
off
This method lets you unsubscribe webRTC events.
channelizeCall.webrtc.off(event, callback);
Function Params
event
The event to be removed.callback
The function to be removed.