From 2edb5f13dc69986b8430c14a24188eed2eb9a825 Mon Sep 17 00:00:00 2001 From: Joe Date: Fri, 16 May 2025 19:53:52 +0100 Subject: [PATCH 1/2] alpha-0.1.9/hf/583-fix-camera-not-working-on-electron Fixed electron build camera issues (#584) --- gcs/electron/main.ts | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/gcs/electron/main.ts b/gcs/electron/main.ts index b2cd179b1..762cb3b81 100644 --- a/gcs/electron/main.ts +++ b/gcs/electron/main.ts @@ -112,11 +112,28 @@ type ResizeCallback = (event: Event, arg1: Rectangle) => void; let currentResizeHandler: ResizeCallback | null = null +/** + * If id and name are provided, passes the id and name to the webcam popout so that the given + * video stream is rendered. If id or name are not provided, prevents any video streams from + * being rendered on the window so that the webcam is not showing in the background + * @param id The device stream ID + * @param name The name of the device + */ +function loadWebcam(id: string = "", name: string = ""){ + + const params: string = id && name ? "/webcam?deviceId=" + id + "&deviceName=" + name : "/webcam"; + + if (VITE_DEV_SERVER_URL) + webcamPopoutWin?.loadURL(VITE_DEV_SERVER_URL + "#" + params) + else + webcamPopoutWin?.loadFile(path.join(process.env.DIST, 'index.html'), {hash: params}) +} + function openWebcamPopout(videoStreamId: string, name: string, aspect: number){ if (webcamPopoutWin === null) return; + loadWebcam(videoStreamId, name); - webcamPopoutWin.loadURL("http://localhost:5173/#/webcam?deviceId=" + videoStreamId + "&deviceName=" + name); webcamPopoutWin.setTitle(name); // Remove previous resize handler @@ -150,7 +167,7 @@ function openWebcamPopout(videoStreamId: string, name: string, aspect: number){ function closeWebcamPopout(){ webcamPopoutWin?.hide() - webcamPopoutWin?.loadURL("http://localhost:5173/#/webcam") + loadWebcam(); win?.webContents.send("webcam-closed"); } @@ -210,7 +227,10 @@ function createWindow() { fullscreen: false, fullscreenable: false, }); - webcamPopoutWin.loadURL("http://localhost:5173/#/webcam") + + + // We load the webcam route here to prevent having to load the page on popout + loadWebcam(); // Open links in browser, not within the electron window. // Note, links must have target="_blank" From 45fa2151581857cae0bebef269ea05591a41f411 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Jul 2025 14:38:50 +0000 Subject: [PATCH 2/2] Bump electron in /gcs in the npm_and_yarn group across 1 directory Bumps the npm_and_yarn group with 1 update in the /gcs directory: [electron](https://github.com/electron/electron). Updates `electron` from 26.6.10 to 37.1.0 - [Release notes](https://github.com/electron/electron/releases) - [Changelog](https://github.com/electron/electron/blob/main/docs/breaking-changes.md) - [Commits](https://github.com/electron/electron/compare/v26.6.10...v37.1.0) --- updated-dependencies: - dependency-name: electron dependency-version: 37.1.0 dependency-type: direct:development dependency-group: npm_and_yarn ... Signed-off-by: dependabot[bot] --- gcs/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcs/package.json b/gcs/package.json index ae71c4c11..62f2593b0 100644 --- a/gcs/package.json +++ b/gcs/package.json @@ -86,7 +86,7 @@ "@vitejs/plugin-react": "^4.0.4", "@vitest/browser": "^2.0.5", "autoprefixer": "^10.4.16", - "electron": "^26.1.0", + "electron": "^37.1.0", "electron-builder": "^24.6.4", "eslint": "^8.48.0", "eslint-plugin-react-hooks": "^4.6.0",