twilio / twilio-video-app-react

A collaboration application built with the twilio-video.js SDK and React.js
Apache License 2.0
1.81k stars 728 forks source link

Initial recording rules, for a given room #619

Closed MoncefB closed 2 years ago

MoncefB commented 2 years ago

Question What is the recommended way to to edit the initial recording rules, for a given room?

Additional context One example would be:

Thank you so much for your help! 🙏

timmydoza commented 2 years ago

Hey @MoncefB - thanks for the question!

I think this may be easy. This app uses the Twilio API to create a Room when the first user joins. You can see that code in the token server here: https://github.com/twilio-labs/plugin-rtc/blob/master/src/serverless/functions/token.js#L74

The Rooms API does accept a parameter that could be useful for your use case. It accepts recordParticipantsOnConnect, which, if true, will record participants when they connect to the room.

So you could alter the code in the token server to change this value based on the room name. Maybe something like this:

        // If room doesn't exist, create it
        room = await client.video.rooms.create({
          uniqueName: room_name,
          type: ROOM_TYPE,
          recordParticipantsOnConnect: room_name === 'Record',
        });

Of course, you can get fancier with the room_name === 'Record' statement, but I think you get the idea. Lemme know what you think!

olipyskoty commented 2 years ago

Hi @MoncefB I will be closing this due to inactivity. Please let us know if you still have questions and we will reopen this issue. Thank you!