add a loading for nodes that are still loading the fix that issue.

Then do rendering on the canvas.
This commit is contained in:
Michael Chung committed 2024-09-07 02:42:17 -04:00
1 parent aafa6fdb60
commit b5f5713838
3 files changed
+10 -6

No files matched your search

+1 -1
View File
@@ -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();
+4
View File
@@ -35,6 +35,8 @@ export class VideoNode extends NetworkedNodeContext {
this.isProcessing = true;
}
private finishedLoadingOnStart: Promise<void>;
getNumberFrames(): number {
return this.fps * this.duration;
}
@@ -80,6 +82,8 @@ export class VideoNode extends NetworkedNodeContext {
this.frameDidFinishSeeking = new Promise<void>(() => {});
this.finishedLoadingOnStart = new Promise<void>(() => {});
this.videoComponent.onloadedmetadata = (event: Event) => {
console.log("Loaded Metadata");
this.node.width(this.videoComponent.videoWidth);
+5 -5
View File
@@ -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.