mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-20 16:45:10 +00:00
add a loading for nodes that are still loading the fix that issue.
Then do rendering on the canvas.
This commit is contained in:
1 parent
aafa6fdb60
commit
b5f5713838
3 files changed
+10
-6
No files matched your search
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in new issue
Block a user