peers / peerjs

Simple peer-to-peer with WebRTC.
https://peerjs.com
MIT License
12.38k stars 1.43k forks source link

Echo soltuion in peer js #646

Closed veezo2007pk closed 4 years ago

veezo2007pk commented 4 years ago

i have these two code which make the call, i need to know who i can cancel the echo audio?

  function makeCall(callerID, isVideoCall) {
        console.log("Calling..." +  callerID)

        var options = {audio: true};
        if(isVideoCall)
            options['video'] = true;

        initializeLocalMedia(options, function() {
            myapp.showVideoCall(options)
            var call = peer.call(callerID, window.localStream, { 'metadata' : options });
            callConnect(call)
        });
    }

function initializeLocalMedia(options, callback) {

    if(options) {
        options['audio'] = true;
        if(options['video'])
            options['video'] = true;
    } else {
        options['audio'] = true;
        options['video'] = false;
    }

    // Get audio/video stream
    navigator.getUserMedia(options, function(stream) {
        // Set your video displays
        window.localStream = stream;
        myapp.setMyVideo(window.localStream)
        if(callback)
            callback();
    }, function(err) {
        console.log("The following error occurred: " + err.name);
        alert('Unable to call ' + err.name)
    });
}
afrokick commented 4 years ago

sorry, it is business logic of your app, it doesn't relate to PeerJS