discord-sandboxed/renderer.js
2019-10-14 12:23:56 -07:00

29 lines
743 B
JavaScript

const unMuteSound = new Audio('./assets/unmute.mp3')
const muteSound = new Audio('./assets/mute.mp3')
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")
}
})
}
require('electron').ipcRenderer.on('ping', (event, message) => {
if (message === 'mic-open'){
console.log("mic is open")
unMuteSound.play()
}
if (message === 'mic-closed'){
console.log("mic is closed")
muteSound.play()
}
})