webrtc 原生的js怎么调用AEC 消除回音模块

//获取音视频.
function getUserMedia() {
try {
navigator.getUserMedia({
'audio' : true,
'video' : pVideo
}, onUserMediaSuccess, onUserMediaError);
} catch (e) {
try {
navigator.getUserMedia("video,audio", onUserMediaSuccess, onUserMediaError);
} catch (e) {
alert(e.message);
console.log(e);
}
}
}

    //加载本地 视频
    function onUserMediaSuccess(stream) {
        console.log("User has granted access to local media.");
        var url = URL.createObjectURL(stream);
        localVideo.style.opacity = 1;
        localVideo.src = url;
        localStream = stream;
        if (initiator)
            maybeStart();
    }

    //创建 PeerConnection
    function createPeerConnection() {

        try {
            pc = new RTCPeerConnection(pc_config);
            pc.onicecandidate = onIceCandidate;
        } catch (e) {
            try {
                var stun_server = "";
                if (pc_config.iceServers.length !== 0) {
                    stun_server = pc_config.iceServers[0].url.replace('stun:', 'STUN ');
                }
                pc = new RTCPeerConnection(stun_server, onIceCandidate);
                isRTCPeerConnection = false;
                console.log("Created webkitPeerConnnection00 with config \"" + stun_server + "\".");
            } catch (e) {
                alert("Failed to create PeerConnection, exception: " + e.message);
                return;
            }
        }
        pc.onconnecting = onSessionConnecting;
        pc.onopen = onSessionOpened;
        pc.onaddstream = onRemoteStreamAdded;
        pc.onremovestream = onRemoteStreamRemoved;
    }

2个回答

在video标签里面加了个mute属性

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问