about to rape webrtc.js

master
bel 2020-05-07 20:42:11 -06:00
parent fa959a2570
commit 2e77beabc3
2 changed files with 16 additions and 6 deletions

View File

@ -3,7 +3,6 @@ package main
import ( import (
"io" "io"
"io/ioutil" "io/ioutil"
"log"
"sync" "sync"
"github.com/gorilla/websocket" "github.com/gorilla/websocket"
@ -46,6 +45,5 @@ func (p *Pool) Broadcast(mt int, r io.Reader) error {
} }
return true return true
}) })
log.Printf("%d writes, %d min size, %d wanted size", cnt, n, len(b))
return nil return nil
} }

View File

@ -72,7 +72,13 @@ function start(isCaller) {
peerConnection.addStream(localStream); peerConnection.addStream(localStream);
if(isCaller) { if(isCaller) {
peerConnection.createOffer().then(createdDescription).catch(errorHandler); peerConnection
.createOffer({
'iceRestart': true,
'voiceActivityDetection': true,
})
.then(createdDescription)
.catch(errorHandler);
} }
} }
@ -105,9 +111,15 @@ function gotIceCandidate(event) {
function createdDescription(description) { function createdDescription(description) {
console.log('got description'); console.log('got description');
peerConnection.setLocalDescription(description).then(function() { peerConnection
serverConnection.send(JSON.stringify({'sdp': peerConnection.localDescription, 'uuid': uuid})); .setLocalDescription(description)
}).catch(errorHandler); .then(function() {
serverConnection.send(JSON.stringify({
'sdp': peerConnection.localDescription,
'uuid': uuid,
}));
})
.catch(errorHandler);
} }
function gotRemoteStream(event) { function gotRemoteStream(event) {