External custom layout start of recording issue

We’re starting to convert to external custom layouts from layouts stored on the openvidu server. The issue we’re running into is that sometimes the first 1/2 second of the recording is a white screen before the video appears. I believe that this is because our server took long to return the html for the custom layout but in the meantime, the page is being rendered and recorded on the openvidu server.

Is there a way to control the timing of when ffmpeg starts saving the recording? Some sort of signal we can send to say “yes, we’re ready and all participant streams have connected”?

You can use your very own custom layout itself to send whatever signal you want to your backend, or to other Session participants by using Session.signal openvidu-browser method. For example, if you know that the layout will be displaying 3 videos, you can use openvidu-browser events or any HTML standard events to wait for the 3 videos to be playing media, and at that moment inform your backend or other users from the layout itself.

You can’t directly control when the recording actually starts (I mean when the MP4 file begins). The video file starts as soon as possible, but of course it can take a little bit for the layout to render. If you want to get rid of parts of the video file, you will have to post-process it after stopping the recording.

Cheers.

1 Like

You can also use a recently added feature in OpenVidu. You can start COMPOSED recording browser when the session starts and start the real recording to file at any moment based on events received from the browser. The drawback is that recording browser will be active during the whole session, but you will have a fine grained control of when start the recording.

To start recording when all videos are loaded, detect it in the custom layout and send it to your backend executing a Rest API endpoint. In that way, the backend can start the recording in that moment.

2 Likes