Video Conference
The Video Conference component enables you to integrate a reliable video conferencing solution into your web application.
How to use
To initialize the Video Conference component, you must initialize a room with a defined name and ID for both the participant and the group.
Usage
To add a video conference to your room, use the following code:
import { VideoConference } from "@superviz/video";
const video = new VideoConference({
participantType: 'host',
});
room.addComponent(video);
Properties
Name | Type | Description |
---|---|---|
participantType | ParticipantType | This property is used to assign appropriate participant permissions within the room. Options are host , guest , and audience . Default value: guest |
brand | Brand | An object specifying branding options such as logos and custom styles for the video conference component.. |
permissions | Permissions | An object describing participant permissions within the video conference component.. |
i18n | i18n | An object specifying translation settings for the video conference component.. |
Methods
subscribe()
The subscribe
method allows you to register your application to listen for specific events during the call. By subscribing to events, you can capture and respond to important interactions or changes that occur during a video conference session.
Example:
video.subscribe(VideoEvent.PARTICIPANT_JOINED, (participant) => {
console.log('participant.joined', participant);
})
unsubscribe()
The unsubscribe
method allows you to stop listening to a previously subscribed event during the call.
Example:
video.unsubscribe(VideoEvent.PARTICIPANT_JOINED);
hangup()
This method allows you to end the video conference and disconnect from the meeting.
Example:
video.hangup();
toggleCam()
Use this method to toggle the participant’s camera on or off during the video conference.
Example:
video.toggleCam();
toggleChat()
Use this method to toggle open/close the chat window.
Example:
video.toggleChat();
toggleMeetingSetup()
Use this method to open or close the meeting setup modal.
Example:
video.toggleMeetingSetup();
toggleMicrophone()
Use this method to mute or unmute the participant’s microphone during the video conference.
Example:
video.toggleMicrophone();
toggleScreenShare()
Use this method to enable or disable participants sharing the screen with other participants in the meeting. When activated, it prompts the participant to share their screen. If already active, it stops the screen sharing.
Example:
video.toggleScreenShare();
toggleRecording()
This method toggles the recording feature on and off, enabling you to use the AI Meeting Insights API of the meeting's spoken content and to get the video recording using the Recordings API.
Example:
video.toggleRecording();
Events
VideoEvent
You can subscribe to the following Video events:
Event | String Equivalent | Description |
---|---|---|
HOST_CHANGED | 'host.changed' | Triggered when the host changes. |
PARTICIPANT_JOINED | 'participant.joined' | Triggered when a participant joins the meeting. |
MEETING_STATE_UPDATE | 'meeting.state.update' | Triggered when the meeting state updates. |
PARTICIPANT_LEFT | 'participant.left' | Triggered when a participant leaves the meeting. |
PARTICIPANT_LIST_UPDATE | 'participant.list.update' | Triggered when there is any change in the participant list. |
PARTICIPANT_KICKED | 'participant.kicked' | Triggered when a participant is kicked from the meeting. |
* Note for CDN Users: Use the string equivalent directly in room.subscribe().
HOST_CHANGED
Triggered when the host changes.
Usage Example:
video.subscribe(VideoEvent.HOST_CHANGED, (participant) => {
console.log('host.changed', participant);
})
On the callback function, you will receive the following argument:
Type | Description |
---|---|
Participant | Participant that now is the host. |
PARTICIPANT_JOINED
Triggered when a participant joins the meeting.
Usage Example:
video.subscribe(VideoEvent.PARTICIPANT_JOINED, (participant) => {
console.log('participant.joined', participant);
})
On the callback function, you will receive the following argument:
Type | Description |
---|---|
Participant | Participant that joined the meeting. |
MEETING_STATE_UPDATE
Triggered when the meeting state updates. The Video Conference operates through a series of distinct states to ensure the meeting experience. The MEETING_STATE_UPDATE
event enables you to monitor and react to these state transitions.
Usage Example:
video.subscribe(VideoEvent.MEETING_STATE_UPDATE, (state) => {
console.log('meeting.state.update', state);
})
On the callback function, you will receive the following argument:
Type | Description |
---|---|
MeetingState | Meeting state. |
PARTICIPANT_LEFT
Triggered when a participant leaves the meeting.
Usage Example:
video.subscribe(VideoEvent.PARTICIPANT_LEFT, (participant) => {
console.log('participant.left', participant);
})
On the callback function, you will receive the following argument:
Type | Description |
---|---|
Participant | Participant that left the meeting. |
PARTICIPANT_LIST_UPDATE
Triggered when there is any change in the participant list (e.g., a participant joins or leaves).
Usage Example:
video.subscribe(VideoEvent.PARTICIPANT_LIST_UPDATE, (participants) => {
console.log('participant.list.update', participants);
})
On the callback function, you will receive the following argument:
Type | Description |
---|---|
Record<string, Participant> | list of participants in the meeting. |
PARTICIPANT_KICKED
Triggered when a participant is kicked from the meeting.
Usage Example:
video.subscribe(VideoEvent.PARTICIPANT_KICKED, (participant) => {
console.log('participant.kicked', participant);
})
On the callback function, you will receive the following argument:
Type | Description |
---|---|
Participant | Participant that was kicked. |
Type Definitions
Participant
Type: object
An object describing the participant information, like name and avatar.
Name | Type | Description |
---|---|---|
id | string | Identifier of the participant who is entering the room. Usually, this ID matches the internal ID of your users. Minimum length of 2 characters and maximum of 64. Accepted pattern: [-_&@+=,()\{\}\\[\\]\/«».:|'"#a-zA-Z0-9À-ÿ\s]* |
email | string | The email of the participant who will enter the room. |
activeComponents | ComponentNames[] | List of active components that the participant has entered. |
name | string | The name of the participant who will enter the room. |
avatar | Avatar | Participant avatar information. |
Example:
{
"id": "USER_ID",
"email": "USER_EMAIL",
"name": "USER_NAME",
"activeComponents": ['videoConference'],
"type": "host",
"avatar": {
"imageUrl": "https://<PATH>",
}
}
ComponentNames
Type: enum
List of possible components that a participant can be added to. This is a read-only property, to add a participant into a component, you should use the addComponent
method of the room. The options are:
Name | Value | Component |
---|---|---|
ComponentNames.VIDEO_CONFERENCE | videoConference | Video Conference or Video Huddle |
ComponentNames.WHO_IS_ONLINE | whoIsOnline | Who-is-Online |
ComponentNames.COMMENTS | comments | Contextual Comments |
ComponentNames.PRESENCE | presence | Mouse Pointers |
ComponentNames.PRESENCE_AUTODESK | presence3dAutodesk | Presence 3D Autodesk |
ComponentNames.PRESENCE_MATTERPORT | presence3dMatterport | Presence 3D Matterport |
ComponentNames.PRESENCE_THREEJS | presence3dThreejs | Presence 3D Three.js |
Avatar
Type: object
Avatars represent participants within a room. In typical scenarios, they appear as profile images when used with Who-is-Online and Contextual Comments.
In 3D spaces (e.g., Matterport, Autodesk viewer or ThreeJs), avatars can take the form of 3D digital representations.
Name | Type | Description |
---|---|---|
imageUrl | string | Required. Path to the thumbnail image of the 3D model. Supported formats: .png and .jpg . |
model3DUrl | string | Path to a 3D model. Only applicable when using Presence3D components Supported formats: .glb and .gltf . |
Example:
avatar: {
imageUrl: "https://<PATH>",
model3DUrl: "https://<PATH>",
}
ParticipantType
Type: enum
Use ParticipantType
to assign appropriate participant permissions within the room. Values are:
host
can mute and kick participants from the call.guest
can participate in the call with a camera or voice.audience
can watch the meeting, but won’t be able to activate their camera and microphone. Typically used in live sessions.
Default value: guest
Permissions
Type: object
An object describing the permissions of video conference component.
Name | Type | Description |
---|---|---|
allowGuests | boolean | Allow guests to join the call. Default value: true |
toggleCamera | boolean | Allow participants to toggle their camera on and off. Hides the button if set to false . Default value: true |
toggleChat | boolean | Allow participants to toggle the chat modal on and off. Hides the button if set to false . Default value: true |
toggleMic | boolean | Allow participants to toggle their microphone on and off. Hides the button if set to false . Default value: true |
toggleParticipantList | boolean | Allow participants to toggle the participant list on and off. Hides the button if set to false . Default value: true |
toggleRecording | boolean | Allow participants to toggle the recording on and off. Hides the button if set to false . Default value: false |
toggleScreenShare | boolean | Allow participants to toggle the screen share on and off. Hides the button if set to false . Default value: true |
Example:
{
"allowGuests": false,
"toggleRecording": false,
}
i18n
Type: object
An object describing the translations of the video conference component.
Name | Type | Description |
---|---|---|
language | string | The language property sets the default language for the meeting interface. While it's possible to change it to a custom language, it's important to remember that you'll need to include this custom language in the list of available locales for it to take effect. Default value: en |
locales | Locale[] | The locales property allows you to expand language options beyond the default English. Use this field to provide a list of languages available in the meeting overlay. |
Locale
Type: object
This allows you to expand language options beyond the default English. Use this field to provide a list of languages available in the meeting overlay. For additional information on how, please refer to the documentation on how to internationalize your application.
Brand
Type: object
An object describing the logo and styles of the video conference component.
Name | Type | Description |
---|---|---|
logoUrl | string | The URL of the logo to be displayed on the meeting settings screen. |
styles | string | Optional custom CSS styles to be applied to the component. This allows for customization of the component's appearance. |
Example:
{
logoUrl: 'https://mydomain.com/logo.png',
styles: '`.meeting__toolbar-container { background-color: #000; }`',
},
MeetingState
Type: enum
Represents the current state of the Video Conference meeting. This value reflects one of the possible states indicating the operational status of the meeting component. You can utilize this information in your callback function to respond to and manage the meeting's dynamic behavior based on its state.
Here are the possible states and their meanings:
State | Value | |
---|---|---|
MEETING_FAILED | -1 | Indicates a failure in the meeting, requiring attention or troubleshooting. |
MEETING_DISCONNECTED | 0 | Indicates a state where the meeting is not connected. |
MEETING_INITIALIZING | 1 | Signifies the meeting is in the process of initialization. |
MEETING_READY_TO_JOIN | 2 | Confirms that the meeting was prepared for participants to join, indicating that device permissions have been granted and everything is ready for participants to join. |
MEETING_CONNECTING | 3 | Indicates an ongoing connection process that happens after the participant joins the meeting. |
MEETING_CONNECTED | 4 | Confirms that the meeting is successfully connected. |
MEETING_RECONNECT | 5 | Occurs when the meeting reconnects after a disruption. |
FRAME_INITIALIZING | 6 | Indicates the initialization of the meeting iframe. |
FRAME_INITIALIZED | 7 | Indicates a successfully initialized meeting iframe. |
FRAME_UNINITIALIZED | 8 | Represents an uninitialized meeting iframe. |