diff --git a/index.html b/index.html index 74b5961..36708dc 100644 --- a/index.html +++ b/index.html @@ -9,9 +9,5 @@ - - - - diff --git a/main.js b/main.js index 658383d..8fb98b2 100644 --- a/main.js +++ b/main.js @@ -64,6 +64,7 @@ const microphone = win.mic let isTalking = false + // Resolves the promise after 2 seconds function muteDelay() { return new Promise((resolve) => { @@ -79,7 +80,7 @@ function muteMic() { if (isTalking === false) { muteDelay().then(val => { if (isTalking === false) { - microphone.mute(); // Mute mic + microphone.mute() // Mute mic console.log("Muted") mainWindow.webContents.send('ping', 'mic-closed') mainWindow.setTitle("MUTED") @@ -123,6 +124,4 @@ ioHook.on('mouseup', event => { isTalking = false muteMic() } -}) - - +}) \ No newline at end of file diff --git a/renderer.js b/renderer.js index 330c84c..f1b1f7e 100644 --- a/renderer.js +++ b/renderer.js @@ -1,14 +1,13 @@ +const unMuteSound = new Audio('./assets/unmute.mp3') +const muteSound = new Audio('./assets/mute.mp3') + require('electron').ipcRenderer.on('ping', (event, message) => { if (message === 'mic-open'){ console.log("mic is open") - let unmute = document.getElementById("unmute"); - unmute.volume=0.3 - unmute.play(); + unMuteSound.play() } if (message === 'mic-closed'){ console.log("mic is closed") - let mute = document.getElementById("mute"); - mute.volume=0.3 - mute.play(); + muteSound.play() } })