Handle a Remote Stream

The Cordova SDK provides the following methods to handle a remote stream:

Mute or Unmute Audio of Subscribed Streams

The window.EnxRtc.muteSubscribeStreamsAudio() method allows you to mute or unmute the audio of a subscribed streams.

  • Method: muteSubscribeStreamsAudio( mute, successCallback, errorCallback )
  • Parameters:
    • mute : Boolean. Set it to true to mute audio. Set it to false to unmute audio.
    • successCallback: Callable Function. Success Notification.
    • errorCallback: Callable Function. Error Notification.

Sample Code

window.EnxRtc.muteSubscribeStreamsAudio(mute , function(data) {
console.log('Excelsior success! ' + JSON.stringify(data.data));
}, function (err) {
console.log('Uh oh… error' + JSON.stringify(err));
}
);

Active Talkers

Get The Maximum Permissible Talker Count

The window.EnxRtc.getMaxTalkers() method provides the maximum number of active talkers allowed for the room.

  • Method: getMaxTalkers()
  • Event Listener:
    • onMaxTalkerCount: Gets maximum talker allowed in a room.

Sample Code

window.EnxRtc.getMaxTalkers();
window.EnxRtc.addEventListner("onMaxTalkerCount", function(data) {
console.log(JSON.stringify(data.data));
});

Get the Talker Count

It may be necessary to know how many talkers are expected to receive onActiveTalkerList event listener, that is to know either the preset value of talkers or any custom value in effect, either by the application developer or opted by the endpoint user.

  • Method: getTalkerCount()
  • Event Listener:
    • onGetTalkerCount: Gets the talker count.

Sample Code

window.EnxRtc.getTalkerCount();
window.EnxRtc.addEventListner("onGetTalkerCount", function(data) {
console.log(JSON.stringify(data.data));
});

Set the Talker Count

The setTalkerCount(numTalkers) method is used to set the number of active talkers in the Active Talkers list to a particular value not exceeding the maximum permissible talker count. It could either be ingrained at the application level or implemented as a UI feature where the end-user can control the number of remote streams they want to receive. This method allows you to control how many streams you would like to receive.

  • Method: setTalkerCount(numTalkers)
  • Parameters:
    • numTalkers Number. Number of talkers you want to receive. Range 0-6
      • Set it to 1 to 6: To receive those many talkers in the list.
      • Set it to 0: To make sure list doesn't become empty, else you will receive 3 audio streams only. Video streams will not be carried.
  • Event Listeners:
    • onSetTalkerCount: Number of talkers.

Sample Code

window.EnxRtc.setTalkerCount(4);
window.EnxRtc.addEventListner("onSetTalkerCount", function(data) {
console.log(JSON.stringify(data.data));
});