I have a demo that use mute/unmute method My demo is here: https://vrobbi-webrtc-demo.glitch.me/ It use rtcmuticonnection library
jQuery('#btn-mute-audio').click(function () {
if (document.getElementById('btn-mute-audio').value === 'mute') {
connection.attachStreams.forEach(function (stream) {
if (stream.isAudio && stream.type === 'local') {
if (connection.streamEvents[stream.streamid].isAudioMuted == false) {
stream.mute('audio');
console.log(connection.streamEvents[stream.streamid].isAudioMuted);
document.getElementById('btn-mute-audio').innerHTML = 'unmute audio';
document.getElementById('btn-mute-audio').value = 'unmute';
audio.volume = 0;
}
// stream.addTrack (tracks);
// connection.replaceTrack(tracks); // enable video again
// share again with all users
// var trackmuted = connection.streamEvents[stream.streamid].stream;
}
})
}