Skip to content

Instantly share code, notes, and snippets.

@SuibianP
Created October 7, 2025 12:19
Show Gist options
  • Select an option

  • Save SuibianP/22e35b4dd66382eca14bd7abd233573f to your computer and use it in GitHub Desktop.

Select an option

Save SuibianP/22e35b4dd66382eca14bd7abd233573f to your computer and use it in GitHub Desktop.
Electron NVIDIA Broadcaster issue MRE
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'">
<title>Hello World!</title>
</head>
<body>
<video autoplay></video>
<script type="module" src="./renderer.js"></script>
</body>
</html>
const { app, BrowserWindow } = require('electron')
function createWindow() {
const mainWindow = new BrowserWindow()
mainWindow.loadFile('index.html')
}
app.whenReady().then(() => {
createWindow()
app.on('activate', function () {
if (BrowserWindow.getAllWindows().length === 0) createWindow()
})
})
app.on('window-all-closed', function () {
if (process.platform !== 'darwin') app.quit()
})
{
"name": "normal-connection-tend-6ueq6",
"productName": "normal-connection-tend-6ueq6",
"description": "My Electron application description",
"keywords": [],
"main": "./main.js",
"version": "1.0.0",
"author": "jialun.hu",
"scripts": {
"start": "electron ."
},
"dependencies": {},
"devDependencies": {
"electron": "38.2.1"
}
}
let stream = await navigator.mediaDevices.getUserMedia({ video: true });
stream.getTracks().forEach(track => track.stop());
const devices = await navigator.mediaDevices.enumerateDevices();
const cam = devices.find(d => d.kind === 'videoinput' && d.label.includes('NVIDIA Broadcast'));
if (!cam) {
console.error("NVIDIA Broadcast virtual camera not found");
console.log(devices);
}
stream = await navigator.mediaDevices.getUserMedia({ video: { deviceId: { "exact": cam.deviceId } } });
document.getElementsByTagName('video')[0].srcObject = stream;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment