moved audio

This commit is contained in:
khlam 2019-10-14 11:31:48 -07:00
parent 2bbbd2528a
commit bf828300f0
3 changed files with 8 additions and 14 deletions

View File

@ -9,9 +9,5 @@
<webview src="https://discordapp.com/login"></webview>
<script src="./renderer.js"></script>
<audio id="unmute" src="./assets/unmute.mp3" autoplay="false" ></audio>
<audio id="mute" src="./assets/mute.mp3" autoplay="false" ></audio>
</body>
</html>

View File

@ -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")
@ -124,5 +125,3 @@ ioHook.on('mouseup', event => {
muteMic()
}
})

View File

@ -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()
}
})