X-Git-Url: https://git.r.bdr.sh/rbdr/junction/blobdiff_plain/3f2e36eabf1494ac60a3cf533d3db86d25a6cc39..ed39f77cdc9e4c3b5dea3017499c516f389a1401:/extension/peers.js?ds=inline diff --git a/extension/peers.js b/extension/peers.js index be494b0..5ba5c48 100644 --- a/extension/peers.js +++ b/extension/peers.js @@ -13,7 +13,13 @@ const internals = { }, }; -export function addPeer({ peerId, shouldCreateOffer, mediaStream, onOffer, socket }) { +export function addPeer({ + peerId, + shouldCreateOffer, + mediaStream, + onOffer, + socket, +}) { const peerConnection = new RTCPeerConnection( { iceServers: internals.kIceServers }, { optional: [{ DtlsSrtpKeyAgreement: true }] }, @@ -92,6 +98,9 @@ export function countPeers() { } export function resetPeers() { + for (const connection of Object.values(internals.peers)) { + connection.close(); + } internals.peers = {}; document .querySelectorAll(".junction-call-audio")