Scene background Video not updating to a set time in a render loop designed to export frames at a certain framerate outside of realtime rendering

Hi i’m working on a basic animation tool where a mesh is animated in a scene with a video texture running as a background

I’ve created an export function that is meant to render the animated scene at a certain rate and store each rendered frame as a base64 image but the renderer seems to ignore my attempts to move the video and animations to a set time during the export loop the background video remains stuck in the first frame and the object is not animated at all. Im trying to export at a frame rate of the user’s choice.

when I play the scene with the normal render functions everything works fine.

in the page that i create and load the base64 images exported the scene always shows the background video at frame 0

can it be that video.currentTime or video.play are assyncronous?

Any help would be great thanks

Not sure what setcurrenttime is but at least HTMLMediaElement.play() is asynchronous. It returns a Promise which is resolved when playback has been successfully started.

More information HTMLMediaElement: play() method - Web APIs | MDN

Also notice that image.src = savedFrame; is async, too. You have to work with an onLoad() callback like mentioned in: