webview test
This commit is contained in:
parent
bf828300f0
commit
08bbc24504
@ -6,7 +6,7 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<webview src="https://discordapp.com/login"></webview>
|
<webview id="discord" src="https://discordapp.com/login"></webview>
|
||||||
|
|
||||||
<script src="./renderer.js"></script>
|
<script src="./renderer.js"></script>
|
||||||
</body>
|
</body>
|
||||||
|
7
main.js
7
main.js
@ -18,7 +18,7 @@ function createWindow () {
|
|||||||
webviewTag: true
|
webviewTag: true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
mainWindow.setMenu(null)
|
//mainWindow.setMenu(null)
|
||||||
// and load the index.html of the app.
|
// and load the index.html of the app.
|
||||||
mainWindow.loadFile('index.html')
|
mainWindow.loadFile('index.html')
|
||||||
|
|
||||||
@ -61,10 +61,8 @@ const ioHook = require('iohook')
|
|||||||
const win = require('win-audio')
|
const win = require('win-audio')
|
||||||
const microphone = win.mic
|
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) => {
|
||||||
@ -74,7 +72,7 @@ function muteDelay() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mutes the Mic
|
// Globally mutes the Mic
|
||||||
function muteMic() {
|
function muteMic() {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
if (isTalking === false) {
|
if (isTalking === false) {
|
||||||
@ -91,6 +89,7 @@ function muteMic() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Globally unmutes the Mic
|
||||||
function unmuteMic() {
|
function unmuteMic() {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
console.log("Talking")
|
console.log("Talking")
|
||||||
|
15
renderer.js
15
renderer.js
@ -1,5 +1,18 @@
|
|||||||
const unMuteSound = new Audio('./assets/unmute.mp3')
|
const unMuteSound = new Audio('./assets/unmute.mp3')
|
||||||
const muteSound = new Audio('./assets/mute.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) => {
|
require('electron').ipcRenderer.on('ping', (event, message) => {
|
||||||
if (message === 'mic-open'){
|
if (message === 'mic-open'){
|
||||||
@ -11,3 +24,5 @@ require('electron').ipcRenderer.on('ping', (event, message) => {
|
|||||||
muteSound.play()
|
muteSound.play()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user