moved audio
This commit is contained in:
parent
2bbbd2528a
commit
bf828300f0
@ -9,9 +9,5 @@
|
|||||||
<webview src="https://discordapp.com/login"></webview>
|
<webview src="https://discordapp.com/login"></webview>
|
||||||
|
|
||||||
<script src="./renderer.js"></script>
|
<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>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
7
main.js
7
main.js
@ -64,6 +64,7 @@ const microphone = win.mic
|
|||||||
|
|
||||||
let isTalking = false
|
let isTalking = false
|
||||||
|
|
||||||
|
|
||||||
// Resolves the promise after 2 seconds
|
// Resolves the promise after 2 seconds
|
||||||
function muteDelay() {
|
function muteDelay() {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
@ -79,7 +80,7 @@ function muteMic() {
|
|||||||
if (isTalking === false) {
|
if (isTalking === false) {
|
||||||
muteDelay().then(val => {
|
muteDelay().then(val => {
|
||||||
if (isTalking === false) {
|
if (isTalking === false) {
|
||||||
microphone.mute(); // Mute mic
|
microphone.mute() // Mute mic
|
||||||
console.log("Muted")
|
console.log("Muted")
|
||||||
mainWindow.webContents.send('ping', 'mic-closed')
|
mainWindow.webContents.send('ping', 'mic-closed')
|
||||||
mainWindow.setTitle("MUTED")
|
mainWindow.setTitle("MUTED")
|
||||||
@ -123,6 +124,4 @@ ioHook.on('mouseup', event => {
|
|||||||
isTalking = false
|
isTalking = false
|
||||||
muteMic()
|
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) => {
|
require('electron').ipcRenderer.on('ping', (event, message) => {
|
||||||
if (message === 'mic-open'){
|
if (message === 'mic-open'){
|
||||||
console.log("mic is open")
|
console.log("mic is open")
|
||||||
let unmute = document.getElementById("unmute");
|
unMuteSound.play()
|
||||||
unmute.volume=0.3
|
|
||||||
unmute.play();
|
|
||||||
}
|
}
|
||||||
if (message === 'mic-closed'){
|
if (message === 'mic-closed'){
|
||||||
console.log("mic is closed")
|
console.log("mic is closed")
|
||||||
let mute = document.getElementById("mute");
|
muteSound.play()
|
||||||
mute.volume=0.3
|
|
||||||
mute.play();
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user