In iframe api, how to know if recording is going on?

Hey Jitsi Team,

First of all thank you for such a wonderful piece of technology. Couple of months back I setup my own jitsi meet server with multiple videobridges in different servers and multiple instances of jibri for recording purpose.

So we start recording as soon as moderator joins using iframe api of startRecording. So what happens is that, sometime moderator joins multiple times and startRecording action is called multiple times and same meeting then gets recorded on multiple instances of jibri. I read the docs of iframe api but there was no mention to find if recording was already on. It is a feature request for iframe api so we get a feedback that recording is already on so no need to start it again - or inbuilt check in startRecording that recording should not start on multiple instances.

PS: I am running latest stable version of jitsi meet on our servers

Thanks,
Gaurav Kapatia

2 Likes

Yes, I can confirm the need for an event called “RecordingStarted” or similar. Without it, the stream is likely to be broadcasted multiple times, which makes it useless in YouTube, and also occupies many precious streamers unnecessarily.

1 Like

Agreed, on the button click if you set it to do a different action like stop recording, there is no confirmation that the recording has even begun or failed resulting in an odd button state.

1 Like

I put together some quick code to track recording state until recording events are added. If you’re hosting Jitsi Meet on your own servers and need a short-term solution right now, you can place this code in your interface_config.js file to get messages from the I-Frame when recording starts and stops, these are recording:on and recording:off. The code doesn’t support tracking recording errors, but in the button code you can set a timeout if you don’t receive a recording:pending message to reset the button state. This code can eventually break in future versions, so it needs to be tested every time Jitsi is updated.

/* Track recording sessions */

trackPendingSession = trackActiveSession = null;

setInterval(function() {

  if (typeof APP == 'undefined' || typeof APP.conference == 'undefined' || typeof APP.conference._room == 'undefined')
    return;

  for (i in APP.conference._room.recordingManager._sessions) {

    if (!trackPendingSession && APP.conference._room.recordingManager._sessions[i]._status == 'pending') {
      trackPendingSession = i;
      window.parent.postMessage('recording:pending', '*');
      console.log('recording pending for session : ', trackPendingSession);
    }

    if (!trackActiveSession && APP.conference._room.recordingManager._sessions[i]._status == 'on')
      trackActiveSession=i;
  }

  if (trackPendingSession && (status = APP.conference._room.recordingManager._sessions[trackPendingSession]._status) != 'pending') {
      window.parent.postMessage('recording:' + status, '*');
      trackPendingSession = null;
      console.log('pending changed to : ' + status );
  }

  if (trackActiveSession && (status = APP.conference._room.recordingManager._sessions[trackActiveSession]._status) != 'on') {
      window.parent.postMessage('recording:' + status, '*');
      trackActiveSession = null;
      console.log('active changed to : ' + status );
  }
}, 100);