discord-sandboxed/renderer.js

29 lines
743 B
JavaScript
Raw Normal View History

2019-10-14 18:31:48 +00:00
const unMuteSound = new Audio('./assets/unmute.mp3')
const muteSound = new Audio('./assets/mute.mp3')
2019-10-14 19:23:56 +00:00
const ipc = require('electron').ipcRenderer;
onload = () => {
const webview = document.querySelector('webview')
webview.openDevTools()
webview.addEventListener('console-message', (e) => {
console.log('D: ', e.message)
if (e.message === "Close RTCPeerConnection") {
console.log("Disconnected from server")
}
})
}
2019-10-14 18:31:48 +00:00
2019-10-12 02:52:09 +00:00
require('electron').ipcRenderer.on('ping', (event, message) => {
if (message === 'mic-open'){
console.log("mic is open")
2019-10-14 18:31:48 +00:00
unMuteSound.play()
2019-10-12 02:52:09 +00:00
}
if (message === 'mic-closed'){
console.log("mic is closed")
2019-10-14 18:31:48 +00:00
muteSound.play()
2019-10-12 02:52:09 +00:00
}
})
2019-10-14 19:23:56 +00:00