moved audio
This commit is contained in:
parent
2bbbd2528a
commit
bf828300f0
@ -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>
|
||||
|
7
main.js
7
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()
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
})
|
11
renderer.js
11
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()
|
||||
}
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user