openvidu-custom-chat-panel 🔗

Check it on GitHub

The openvidu-custom-chat-panel tutorial shows how to replace the default chat panel with a custom one.

This customization is possible thanks to the ChatPanelDirective, which provides us a simple way to customizing the ChatPanelComponent.

Understanding the code 🔗

openvidu-custom-chat-panel is not production ready videconference app because it's using an insecure communication for requesting the token to OpenVidu Server. We highly recommend do this in the backend side.

This is an Angular project generated with angular-cli tool, and therefore you will see lots of configuration files and other stuff that doesn't really matter to us. We will focus on the following files under src/app/ folder:

  • app.module.ts: Define the AppComponent module where we import and configure the openvidu-angular library.
  • app.component.ts: defines AppComponent, main component of the app. It contains the functionalities for requesting the OpenVidu token for setting them up to the videoconference component and start the session.
  • app.component.html: HTML for AppComponent.

Configure openvidu-angular 🔗

First, we need to install the openvidu-angular library. You can check how to do that here.

The VideoconferenceComponent needs the tokens for connecting to the session. We will requesting them when the users clicks on the joinButton so we call to onJoinButtonClicked method when this is happening. After requesting the token, the VideoconferenceComponent will use them for connecting to the session.

<ov-videoconference (onJoinButtonClicked)="onJoinButtonClicked()" [tokens]="tokens">

Inside of the ov-videoconference component, we will add the custom template tagged with the *ovChatPanel. You can see how the ChatPanelDirective works here.

Running this tutorial 🔗

1) You will need angular-cli (and of course NPM) to serve the Angular frontend. You can check it with the following command:

npm -v
ng v

2) Clone the repo:

git clone -b v2.22.0

3) Run the tutorial:

cd openvidu-tutorials/openvidu-components/openvidu-custom-chat-panel
npm install
ng serve

4) OpenVidu Server 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):

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

docker run -p 4443:4443 --rm -e OPENVIDU_SECRET=MY_SECRET openvidu/openvidu-server-kms:2.22.0

5) Go to http://localhost:4200 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.

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

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