mirror of
https://github.com/pion/webrtc.git
synced 2025-10-06 07:37:10 +08:00
Update examples to only generate SDP when candidates are done gathering
This commit is contained in:
@@ -15,10 +15,13 @@ pc.ontrack = function (event) {
|
||||
}
|
||||
|
||||
pc.oniceconnectionstatechange = e => log(pc.iceConnectionState)
|
||||
pc.createOffer({offerToReceiveVideo: true, offerToReceiveAudio: true}).then(d => {
|
||||
document.getElementById('localSessionDescription').value = btoa(d.sdp)
|
||||
return pc.setLocalDescription(d)
|
||||
}).catch(log)
|
||||
pc.onicecandidate = event => {
|
||||
if (event.candidate === null) {
|
||||
document.getElementById('localSessionDescription').value = btoa(pc.localDescription.sdp)
|
||||
}
|
||||
}
|
||||
|
||||
pc.createOffer({offerToReceiveVideo: true, offerToReceiveAudio: true}).then(d => pc.setLocalDescription(d)).catch(log)
|
||||
|
||||
window.startSession = () => {
|
||||
let sd = document.getElementById('remoteSessionDescription').value
|
||||
|
Reference in New Issue
Block a user