How to personalize your video conference component with SuperViz

Posted by | March 6, 2024

SuperViz is a low-code SDK designed to accelerate your software development by entrusting us with the responsibility of crafting top-tier collaboration tools for you. With just a few lines of code, you can implement a video conference feature inside your application. But what if you want more personalization than the default options of our Video SDK?

In this article, we are going to show how to use our methods and callback functions to customize your video meeting component.

Callback functions

When using the Video Conference, you can define a range of callbacks to handle specific events and interactions within the meeting. These callbacks allow you to respond to participant actions, meeting state changes, and other event-driven functionalities.

To define a callback, you need to pass a function when creating the Video Conference, as shown in the example below:

1import { VideoConference } from "@superviz/sdk/lib/components";
2
3const video = new VideoConference({
4 callbacks: {
5 onToggleMicrophone: () => {},
6 onToggleCam: () => {},
7 onToggleTranscript: () => {},
8 onToggleChat: () => {},
9 onToggleScreenShare: () => {},
10 onClickHangup: () => {},
11 onToggleMeetingSetup: () => {},
12 },
13});

When you pass a function to the callbacks object, the default behavior of the Video Conference will be overridden by the function you provide. This allows you to customize the behavior of the Video Conference to suit your specific requirements.

For example, when using onToggleChat(), the chat modal will not be displayed when the participant clicks the chat button, as a custom function has been provided by you. This means you can use your own chat instead of ours.

Methods

But let’s say you want to implement your own set of components for the buttons like “Hang up”, “Start Transcription”, “Share Screen”, “Mute/Unmute” and so on. You can still accomplish that by removing the button from the screen, and adding your own, as shown below:

1import { VideoConference } from "@superviz/sdk/lib/components";
2
3 video = new VideoConference({
4 ...
5 screenshareOff: true // disables the screen share button
6})

And you can have your own button anywhere on your page, by calling toogleScreenShare method on your HTML. Once activated it will ask the participant to share their screen. To do that, use the following code:

1<button id="personalized-id"
2 onClick={() => video.toggleScreenShare()}
3 value="Share your screen">
4</button>

Mixing callback functions and methods

Of course you can mix these two ways to accomplish new things, like adding new capabilities when a user clicks on our default button and still uses our implementation. Like, for example, using our chat modal, you can include the toogleChat within the callback function you provide, like so:

1const video = new VideoConference({
2 callbacks: {
3 onToggleChat: () => {
4 // Your logic
5 video.toggleChat();
6 },
7 },
8});

In conclusion, the SuperViz Video SDK offers a wide range of customization options for your video conference tool. Whether you want to use our default options, or your own additional functionality, it allows you to enhance the Video SDK to your specific needs.

Recent posts

Pub/Sub pattern vs Observer Pattern: what is the difference?

July 04, 2024

Design Pattern #4 - Publisher/Subscriber Pattern

June 27, 2024

Design Pattern #3 - Observer Pattern

June 20, 2024