Created
October 7, 2025 12:19
-
-
Save SuibianP/22e35b4dd66382eca14bd7abd233573f to your computer and use it in GitHub Desktop.
Electron NVIDIA Broadcaster issue MRE
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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() | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "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" | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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