0

I'm using simplewebrtc for my webrtc project.

  1. Is there anyway I can mute another person's audio whenever I want and unmute it?

  2. Is there anyway I can get the stream of a particular user in a room and not of the rest in the same room?

    window.onload = function(){
    
            var room = "2";
    
    
            // Create webrtc connection
            var webrtc = new SimpleWebRTC({
                localVideoEl: 'publisher',
                remoteVideosEl: '',
                autoRequestMedia: true,
                log: true,
                debug: false,
                detectSpeakingEvents: true,
                autoAdjustMic: false
            });
    
    
            // we did not get access to the camera
            webrtc.on('localMediaError', function (err) {
            });
    
    
            // a peer video has been added
            webrtc.on('videoAdded', function (video, peer) {
                console.log('video added', peer);
    
                var remotes = document.getElementById('subscriber');
    
                if (remotes) {
                    var container = document.createElement('div');
                    container.className = 'videoContainer';
                    container.setAttribute('data-user', userType);
                    // $div.attr('data-user', streamUser.userType);
                    container.setAttribute('class', 'col-md-6 each-video'); 
                    container.id = 'container_' + webrtc.getDomId(peer);
                    container.appendChild(video);
    
                    remotes.appendChild(container);
    
    
                }
            });
    
            // a peer video has been removed
    
            // a peer video was removed
            webrtc.on('videoRemoved', function (video, peer) {
                console.log('video removed ', peer);
                var remotes = document.getElementById('subscriber');
                var el = document.getElementById(peer ? 'container_' + webrtc.getDomId(peer) : 'localScreenContainer');
                if (remotes && el) {
                    remotes.removeChild(el);
                }
            });
    
    
    
            // when it's ready and we have a room from url, join the call
            webrtc.on('readyToCall', function(){
                if(room) webrtc.joinRoom(room);
            });
    
    
            if(room){
                webrtc.createRoom(room, function(err, name){
                        if(err){
                            console.log(err);
                        }
                    });
            }
    
    
    
             }
    

I didn't find anything for my questions in their documentation. If it's possible, then it would be great!

marukobotto
  • 759
  • 3
  • 12
  • 26

0 Answers0