openvidu-recording-node 🔗

Check it on GitHub

A simple Node application that uses openvidu-node-client to demonstrate OpenVidu recording capabilities. It is highly recommended to have read [Recording]{:target="_blank"} documentation before diving into the tutorial.

Understanding this tutorial 🔗

OpenVidu is composed by the modules displayed on the image above.

  • openvidu-browser: JavaScript library for the browser. It allows you to manage your video-calls straight away from your clients
  • openvidu-node-client: server SDK for Node. Quick alternative to REST API
  • openvidu-server: application to control Kurento Media Server
  • Kurento Media Server: handles low level operations of media flow transmissions

Running this tutorial 🔗

1) You will need node and NPM execute the app. You can check them with in ubuntu with the following commands:

node -v
npm -v

Plase visit to install it on other platforms.

2) Clone the repo:

git clone -b v2.20.0

3) Run the tutorial:

cd openvidu-tutorials/openvidu-recording-node
npm install
node server.js https://localhost:4443 MY_SECRET

4) OpenVidu Platform service must be up and running in your development machine. The easiest way is running this Docker container which wraps both of them (you will need Docker CE). Bare in mind the additional configuration properties and volumes you must set for the recording to work. If you let the default value /opt/openvidu/recordings/ as OPENVIDU_RECORDING_PATH, make sure the docker container has write permissions on it.

# WARNING: this container is not suitable for production deployments of OpenVidu Platform
# Visit

docker run -p 4443:4443 --rm \
    -e OPENVIDU_RECORDING_PATH=/opt/openvidu/recordings \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -v /opt/openvidu/recordings:/opt/openvidu/recordings \

5) Go to https://localhost:5000 to test the app once the server is running. The first time you use the docker container, an alert message will suggest you accept the self-signed certificate of openvidu-server when you first try to join a video-call. To test two users in the same computer, use a standard window and an incognito window.

If you are using Windows, read this FAQ to properly run the tutorial

To learn some tips to develop with OpenVidu, check this FAQ

Understanding the code 🔗

This is an advanced tutorial application with a JS/HTML/CSS frontend and a straightforward NodeJS backend that serves HTML files.

This application provides the

  • Backend: NodeJS app with the following classes

    • server.js : entrypoint for the app and controller for managing the token to enter the OpenVidu Session

  • Frontend templates: Plain JS/HTML/CSS files served by the backend (public/)

    • index.html : template with the recording features
    • app.js: javascript file which hosted OpenVidu methods and front-backend communication

  • Frontend static files (public/)

    • openvidu-browser-VERSION.js : openvidu-browser library. You don't have to manipulate this file
    • style.css : some CSS classes to style the templates

Although this tutorial includes several methods to make the backend-frontend communication effective, we will focus on the recording features. The application shows how to manage the recordings using the OpenVidu Recording API provided by openvidu-node-client.

1) Start the recording: 🔗'/api/recording/start', function (req, res) {
    // Retrieve params from POST body
    var recordingProperties = {
        outputMode: req.body.outputMode,
        hasAudio: req.body.hasAudio,
        hasVideo: req.body.hasVideo,
    var sessionId = req.body.session;

    OV.startRecording(sessionId, recordingProperties)
        .then(recording => res.status(200).send(recording))
        .catch(error => res.status(400).send(error.message));

2) Stop the recording: 🔗'/api/recording/stop', function (req, res) {
    // Retrieve params from POST body
    var recordingId = req.body.recording;

        .then(recording => res.status(200).send(recording))
        .catch(error => res.status(400).send(error.message));

3) Get a recording: 🔗

app.get('/api/recording/get/:recordingId', function (req, res) {
    // Retrieve params from GET url
    var recordingId = req.params.recordingId;

        .then(recording => res.status(200).send(recording))
        .catch(error => res.status(400).send(error.message));

4) List the recording: 🔗

app.get('/api/recording/list', function (req, res) {
        .then(recordings => res.status(200).send(recordings))
        .catch(error => res.status(400).send(error.message));

5) Delete the recording: 🔗

app.delete('/api/recording/delete', function (req, res) {
    // Retrieve params from DELETE body
    var recordingId = req.body.recording;

        .then(() => res.status(200).send())
        .catch(error => res.status(400).send(error.message));