1

我使用 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);
    }
}

在它的候选人中有两个候选人' candidate:1 1 udp 1 0.0.0.0 9 typ endOfCandidates '。当我尝试创建答案时,我收到以下错误:DOMException: Error processing ICE Candidate

有人知道为什么要添加这两个候选人吗?

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=candidate:...' 并且不包含任何 IP 地址,这是否正常?因为我又收到一个错误:DOMException: Failed to set remote offer sdp: Session error code: 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);
    }
}

我无法理解有什么问题?谢谢!

4

2 回答 2

2

您是否尝试将 Edge 连接到 Chrome / Firefox?

目前,Edge to Edge 连接仅适用。请注意,Edge 对 createOffer()、createAnswer()、setLocalDescription() 和 setRemoteDescription() 使用 Promise。

对于边缘情况:

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

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

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

于 2016-04-06T04:04:37.730 回答
1

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

可以安全地忽略类型为 endOfCandidates 的冰候选。这是一个特定于边缘的 hack。

于 2016-04-06T05:21:41.600 回答