Isolate Setup.

pull/25/head
Pontus Persson 2017-12-08 16:40:24 +01:00 committed by Pontus Alexander
parent 5c640fb544
commit 36408ab97b
1 changed files with 5 additions and 1 deletions

View File

@ -36,7 +36,7 @@ function getUserMediaSuccess(stream) {
localVideo.srcObject = stream;
}
function start(isCaller) {
function setup() {
peerConnection = createPeer(peerConnectionConfig);
peerConnection.addEventListener('icecandidate', gotIceCandidate);
@ -63,6 +63,10 @@ function start(isCaller) {
dataChannel.addEventListener('close', function () {
console.log("The Data Channel is Closed");
});
}
function start(isCaller) {
setup();
if(isCaller) {
peerConnection.createOffer().then(createdDescription).catch(errorHandler);