Instantiating Video Recorder lowers FPS

Hello, I recently spent hours trying to figure out why my app frame rate was low- it seemed to be around 40 even after slowly stripping my app until it was an empty scene.

Eventually I found the culprit, which was the line new VideoRecorder(engine).
I had instantiated that on scene creation, then on user event triggered event I called startRecording.

To fix it, I called new VideoRecorder(engine) when the event was triggered rather than at the top.

This may be intended but I would like to express my frustration with this design-
I really did not expect that calling a constructor would have such drastic side effects on the rendering engine. I would have expected that would happen with “startRecording”, but not upon instantiation.

I had all my object creation at the top- creating the engine, camera, scene, and VideoRecorder, which felt like a natural design pattern within BabylonJS.

Anyway I think some alerts in the documentation would be helpful if this is intended, or having VideoRecorder only change the FPS upon recording would feel more intuitive. Since the VideoRecorder is re-usable, I don’t see why not!

adding @sebavan

What browser are you using ?

I am asking cause even if I defer the creation of the MediaRecorder and the captureStream calls, everything after would get slower which anyway should not happen. There is unfortunately no stop stream function on the canvas and I d like to report this to browser vendors to see if any workaround exist.

hello,I met the same problem, after using VideoRecorder, is there any good way to solve it?,
if there any way to use MediaRecorder,and no low fps to webgl?

Did you try this ?