From c18eaf48ab8a5857a307544e97ab12652028c7d0 Mon Sep 17 00:00:00 2001 From: "Alex C. Huber" <91097647+alexchuber@users.noreply.github.com> Date: Thu, 12 Sep 2024 15:04:11 -0400 Subject: [PATCH] Fix Webcam Texture Size (#46) --- .../blocks/inputs/webCamSession.ts | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/demo/src/configuration/blocks/inputs/webCamSession.ts b/packages/demo/src/configuration/blocks/inputs/webCamSession.ts index 289b2c90..ca7633ea 100644 --- a/packages/demo/src/configuration/blocks/inputs/webCamSession.ts +++ b/packages/demo/src/configuration/blocks/inputs/webCamSession.ts @@ -64,20 +64,21 @@ export class WebCamSession implements IDisposable { hiddenVideo.width = width; hiddenVideo.height = height; - const internalVideoTexture = this._engine.createDynamicTexture( - hiddenVideo.videoWidth, - hiddenVideo.videoHeight, - false, - 2 - ); - this._internalVideoTexture = internalVideoTexture; - this._videoTexture = new ThinTexture(internalVideoTexture); - hiddenVideo.onerror = () => { throw "Failed to load WebCam"; }; hiddenVideo.onloadeddata = () => { + const internalVideoTexture = this._engine.createDynamicTexture( + hiddenVideo.videoWidth, + hiddenVideo.videoHeight, + false, + 2 + ); + this._internalVideoTexture = internalVideoTexture; + this._videoTexture = new ThinTexture(internalVideoTexture); + this._textureOutput.value = this._videoTexture; + const update = () => { if (this._isDisposed) { return; @@ -94,7 +95,6 @@ export class WebCamSession implements IDisposable { }; hiddenVideo.srcObject = stream; - this._textureOutput.value = this._videoTexture; } public dispose(): void {