Table of Contents

Mute / Unmute Audio in a Stream

Use window.EnxRtc.muteSelfAudio() method to mute and unmute audio from Local Stream. When a user mutes or unmutes audio from her own Published Stream, Self user notifies with event onAudioEvent and all other connected users of the room are notified with event listeners onRemoteStreamAudioMute and onRemoteStreamAudioUnMute callbacks respectively. Listen to these events to update related UI elements.

Methods: muteSelfAudio(audio)

Parameters: @param {Boolean} audio –  Pass true to mute, false to unmute audio

Event Listeners:

  • onRemoteStreamAudioMute– to all participants notifying user has muted audio
  • onRemoteStreamAudioUnMute – to all participants notifying user has unmuted audio
  • onAudioEvent– to self that audio is either muted or unmuted
// To mute audio
window.EnxRtc.muteSelfAudio(true);
// To unmute audio
window.EnxRtc.muteSelfAudio(false);
// Add event listeners
// To self. Audio is muted/unmuted.
window.EnxRtc.addEventListner("onAudioEvent", function (data)
{
console.log(JSON.stringify(data.data));
});
// To all. Audio muted by Remote user
window.EnxRtc.addEventListner("onRemoteStreamAudioMute", function (data)
{
console.log(JSON.stringify(data.data));
});
// To all. Audio unmuted by Remote user
window.EnxRtc.addEventListner("onRemoteStreamAudioUnMute", function
(data)
{
console.log(JSON.stringify(data.data));});

Mute / Unmute Video in a Stream

Use window.EnxRtc.muteSelfVideo() method to mute and unmute video from Local Stream. When a user mutes or unmutes video from own Published Stream, self user notifies with event onVideoEvent and all other connected users of the room are notified with onRemoteStreamVideoMute and onRemoteStreamVideoUnMute callbacks respectively.

Methods: muteSelfVideo(video)

Parameters: @param {Boolean} video –  Pass true to mute, false to unmute video

Event Listeners:

  • onRemoteStreamVideoMute – to all participants notifying user has muted video
  • onRemoteStreamVideoUnMute – to all participants notifying user has unmuted video
  • onVideoEvent – to self that video is either muted or unmuted
// To mute video
window.EnxRtc.muteSelfVideo(true);
// To unmute video
window.EnxRtc.muteSelfVideo(false);
//Add event listeners// To self. Video is muted/unmuted.
window.EnxRtc.addEventListner("onVideoEvent", function (data)
{
console.log(JSON.stringify(data.data));
});
// To all. Video muted by Remote user
window.EnxRtc.addEventListner("onRemoteStreamVideoMute", function (data)
{
console.log(JSON.stringify(data.data));
});
// To all. Video unmuted by Remote user
window.EnxRtc.addEventListner("onRemoteStreamVideoUnMute", function
(data)
{
console.log(JSON.stringify(data.data));
});