]>
git.r.bdr.sh - rbdr/junction/blob - extension/content_script.js
7 internals
[message
.action
](message
.data
);
10 async
joinAudioCall(data
) {
13 const mediaStream
= await navigator
.mediaDevices
.getUserMedia({ audio: true });
14 internals
.createAudioElement(data
.tada
);
18 internals
.port
.postMessage({
21 internals
.port
.disconnect();
22 internals
.createAudioElement(data
.tada
);
27 document
.querySelectorAll('.junction-call-audio').forEach((audioElement
) => audioElement
.remove());
28 internals
.port
.disconnect();
31 createAudioElement(source
, type
= 'audio/wav') {
33 const audioElement
= document
.createElement('audio');
34 audioElement
.setAttribute('class', 'junction-call-audio');
35 audioElement
.src
= source
;
36 audioElement
.autoplay
= 'autoplay';
37 audioElement
.type
= type
;
38 document
.querySelector('body').appendChild(audioElement
);
42 internals
.port
= chrome
.runtime
.connect({ name:"content" });
43 internals
.port
.onMessage
.addListener(internals
.onMessage
);
46 // Indicates to the background script that we executed correctly