yaoyuanloo1 2018-11-17 02:24 采纳率: 100%
浏览 2955
已采纳

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条回答 默认 最新

  • yaoyuanloo1 2019-08-08 13:59
    关注

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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 PADS Logic 原理图
  • ¥15 PADS Logic 图标
  • ¥15 电脑和power bi环境都是英文如何将日期层次结构转换成英文
  • ¥20 气象站点数据求取中~
  • ¥15 如何获取APP内弹出的网址链接
  • ¥15 wifi 图标不见了 不知道怎么办 上不了网 变成小地球了
  • ¥50 STM32单片机传感器读取错误
  • ¥15 (关键词-阻抗匹配,HFSS,RFID标签天线)
  • ¥15 机器人轨迹规划相关问题
  • ¥15 word样式右侧翻页键消失