ModulesConference Module

Conference

The Conference module in ZDK is an integral component for facilitating video and audio interactions. Leveraging the capabilities of the DeviceManager module, it efficiently sends video and audio streams. Beyond just transmission, the Conference module also retains the video and audio data from other participants, ensuring a coherent communication experience. Central to its operation is the maintenance of a WebRTC connection, which ensures real-time, high-quality communication between users. Importantly, for the Conference module to function, it must be integrated within the Room module; it cannot operate in isolation.

Dependencies
  • core
  • user
  • websocket
  • deviceManager
  • room

Initialization

file.ts
const conference = createConference({
  userModule: user,
  webSocketModule: ws,
  roomModule: room,
  devicesManagerModule: devicesManager,
  config: {
    maxBitrate: 600_000,
    codecs: ['vp9', 'vp8', 'av1']
  }
})

Actions

toggleUserAudio

Action type

(userId: string) => void

Description

It gives the client the possibility to mute selected user locally. Meanwhile, the other users in the room can still have the stream playing the audio. No one is notified that you disabled other user’s stream locally. It only affects the client.

Parameters

userId - id of the targeted user

Possible errors
  • ActionCallError - Can not perform this action (toggleUserAudio) on yourself.

toggleUserVideo

Action type

(userId: string) => void

Description

It gives the client the possibility to hide video of selected user locally. Meanwhile, the other users in the room can still have the stream displaying the video. No one is notified that you disabled other user’s stream locally. It only affects the client.

Parameters

userId - id of the targeted user

Possible errors
  • ActionCallError - Can not perform this action (toggleUserVideo) on yourself.

setUserVolume

Action type

(userId: string, volume: number) => void

Description

It gives the client possibility to change volume of selected user audio.

Parameters
  • userId - id of the targeted user
  • volume - value in range 0 - 100
Possible errors
  • ActionCallError - Can not perform this action (setVolume) on yourself.
  • ActionCallError - Can not perform this action (setUserVolume) using value out of range.

setMainVolume

Action type

(volume: number) => void

Description

It gives the client possibility to change base volume of conference participants.

Parameters
  • volume - value in range 0 - 100
Possible errors
  • ActionCallError - Can not perform this action (setMainVolume) using value out of range.

setClientMaxBitrate

Action type

(maxBitrate: number) => void

Description

Adjusts the maximum bitrate for the client’s outgoing media streams, optimizing bandwidth usage and maintaining stream quality.

Parameters
  • maxBitrate - the maximum streaming rate in bits per second

setCodecs

Action type

(codecs: 'vp9' | 'vp8' | 'av1')[]) => void

Description

Configures the audio and video codecs for media transmission, affecting stream quality and device compatibility.

Parameters
  • codecs - preferred codecs, ranked from highest to lowest priority.

Data (Getters)

status

Getter output type: 'disconnected' | 'connecting' | 'connected' | 'reloading'

Description
  • disconnected - not connected to any room
  • connecting - trying to connect to selected room
  • connected - connected and data about the room and its members are available - ready to room UI
  • reloading - because of connection lost, the room state can be temporarily desynchronized, this state appear after we are trying to synchronize all the data again. You can still show the user the whole room UI based on old data, but you can inform him that we are ‘reloading’ it and soon user will be fully connected.

(This status is fully based on room status)

membersWithMedia

Getter output type:
file.ts
membersWithMedia: IGetter<{
  member: RoomMembers_Entities.Member,
  audio: {
    stream: MediaStream | undefined,
    status: MediaStatus,
    volume: number
  },
  video: {
    stream: MediaStream | undefined,
    status: MediaStatus,
  },
  screenShare: {
    stream: MediaStream | undefined;
    status: MediaStatus;
  };
  screenShareAudio: {
    stream: MediaStream | undefined;
    status: MediaStatus;
  };
}[]>;
 
type MediaStatus = 'unavailable' | 'loading' | 'ready' | 'disabled' | 'hidden';
Description

The membersWithMedia Getter in the Conference module serves as an advanced tool for accessing combined data from both the Room and Conference modules. Specifically, it integrates data from the members Getter of the Room module with the media-related data from the Conference module. This amalgamation results in a comprehensive view of each user, showcasing their MediaStreams which represent either their audio or video. Additionally, each MediaStream is accompanied by its respective status, indicating its current operational state. This status provides valuable insights, such as determining if a user has muted their audio or deactivated their camera during a video call.

  • unavailable - user doesn’t have the required device or did not allow the page to use it.
  • loading - the user turned on his device but the server is waiting to get the stream from it.
  • ready - the stream from the device is ready to use, client can display it in the UI.
  • disabled - user disabled (muted) the stream.
  • hidden - client disabled the other user’s stream locally on his own device. Meanwhile, the other users in the room can still have the stream displayed, no one is notified that you disabled other user’s streams locally.

getLocalUserSettings

Getter output type:

{isVideoDisabled: boolean, isAudioDisabled: boolean, volume: number}

Description Return object with local settings set by client to the targeted user. The settings provides contain the following information:

  • isVideoDisabled - information if client disabled other user video stream
  • isAudioDisabled - information if client muted other user audio stream
  • volume - number (from 0 to 100) describing the volume set to the user (bu default all user set it to 100)

mainVolume

Getter output type:

number

Description It serves as a reference point for the volume level of conference participants. It indicates the typical or standard audio volume used in the conference, giving users an idea of the prevailing sound level during meetings.