79287643

Date: 2024-12-17 11:13:20
Score: 0.5
Natty:
Report link

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;

        }
      })

    }
Reasons:
  • Contains signature (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: vrobbi