Skip to content

Commit

Permalink
add microphone input
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonR99 committed Dec 30, 2023
1 parent 19d0e57 commit 912af2d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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');
Expand Down
1 change: 1 addition & 0 deletions src/renderer/components/pages/Marvin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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"
/>
);
};

0 comments on commit 912af2d

Please sign in to comment.