如何使用Temasys AdapterJS与Microsoft Edge合作

How to use the Temasys AdapterJS to work with Microsoft Edge?

本文关键字:Microsoft Edge 合作 AdapterJS 何使用 Temasys      更新时间:2024-01-07

我使用Temasys AdapterJS与Microsoft Edge合作。有人用过它吗?有人能帮我吗?此代码创建的报价:

function onIceCandidate() {
    if(event.candidate) {
        iceCandidates.push(event.candidate);
    } else {
        http
        .connect({
            id: id,
            desc: getLocalDescription(),
            ice: getIceCandidates()
        })
        .then(function(data) {
            pc.setRemoteDescription(new SessionDescription(data.desc));
            array.forEach(data.ice, function(ice) {
                pc.addIceCandidate(new IceCandidate(ice));
            });
            return data;
        })
        .catch(onError);
    }
}

有两个候选者"候选者:1 1 udp 1 0.0.0.0 9 typ endOfCandidates"。当我尝试创建答案时,我收到以下错误:DOMException:处理ICE候选者时出错

有人知道为什么要增加这两位候选人吗?

sdp报价形成如下:

v=0
o=thisisadapterortc 8169639915646943137 2 IN IP4 127.0.0.1
s=-
t=0 0
m=audio 9 UDP/TLS/RTP/SAVPF 104 9 106 0 8 103 97 13 118 101
c=IN IP4 0.0.0.0
a=rtcp:9 IN IP4 0.0.0.0
a=rtpmap:104 SILK/16000
a=rtcp-fb:104 x-message app send:dsh recv:dsh
a=rtpmap:9 G722/8000
a=rtcp-fb:9 x-message app send:dsh recv:dsh
a=rtpmap:106 OPUS/48000/2
a=rtcp-fb:106 x-message app send:dsh recv:dsh
a=rtpmap:0 PCMU/8000
a=rtcp-fb:0 x-message app send:dsh recv:dsh
a=rtpmap:8 PCMA/8000
a=rtcp-fb:8 x-message app send:dsh recv:dsh
a=rtpmap:103 SILK/8000
a=rtcp-fb:103 x-message app send:dsh recv:dsh
a=rtpmap:97 RED/8000
a=rtpmap:13 CN/8000
a=rtpmap:118 CN/16000
a=rtpmap:101 telephone-event/8000
a=rtcp-mux
a=ice-ufrag:IYVg
a=ice-pwd:bdVmapCbC5RoHpUEZV/alNHC
a=setup:actpass
a=fingerprint:sha-256 89:F6:17:47:CA:69:2E:8A:73:DD:05:91:68:9B:0A:61:72:2A:9D:CE:07:61:74:9C:D6:7A:CD:33:12:C0:72:86
a=mid:g7svev9ig3
a=recvonly
a=ssrc:1001 cname:ulxmndn6vb
m=video 9 UDP/TLS/RTP/SAVPF 122 123
c=IN IP4 0.0.0.0
a=rtcp:9 IN IP4 0.0.0.0
a=rtpmap:122 X-H264UC/90000
a=rtcp-fb:122 x-message app send:src,x-pli recv:src,x-pli
a=rtpmap:123 x-ulpfecuc/90000
a=rtcp-mux
a=ice-ufrag:+5BB
a=ice-pwd:RTkgr1+iK09AOSArgK5f+KV+
a=setup:actpass
a=fingerprint:sha-256 7C:1B:A4:1C:FC:96:7B:2C:8B:1D:C2:96:AA:07:33:9A:F9:13:1A:22:68:6A:57:53:02:D9:55:90:8E:80:7E:03
a=mid:35x7e5ynh9
a=recvonly
a=ssrc:3003 cname:ulxmndn6vb

如果它不包含任何带有候选者的行,这正常吗?例如"a=候选者:…"并且不包含任何ip地址?因为我又收到一个错误:DOMException:设置远程提供sdp:会话失败错误代码:error_CONTENT。会话错误描述:无法设置远程视频描述发送参数

应该创建答案的代码:

socket.on('add offer', function (data) {
    received_offer(data.id, data.desc);
    console.log(data.ice);
    for(var i = 0, l = data.ice.length; i < l; i++) {
        // Do I need to add these ice candidates?
        //if(false === /0'.0'.0'.0/.test(data.ice[i].candidate)) {
            pc[data.id].addIceCandidate(new ice_candidate(data.ice[i]));
        //}
    }
});
navigator.getUserMedia(
    {audio: true, video: true},
    function(s) {
        stream = s;
        document.getElementById("stream").src = URL.createObjectURL(stream);
    },
    function(error) {console.error(error)}
);
function received_offer(id, desc) {
    pc[id] = new peer_connection({iceServers: [
        {url: "stun:stun.l.google.com:19302"}
    ]});
    pc[id].onicecandidate = on_ice_candidate.bind(null, id);
    pc[id].addStream(stream);
    console.log(desc.sdp);
    pc[id].setRemoteDescription(new session_description(desc), function() {
        pc[id].createAnswer(
            create_answer_success.bind(null, id),
            create_answer_error,
            {
                "mandatory": {
                    "OfferToReceiveAudio": true,
                    "OfferToReceiveVideo": true
                },
                    "optional": [{
                    "DtlsSrtpKeyAgreement": true
                }]
            }
        );
    }, function(err) {
        console.log(err);
    });
}
function create_answer_success(id, desc) {
    pc[id].setLocalDescription(desc);
}
function create_answer_error(error) {
    console.error("create_answer_error(): error:", error);
}
function on_ice_candidate(id, event){
    if (event.candidate) {
        if(!ice[id]) ice[id] = [];
        ice[id].push(event.candidate);
    } else {
        var res = {id: id ,desc: pc[id].localDescription ,ice: ice[id]};
        socket.emit('answer', res);
    }
}

我不明白怎么了?谢谢

您是否正在尝试将Edge连接到Chrome/FFirefox?

目前,边到边连接仅起作用。请注意,Edge对createOffer()、createAnswer()、setLocalDescription()和setRemoteDescription()使用promise。

对于Edge案例:

pc.createOffer(offerOptions).then(createOfferSuccessCb).catch(createOfferFailreCb);

Temasys AdapterJS从webrtc/adapter编译代码库,以跟上最新技术。

有关详细信息,请参阅此github链接:https://github.com/webrtc/adapter/issues/165

"设置远程视频描述发送参数失败"是由于Chrome没有正确处理未知视频编解码器造成的。看见https://bugs.chromium.org/p/webrtc/issues/detail?id=4957目前,Edge和任何其他浏览器之间都没有视频编解码器的互操作性。

可以安全地忽略具有typ endOfCandidate的ice候选项。这是一个特定于边缘的破解。