Browse Source

Update Session._renderUserMedia()

customisations
alemart 1 year ago
parent
commit
e8e3cbd271
1 changed files with 8 additions and 6 deletions
  1. 8
    6
      src/core/session.ts

+ 8
- 6
src/core/session.ts View File

456
         const canvas = this._viewport._background;
456
         const canvas = this._viewport._background;
457
         const ctx = canvas.getContext('2d', { alpha: false });
457
         const ctx = canvas.getContext('2d', { alpha: false });
458
         
458
         
459
-        if(ctx) {
459
+        if(ctx && this.media.type != 'data') {
460
             ctx.imageSmoothingEnabled = false;
460
             ctx.imageSmoothingEnabled = false;
461
 
461
 
462
             // draw user media
462
             // draw user media
463
-            const image = this.media.source;
463
+            const image = this.media.source as CanvasImageSource;
464
             ctx.drawImage(image, 0, 0, canvas.width, canvas.height);
464
             ctx.drawImage(image, 0, 0, canvas.width, canvas.height);
465
 
465
 
466
             // render output image(s)
466
             // render output image(s)
467
             for(let i = 0; i < this._trackers.length; i++) {
467
             for(let i = 0; i < this._trackers.length; i++) {
468
-                const image = this._trackers[i]._output.image;
469
-                if(image !== undefined)
470
-                    ctx.drawImage(image.source, 0, 0, canvas.width, canvas.height);
471
-                    //ctx.drawImage(image.source, canvas.width - image.width, canvas.height - image.height, image.width, image.height);
468
+                const media = this._trackers[i]._output.image;
469
+                if(media !== undefined) {
470
+                    const image = media.source as CanvasImageSource;
471
+                    ctx.drawImage(image, 0, 0, canvas.width, canvas.height);
472
+                    //ctx.drawImage(image, canvas.width - media.width, canvas.height - media.height, media.width, media.height);
473
+                }
472
             }
474
             }
473
 
475
 
474
             // render gizmos
476
             // render gizmos

Loading…
Cancel
Save