Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

startRecording not working #30

Open
Gaurav-Gosain opened this issue Apr 30, 2023 · 3 comments
Open

startRecording not working #30

Gaurav-Gosain opened this issue Apr 30, 2023 · 3 comments

Comments

@Gaurav-Gosain
Copy link

I'm trying to automatically start the recording for the meeting as soon as the user joins. So far I have tried both of the following:

onApiReady={(externalApi) => {
  externalApi.executeCommand("startRecording", {
    mode: "file",
  });
}}

and

onApiReady={(externalApi) => {

  externalApi.startRecording({
    mode: "file",
  });
}}

but neither approach has worked for me. I have jibri setup (the jitsi server is self hosted using jitsi-docker). Starting and stopping the recording manually works as expected. Any help to do this programmatically would be appreciated!

@damencho
Copy link
Member

Make sure you are in the meeting and a moderator before starting the recording.

@Gaurav-Gosain
Copy link
Author

Gaurav-Gosain commented May 1, 2023

Hey @damencho,thank you for your prompt response to my previous inquiry. I initially attempted to use an alternative approach, but ultimately found success with the following code snippet:

onApiReady={(externalApi) => {
  apiRef.current = externalApi;
  // add listener for participant joined
  externalApi.addListener("participantJoined", (data) => {
    // get the total number of participants
    const numParticipants = externalApi.getNumberOfParticipants();
    if (numParticipants >= 2 && !recording) {
      // start recording
      externalApi.startRecording({
        mode: "file",
      });
      setRecording(true);
    }
  });
}}

However, I am currently facing a new challenge with stopping the recording programmatically when the moderator (the person who initiated the call) leaves the meeting. Specifically, I am wondering if there is a way to disable the "Leave Meeting" option using the React SDK and only allow the "End Meeting for All" option, as I believe this will automatically stop the recording. Although I acknowledge that this may not be the most elegant solution, I am open to any suggestions or references that you may have.

Ultimately, my ideal outcome would be for the meeting to end for all participants and for the recording to stop only when the moderator exits. Thus far, I have attempted to use the external API reference to call the stopRecording function inside the onReadyToClose callback function, but without success.

Thank you once again for your time and expertise. I look forward to hearing from you soon.

@damencho
Copy link
Member

You cannot stop recording on ready to close, as it is too late for that, the participant had left the meeting already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants