Remove more insanse spaghetti.

pull/25/head
Pontus Persson 2017-12-08 16:48:09 +01:00 committed by Pontus Alexander
parent d03297b0a0
commit e89393e6b0
1 changed files with 2 additions and 6 deletions

View File

@ -71,15 +71,11 @@ function setup() {
}); });
} }
function start(isCaller) { function start() {
if(isCaller) { peerConnection.createOffer().then(createdDescription).catch(errorHandler);
peerConnection.createOffer().then(createdDescription).catch(errorHandler);
}
} }
function gotMessageFromServer(signal) { function gotMessageFromServer(signal) {
if(!peerConnection) start(false);
if(signal.sdp) { if(signal.sdp) {
peerConnection.setRemoteDescription(new RTCSessionDescription(signal.sdp)).then(function() { peerConnection.setRemoteDescription(new RTCSessionDescription(signal.sdp)).then(function() {
// Only create answers in response to offers // Only create answers in response to offers