RecordingMode is not defined

I’ve tried to do as explained in https://docs.openvidu.io/en/2.14.0/advanced-features/recording/#2-configure-your-sessions-to-be-recorded for the Node part in the server.js file from the openvidu-js-node folder and when I run it I’m getting this reference error ‘RecordingMode is not defined’.

This is what I changed in the code:

Bellow
var OV = new OpenVidu(OPENVIDU_URL, OPENVIDU_SECRET);
I added
var properties = { recordingMode: RecordingMode.ALWAYS, defaultOutputMode: Recording.OutputMode.COMPOSED };

And in
OV.createSession()
I added the parameter ‘properties’:
OV.createSession(properties)

If anybody could help I’d really appreciate it.

You have to import or require the class RecordingMode in your source code:

https://docs.openvidu.io/en/2.14.0/api/openvidu-node-client/enums/recordingmode.html

Hi Micael, thank you very much for your answer!

I’ve managed to import the required classes and now it’s recording as soon as I access the IP on the port 5000, but it’s not recording when I just start a room (https://i.imgur.com/isTCbNz.png) and click to join (https://i.imgur.com/gSGuK6A.png).

Any ideia why?

I don’t understand your issue. Can you clarify please?

Using the IP I access the page showed in this picture https://i.imgur.com/isTCbNz.png, then I give a name to the room and create it. (A)

After creating the room I’m directed to the page in this picture https://i.imgur.com/gSGuK6A.png, I click to join and the call opens. (B)

What I’d like to do is that as soon as the call opens it starts recording.

I made the changes showed above in the openvidu-js-node server.js and I only get new files in the recordings folder when I’m executing this server.js through the port 5000.

I’m not getting new files in the recordings folder when I’m doing what I described in (A) and (B).

I’d like to know how could I do it.

Thanks again!

Hi,

I see you are having trobule to start the recording of the sessions in ALWAYS mode. But I still don’t understand your issue. You say “it works fine when I’m executing this server.js through the port 5000” and that it is not working fine when “you do waht described in (A) and (B)”. I don’t know how those 2 statements would be like “opposite”.

What I can tell you is that if performing A and B your to initialize a session, and you are using one of the official OpenVidu instructions to run the service (of course with recording module enabled), if recording is not automatically started then there must be something wrong in your Session creation method. Please, review your Node code to check that you are properly configuring your sessions to be recorded.