Skip to content
Snippets Groups Projects
Commit 32859a2a authored by Rodrigo Nascimento's avatar Rodrigo Nascimento
Browse files

Remove streams on connection close and clear webrtc.pc

parent acb70f77
No related branches found
No related tags found
No related merge requests found
......@@ -38,8 +38,7 @@ webrtc.start = function (isCaller) {
};
webrtc.pc.oniceconnectionstatechange = function(evt) {
console.log('oniceconnectionstatechange', arguments)
if (evt.srcElement.iceConnectionState == 'disconnected') {
if (evt.srcElement.iceConnectionState == 'disconnected' || evt.srcElement.iceConnectionState == 'closed') {
webrtc.pc.getLocalStreams().forEach(function(stream) {
stream.stop();
webrtc.onSelfUrl();
......@@ -48,6 +47,7 @@ webrtc.start = function (isCaller) {
stream.stop();
webrtc.onRemoteUrl();
});
webrtc.pc = undefined;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment