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

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 镍氢电池充电器设计实物使用原理
  • ¥15 逻辑谓词和消解原理的运用
  • ¥15 三菱伺服电机按启动按钮有使能但不动作
  • ¥15 js,页面2返回页面1时定位进入的设备
  • ¥200 关于#c++#的问题,请各位专家解答!网站的邀请码
  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?