diff --git a/src/KonvaApp/Engine.ts b/src/KonvaApp/Engine.ts index ccf24fe688..fa461d6b3f 100644 --- a/src/KonvaApp/Engine.ts +++ b/src/KonvaApp/Engine.ts @@ -97,7 +97,7 @@ export class Engine { // Testing render engine this.renderEngine.addNodes(videoNode); - await this.renderEngine.render(); + await this.renderEngine.startProcessing(); // Call this when test video nodes //await this.renderEngine.startProcessing(); diff --git a/src/KonvaApp/Nodes/VideoNode.ts b/src/KonvaApp/Nodes/VideoNode.ts index efb38b32e3..0d664e205f 100644 --- a/src/KonvaApp/Nodes/VideoNode.ts +++ b/src/KonvaApp/Nodes/VideoNode.ts @@ -35,6 +35,8 @@ export class VideoNode extends NetworkedNodeContext { this.isProcessing = true; } + private finishedLoadingOnStart: Promise; + getNumberFrames(): number { return this.fps * this.duration; } @@ -80,6 +82,8 @@ export class VideoNode extends NetworkedNodeContext { this.frameDidFinishSeeking = new Promise(() => {}); + this.finishedLoadingOnStart = new Promise(() => {}); + this.videoComponent.onloadedmetadata = (event: Event) => { console.log("Loaded Metadata"); this.node.width(this.videoComponent.videoWidth); diff --git a/src/KonvaApp/RenderEngine.ts b/src/KonvaApp/RenderEngine.ts index 6296e02419..fcb6516817 100644 --- a/src/KonvaApp/RenderEngine.ts +++ b/src/KonvaApp/RenderEngine.ts @@ -124,7 +124,7 @@ export class RenderEngine { this.videoNodes.forEach((item: VideoNode) => {}); - // find the longest video node; + // find the longest video node const numberOfFrames = this.findLongestVideoLength(); await this.render(numberOfFrames); @@ -166,16 +166,16 @@ export class RenderEngine { this.offScreenCanvas.width = videoNode.node.getSize().width; this.offScreenCanvas.height = videoNode.node.getSize().height; - if (this.context) { - this.context.drawImage( + if (this.videoDrawContext) { + this.videoDrawContext.drawImage( videoNode.videoComponent, 0, 0, this.offScreenCanvas.width, this.offScreenCanvas.height, ); - - this.frames.push(this.offScreenCanvas.transferToImageBitmap()); + // TODO bridge this. + //this.frames.push(this.videoDrawCanvas.toBlob()); } } // end of if } // end of for.