From b54119d508a7a3d6d5a655eaa0e8ecbdeafacc1a Mon Sep 17 00:00:00 2001 From: Juliusz Chroboczek Date: Sat, 16 Nov 2024 23:49:49 +0100 Subject: [PATCH] Split out startup from Filter prototype. --- static/galene.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/static/galene.js b/static/galene.js index 0bae5df..b4d96f2 100644 --- a/static/galene.js +++ b/static/galene.js @@ -1071,7 +1071,9 @@ function Filter(stream, definition) { this.userdata = {} /** @type {MediaStream} */ this.captureStream = this.canvas.captureStream(0); +} +Filter.prototype.start = function() { /** @ts-ignore */ if(!this.captureStream.getTracks()[0].requestFrame) { console.warn('captureFrame not supported, using fixed framerate'); @@ -1087,7 +1089,7 @@ function Filter(stream, definition) { if(t.kind != 'video') this.outputStream.addTrack(t); }); - this.video.srcObject = stream; + this.video.srcObject = this.inputStream; this.video.muted = true; this.video.play(); if(this.definition.init) @@ -1169,6 +1171,7 @@ function setFilter(c) { return; let filter = new Filter(c.stream, c.userdata.filterDefinition); + filter.start(); c.setStream(filter.outputStream); c.userdata.filter = filter; }