我正在实施网络摄像头聊天。我收到此错误Failed to set local answer sdp: Called in wrong state: STATE_SENTACCEPT
。
获取它的用户打开RTCPeerConnection
等待来自其他用户的SDP优惠,然后执行此错误发生的代码:
function receiveOffer(offer)
{
offer = new RTCSessionDescription(JSON.parse(offer));
remotePc; // defined somewhere else
remotePc.setRemoteDescription(new RTCSessionDescription(offer), function()
{
remotePc.createAnswer(function(answer)
{
remotePc.setLocalDescription(new RTCSessionDescription(answer), function()
{
// send answer
},error);
},error);
},error);
}
引发错误的行是setLocalDescription
。一般来说,有谁知道可能导致这种情况的原因?