Преглед на файлове

Update Session._renderUserMedia()

customisations
alemart преди 1 година
родител
ревизия
e8e3cbd271
променени са 1 файла, в които са добавени 8 реда и са изтрити 6 реда
  1. 8
    6
      src/core/session.ts

+ 8
- 6
src/core/session.ts Целия файл

@@ -456,19 +456,21 @@ export class Session extends AREventTarget<SessionEventType>
456 456
         const canvas = this._viewport._background;
457 457
         const ctx = canvas.getContext('2d', { alpha: false });
458 458
         
459
-        if(ctx) {
459
+        if(ctx && this.media.type != 'data') {
460 460
             ctx.imageSmoothingEnabled = false;
461 461
 
462 462
             // draw user media
463
-            const image = this.media.source;
463
+            const image = this.media.source as CanvasImageSource;
464 464
             ctx.drawImage(image, 0, 0, canvas.width, canvas.height);
465 465
 
466 466
             // render output image(s)
467 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 476
             // render gizmos

Loading…
Отказ
Запис