Rewrite examples to avoid onnegotiationneeded

onnegotiationneeded is broken in libwebrtc M73, so
just rewrite all examples to only set the offer once

Resolves #545
This commit is contained in:
Sean DuBois
2019-03-22 21:54:32 -07:00
parent ee5aa24977
commit fdcb1a3941
10 changed files with 75 additions and 43 deletions

View File

@@ -12,8 +12,10 @@ var log = msg => {
}
navigator.mediaDevices.getUserMedia({ video: true, audio: true })
.then(stream => pc.addStream(document.getElementById('video1').srcObject = stream))
.catch(log)
.then(stream => {
pc.addStream(document.getElementById('video1').srcObject = stream)
pc.createOffer().then(d => pc.setLocalDescription(d)).catch(log)
}).catch(log)
pc.oniceconnectionstatechange = e => log(pc.iceConnectionState)
pc.onicecandidate = event => {
@@ -22,9 +24,6 @@ pc.onicecandidate = event => {
}
}
pc.onnegotiationneeded = e =>
pc.createOffer().then(d => pc.setLocalDescription(d)).catch(log)
window.startSession = () => {
let sd = document.getElementById('remoteSessionDescription').value
if (sd === '') {