diff --git a/src/main/index.ts b/src/main/index.ts index 7035c089..62855a94 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -2,7 +2,13 @@ import '@/main/rtspServer'; import '@/main/audio'; import { log } from '@/main/logger'; import { APP_INFO_QUERY, APP_INFO_TYPE, AUDIO_STOP } from '@/main/preload'; -import { app, BrowserWindow, ipcMain, powerSaveBlocker } from 'electron'; +import { + app, + BrowserWindow, + ipcMain, + powerSaveBlocker, + session, +} from 'electron'; import installExtension, { REACT_DEVELOPER_TOOLS, REDUX_DEVTOOLS, @@ -73,6 +79,18 @@ app .then(async () => { log.info('app is ready'); + session.defaultSession.setPermissionRequestHandler( + (webContents, permission, callback) => { + if (permission === 'media') { + // Approve microphone access + callback(true); + } else { + // Deny all other permissions + callback(false); + } + } + ); + // Since we don't ever want the display to sleep while the robot is connected // we try to force it to never sleep const id = powerSaveBlocker.start('prevent-display-sleep'); diff --git a/src/renderer/components/pages/Marvin.tsx b/src/renderer/components/pages/Marvin.tsx index a96beaaa..18e7fb47 100644 --- a/src/renderer/components/pages/Marvin.tsx +++ b/src/renderer/components/pages/Marvin.tsx @@ -6,6 +6,7 @@ export const Marvin: FC = () => { src="http://127.0.0.1:7860/" title="Example Site" style={{ width: '100%', height: '100%' }} + allow="microphone" /> ); };