Examples: exchange entire RTCSessionDescription

Resolves #39
This commit is contained in:
backkem
2018-12-08 08:30:32 +01:00
committed by Michiel De Backker
parent 756d74196d
commit 7a527fadb3
21 changed files with 65 additions and 87 deletions

View File

@@ -14,7 +14,7 @@ window.createSession = isPublisher => {
pc.oniceconnectionstatechange = e => log(pc.iceConnectionState)
pc.onicecandidate = event => {
if (event.candidate === null) {
document.getElementById('localSessionDescription').value = btoa(pc.localDescription.sdp)
document.getElementById('localSessionDescription').value = btoa(JSON.stringify(pc.localDescription))
}
}
@@ -47,7 +47,7 @@ window.createSession = isPublisher => {
}
try {
pc.setRemoteDescription(new RTCSessionDescription({type: 'answer', sdp: atob(sd)}))
pc.setRemoteDescription(new RTCSessionDescription(JSON.parse(atob(sd))))
} catch (e) {
alert(e)
}