无法设置本地答案sdp:调用错误状态:STATE_INPROGRESS

我有两个客户:

1)Windows 7 PC上的Chrome(版本50.0.2661.102米)
2)Android平板电脑上的Chrome(版本50.0.2661.89)

两者都在同一个networking中(所以不需要STUN / TURN服务器)。

我使用我自己的信号服务器与Node.js(webSocket)在与Centos 6的VirtualBox VM上构build。

客户之间的video/audio通信工作正常。 现在我想将一个文件从一个客户端传输到另一个客户端。 作为我的代码的基础,我在这里使用这个例子的代码

正如这段代码所暗示的,我在创buildPeerConnection之后创build了dataChannel。

function createPeerConnection() { .... myPeerConnection = new RTCPeerConnection(iceServers, optional); myDataChannel = myPeerConnection.createDataChannel('myDataChannel'); // Set up event handlers for the ICE negotiation process. myPeerConnection.onicecandidate = handleICECandidateEvent; myPeerConnection.onaddstream = handleAddStreamEvent; myPeerConnection.onnremovestream = handleRemoveStreamEvent; myPeerConnection.oniceconnectionstatechange = handleICEConnectionStateChangeEvent; myPeerConnection.onicegatheringstatechange = handleICEGatheringStateChangeEvent; myPeerConnection.onsignalingstatechange = handleSignalingStateChangeEvent; myPeerConnection.onnegotiationneeded = handleNegotiationNeededEvent; myPeerConnection.ondatachannel = handleDataChannel; myDataChannel.onmessage = handleDataChannelMessage; myDataChannel.onopen = handleDataChannelOpen; } ... ... function invite(peerId) { ... createPeerConnection(); ... } ... ... function handleVideoOfferMsg(msg) { thereIsNegotiation = true; targetUsername = msg.name; // Call createPeerConnection() to create the RTCPeerConnection. log("Starting to accept invitation from " + targetUsername); createPeerConnection(); // We need to set the remote description to the received SDP offer // so that our local WebRTC layer knows how to talk to the caller. var desc = new RTCSessionDescription(msg.sdp); myPeerConnection.setRemoteDescription(desc) .then(function(stream) { log("-- Calling myPeerConnection.addStream()"); return myPeerConnection.addStream(localStream); }) .then(function() { log("------> Creating answer"); // Now that we've successfully set the remote description, we need to // start our stream up locally then create an SDP answer. This SDP // data describes the local end of our call, including the codec // information, options agreed upon, and so forth. return myPeerConnection.createAnswer(); }) .then(function(answer) { log("------> Setting local description after creating answer"); // We now have our answer, so establish that as the local description. // This actually configures our end of the call to match the settings // specified in the SDP. return myPeerConnection.setLocalDescription(answer); }) .then(function() { var msg = { name: clientId, room: roomId, target: targetUsername, type: "video-answer", sdp: myPeerConnection.localDescription }; // We've configured our end of the call now. Time to send our // answer back to the caller so they know that we want to talk // and how to talk to us. log("Sending answer packet back to other peer"); sendToServer(msg); }) .catch(handleGetUserMediaError); } 

当第二个客户提出要约时,第一个客户在尝试做出答案时,我得到错误

打开相机和/或麦克风时出错:设置本地应答失败spd:无法按下传输说明:提供了本地指纹,但没有可用的身份标识。

要么

打开相机和/或麦克风时出错:未能设置本地应答spd:调用错误状态:STATE_INPROGRESS

只有一次创作成功了。

我必须在其他地方创buildDataChannel吗? 像这儿 :

 function handleICEConnectionStateChangeEvent { switch(myPeerConnection.iceConnectionState) { ... case "connected": createDataChannel(); break; } } function createDataChannel(){ myDataChannel = myPeerConnection.createDataChannel('myDataChannel'); myPeerConnection.ondatachannel = handleDataChannel; myDataChannel.onmessage = handleDataChannelMessage; myDataChannel.onopen = handleDataChannelOpen; } 

有什么build议么?

       

网上收集的解决方案 "无法设置本地答案sdp:调用错误状态:STATE_INPROGRESS"