Socket.io DOMEException:未能执行';setRemoteDescription';在';RTPeerConnection';:无法设置远程应答sdp:在错误状态下调用:稳定

Socket.io DOMEException:未能执行';setRemoteDescription';在';RTPeerConnection';:无法设置远程应答sdp:在错误状态下调用:稳定,socket.io,video-streaming,webrtc,video-conferencing,Socket.io,Video Streaming,Webrtc,Video Conferencing,我无法显示远程流。 我添加了localstream到对等连接,但由于此问题,我无法显示远程流。 DomeException:未能在“RTPeerConnection”上执行“setRemoteDescription”:未能设置远程应答sdp:在错误状态下调用:稳定 if (signal.sdp) { connections[fromId].setRemoteDescription(new RTCSessionDescription(signal.sdp)).then(()

我无法显示远程流。 我添加了localstream到对等连接,但由于此问题,我无法显示远程流。 DomeException:未能在“RTPeerConnection”上执行“setRemoteDescription”:未能设置远程应答sdp:在错误状态下调用:稳定

if (signal.sdp) {
            connections[fromId].setRemoteDescription(new RTCSessionDescription(signal.sdp)).then(() => {
                if (signal.sdp.type === 'offer') {
                    connections[fromId].createAnswer().then((description) => {
                        connections[fromId].setLocalDescription(description).then(() => {
                            socket.emit('signal', fromId, JSON.stringify({ 'sdp': connections[fromId].localDescription }));
                        }).catch(e => console.log(e));
                    }).catch(e => console.log(e));
                }
            }).catch(e => console.log(e));
        }

        if (signal.ice) {
            connections[fromId].addIceCandidate(new RTCIceCandidate(signal.ice)).catch(e => console.log(e));
        }