mirror of
https://github.com/liamcottle/reticulum-meshchat.git
synced 2026-10-26 19:01:43 -04:00
add mute button
This commit is contained in:
parent
c3d972afdf
commit
c38384c45f
1 changed files with 16 additions and 3 deletions
|
|
@ -9,6 +9,10 @@
|
|||
<button onclick="stopListening()">Stop Listening</button>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<input id="checkbox-mute-mic" type="checkbox"/> Mute Mic
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<select id="codec-mode">
|
||||
<option value="3200">3200</option>
|
||||
|
|
@ -35,6 +39,7 @@
|
|||
// find elements
|
||||
const codecModeElement = document.getElementById("codec-mode");
|
||||
const encodedBytesSentElement = document.getElementById("encoded-bytes-sent");
|
||||
const checkboxMuteMicElement = document.getElementById("checkbox-mute-mic");
|
||||
|
||||
var encodedBytesSent = 0;
|
||||
|
||||
|
|
@ -83,11 +88,19 @@
|
|||
encodedBytesSent += encoded.length;
|
||||
encodedBytesSentElement.innerText = formatBytes(encodedBytesSent);
|
||||
|
||||
// send encoded audio to websocket
|
||||
if(callWebsocket.readyState === WebSocket.OPEN){
|
||||
callWebsocket.send(encoded);
|
||||
// do nothing if websocket closed
|
||||
if(callWebsocket.readyState !== WebSocket.OPEN){
|
||||
return;
|
||||
}
|
||||
|
||||
// do nothing when audio muted
|
||||
if(checkboxMuteMicElement.checked){
|
||||
return;
|
||||
}
|
||||
|
||||
// send encoded audio to websocket
|
||||
callWebsocket.send(encoded);
|
||||
|
||||
};
|
||||
|
||||
// request access to the microphone
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue