Skip to content

Commit

Permalink
Fix Webcam Texture Size (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexchuber authored Sep 12, 2024
1 parent 7bf4fb3 commit c18eaf4
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions packages/demo/src/configuration/blocks/inputs/webCamSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -94,7 +95,6 @@ export class WebCamSession implements IDisposable {
};

hiddenVideo.srcObject = stream;
this._textureOutput.value = this._videoTexture;
}

public dispose(): void {
Expand Down

0 comments on commit c18eaf4

Please sign in to comment.