scenejs-render icon indicating copy to clipboard operation
scenejs-render copied to clipboard

recordChild should emit a timeupdate event after evaluating the timefunction

Open mhaddon opened this issue 2 years ago • 4 comments

Right now recordChild does not trigger a timeupdate event for the first frame of each multi render.

This means you might have single frames every x % of your video, which are just incorrect.

Currently, I have hackily fixed this by adding:

    await new Promise((accept) => setTimeout(accept, 25));
    await page.evaluate(`scene.emit("timeupdate", { currentTime: ${time} })`);
    await new Promise((accept) => setTimeout(accept, 25));

after await page.evaluate(timeFunction as any);

in the recordChild method in child.ts.

but i am sure there is a better way to implement this fix

mhaddon avatar Jan 14 '23 02:01 mhaddon

@mhaddon

Does the media exist in the scene?

daybrush avatar Jan 14 '23 13:01 daybrush

@mhaddon

What version of Scene.js is it?

daybrush avatar Jan 14 '23 13:01 daybrush

latest scenejs and latest scenejs render, it is only the first frame that each "multi" generates.

its when you try to make your own render logic using the timeupdate event, the normal css rendering is working as expected

mhaddon avatar Jan 14 '23 18:01 mhaddon

@mhaddon

Are you using "timeupdate" in your scene?

If so, how about using "animate" instead of "timeupdate"?

The animate event will fire whenever setTime is called.

daybrush avatar Jan 17 '23 14:01 daybrush