gavv / webrtc-cli

WebRTC command-line peer.
MIT License
225 stars 24 forks source link

WebRTC demo page errors #8

Closed M0LTE closed 3 years ago

M0LTE commented 3 years ago

When I open https://gavv.github.io/webrtc-cli/ I get:

Creating session... Adding microphone to session... TypeError: Cannot read property 'sdp' of null

Chrome latest on Windows 10.

groberts817 commented 3 years ago

I changed this line: https://github.com/gavv/webrtc-cli/blob/master/docs/index.html#L94 and the one below it to:

pc.setLocalDescription(offer).then(function() {
  document.getElementById('offer').value = pc.localDescription.sdp
});

since setLocalDescription is an asynchronous function that returns a promise. The localDescription is not yet set in the original code.

gavv commented 3 years ago

@M0LTE @groberts817 thanks! I was able to reproduce the issue and apply the fix. Pushed to master. Closing this, but feel free to reopen if it's not fixed for you.