Added fix for a bug in Chromium - webgbcam - [fork] gameboy webcam
HTML git clone git://src.adamsgaard.dk/webgbcam
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
DIR commit 4949ab4d6fd7b03c379747af0d5d577e9c425de5
DIR parent e07689ff76c81f4d96729c3662bcc1dc0c43fda7
HTML Author: andrigamerita <37557992+andrigamerita@users.noreply.github.com>
Date: Wed, 17 Mar 2021 13:30:22 +0100
Added fix for a bug in Chromium
Added a fix for a bug in Chromium where the browser can't initialize the camera on time, resulting in the app not being able to read it until the user forces a refresh by changing the page zoom or size
Diffstat:
M app.js | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
---
DIR diff --git a/app.js b/app.js
@@ -704,6 +704,9 @@ function initCameraStream() {
}
function initCameraDrawing() {
+ // if cameraStream has vertical or horizontal resolution of 0 then it's not initialized, we retry until the browser decides to properly work
+ if (cameraStream.videoHeight == 0) setTimeout(restartCamera, 500);
+
const track = window.stream.getVideoTracks()[0];
let settings = track.getSettings();
let str = JSON.stringify(settings, null, 4);
@@ -758,4 +761,4 @@ function drawFrame() {
}
Filters.filterImage(Filters.paletteSwap, appView, [palettes[currentPalette]])
-}
-\ No newline at end of file
+}