add webcam button
This commit is contained in:
parent
bad5e26a86
commit
4bac2b0542
3 changed files with 9 additions and 4 deletions
|
@ -16,6 +16,7 @@
|
|||
<button onclick="stop(); return false;" id="stopBtn">🛑</button>
|
||||
<button onclick="back(); return false;" id="backBtn">⬅️</button>
|
||||
<button onclick="forward(); return false;" id="forwardBtn">➡️</button>
|
||||
<button id="camBtn">🎦</button>
|
||||
</div>
|
||||
<div id="whProtection">
|
||||
<tab-group new-tab-button="true" sortable="true">
|
||||
|
|
4
main.js
4
main.js
|
@ -1,5 +1,5 @@
|
|||
// Modules to control application life and create native browser window
|
||||
const {app, BrowserWindow, session, ipcMain, systemPreferences} = require('electron')
|
||||
const {app, BrowserWindow, session, ipcMain} = require('electron')
|
||||
const path = require('path')
|
||||
const fetch = require("cross-fetch")
|
||||
const { ElectronChromeExtensions } = require('electron-chrome-extensions')
|
||||
|
@ -239,6 +239,4 @@ app.on('ready', () => {
|
|||
'https://cloudflare-dns.com/dns-query'
|
||||
]
|
||||
});
|
||||
mic = systemPreferences.askForMediaAccess('microphone');
|
||||
cam = systemPreferences.askForMediaAccess('camera');
|
||||
});
|
|
@ -6,7 +6,7 @@
|
|||
* https://www.electronjs.org/docs/latest/tutorial/sandbox
|
||||
*/
|
||||
|
||||
const { contextBridge, ipcRenderer } = require('electron');
|
||||
const { contextBridge, ipcRenderer, systemPreferences } = require('electron');
|
||||
|
||||
contextBridge.exposeInMainWorld('electron', {
|
||||
enforceDomainRestrictions: (url) => ipcRenderer.sendSync('check-domain', url),
|
||||
|
@ -31,4 +31,10 @@ window.addEventListener('DOMContentLoaded', () => {
|
|||
makeWindowButton.addEventListener('click', () => {
|
||||
ipcRenderer.send('windowmaker', 'ping')
|
||||
})
|
||||
|
||||
const camButton = document.getElementById('camBtn');
|
||||
camButton.addEventListener('click', () => {
|
||||
mic = systemPreferences.askForMediaAccess('microphone');
|
||||
cam = systemPreferences.askForMediaAccess('camera');
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue