Failed to set local answer sdp: Called in wrong state: kStable

后端 未结 2 1705
旧巷少年郎
旧巷少年郎 2020-12-16 11:57

for a couple of days I\'m now stuck with trying to get my webRTC client to work and I can\'t figure out what I\'m doing wrong. I\'m trying to create multi peer webrtc client

2条回答
  •  情书的邮戳
    2020-12-16 12:54

    You're sending the answer here:

    .then( function (answer) { return self.peerConns[peerId].setLocalDescription(answer); } )
    

    Look at mine:

         var callback = function (answer) {
             createdDescription(answer, fromId);
         };
         peerConnection[fromId].createAnswer().then(callback).catch(errorHandler);
    
    
        function createdDescription(description, fromId) {
            console.log('Got description');
    
            peerConnection[fromId].setLocalDescription(description).then(function() {
                console.log("Sending SDP:", fromId, description);
                serverConnection.emit('signal', fromId, {'sdp': description});
            }).catch(errorHandler);
        }
    

提交回复
热议问题