]>
git.r.bdr.sh - rbdr/junction/blob - extension/peers.js
2b4e3d68325819430748144deff796e42069e878
4 createAudioElement(source
) {
5 const audioElement
= document
.createElement("audio");
6 audioElement
.setAttribute("class", "junction-call-audio");
7 audioElement
.autoplay
= "autoplay";
9 // WE WILL NOT LOSE TADA SUPPORT
10 if (typeof source
=== "string") {
11 audioElement
.src
= source
;
13 audioElement
.srcObject
= source
;
16 document
.querySelector("body").appendChild(audioElement
);
24 internals
.peers
[id
] && this.remove(id
);
25 internals
.peers
[id
] = internals
.createAudioElement(source
);
29 internals
.peers
[id
] && internals
.peers
[id
].remove();
30 delete internals
.peers
[id
];
34 return Object
.keys(internals
.peers
).length
;
40 .querySelectorAll(".junction-call-audio")
41 .forEach((audioElement
) => audioElement
.remove());