Module

ClientEvents

Event constants emitted by the Client class. Use these constants with client.addEventListener() to listen for events.

Example
import { Client, ClientEvents } from 'muziertcclient';

const client = new Client({ roomToken: 'your-token' });

// Listen for remote media tracks
client.addEventListener(ClientEvents.MEDIA_TRACK_ADDED, (event) => {
  const { userId, track, kind, paused, audioOnly } = event.detail;
  console.log(`Received ${kind} track from ${userId}, audioOnly: ${audioOnly}`);
});

// Listen for errors
client.addEventListener(ClientEvents.ERROR, (event) => {
  console.error('Client error:', event.detail);
});

Members

Object

# static constant ClientEvents

Event constants for the Hiyve Client.

Properties:
Name Type Description
CONNECTED string

Emitted when the WebRTC transport connection is established. No payload.

DISCONNECTED string

Emitted when the WebRTC transport connection is lost. No payload.

USER_DISCONNECTED string

Emitted when a remote user leaves the room. Payload: UserDisconnectedDetail

USER_JOINED_ROOM string

Emitted when a new user joins the room. Payload: UserJoinedRoomDetail

ROOM_JOINED string

Emitted after successfully joining a room. Payload: RoomJoinedDetail

ROOM_CLOSED string

Emitted when the room is closed by the owner. Payload: RoomClosedDetail

ERROR string

Emitted when an error occurs. Payload: ErrorDetail

MEDIA_TRACK_ADDED string

Emitted when a remote user's media track is available. Payload: MediaTrackAddedDetail

MEDIA_TRACK_REMOVED string

Emitted when a remote user's media track is removed. Payload: MediaTrackRemovedDetail

NEW_PRODUCER string

Internal event for new media producer. Used internally.

AUDIO_MUTED string

Emitted when local audio mute state changes. Payload: MuteDetail

VIDEO_MUTED string

Emitted when local video mute state changes. Payload: MuteDetail

OUTPUT_MUTED string

Emitted when local audio output mute state changes. Payload: MuteDetail

REMOTE_AUDIO_MUTED string

Emitted when room owner requests audio mute. Payload: RemoteMuteDetail

REMOTE_VIDEO_MUTED string

Emitted when room owner requests video mute. Payload: RemoteMuteDetail

REMOTE_OUTPUT_MUTED string

Emitted when room owner requests output mute. Payload: RemoteMuteDetail

AUDIO_INPUT_MONITOR_CREATED string

Emitted when audio input monitor is created. Payload: AudioInputProcessor instance.

AUDIO_GAIN_CONTROL_CREATED string

Emitted when audio gain control is created. Payload: GainNode instance.

UPDATE_ICE_PARAMETERS string

Internal event for ICE parameter updates. Used internally.

SCREEN_SHARE_STARTED string

Emitted when screen sharing starts. No payload.

SCREEN_SHARE_STOPPED string

Emitted when screen sharing stops. No payload.

DATA_MESSAGE string

Emitted when a data message is received. Payload: DataMessageDetail

RECORDING_STARTED string

Emitted when recording starts. Payload: RecordingStartedDetail

RECORDING_STOPPED string

Emitted when recording stops. Payload: RecordingStoppedDetail

RECORDING_STATE_CHANGED string

Emitted when recording state changes. Payload: RecordingStateChangedDetail

STREAMING_STARTED string

Emitted when live streaming starts. Payload: StreamingStartedDetail

STREAMING_STOPPED string

Emitted when live streaming stops. Payload: StreamingStoppedDetail

AUDIO_STREAM_ADDED string

Emitted when an audio stream is merged. Payload: AudioMerger instance.

AUDIO_STREAM_REMOVED string

Emitted when a merged audio stream is removed. Payload: AudioMerger instance.

RECEIVE_CHAT_MESSAGE string

Emitted when a chat message is received. Payload: ChatMessageDetail

STREAMING_USER_CHANGED string

Emitted when the featured user in stream changes. Payload: StreamingUserChangedDetail

ADMIT_WAITING_ROOM string

Emitted when host admits user from waiting room (received by admitted user). Payload: AdmitWaitingRoomDetail

REJECT_WAITING_ROOM string

Emitted when host rejects user from waiting room (received by rejected user). Payload: RejectWaitingRoomDetail

TRANSCRIPTION_RECEIVED string

Emitted when transcription text is received. Payload: TranscriptionReceivedDetail

TRANSCRIPTION_STARTED string

Emitted when transcription service starts. No payload.

TRANSCRIPTION_STOPPED string

Emitted when transcription service stops. No payload.

FEEDBACK_DETECTED string

Emitted when audio feedback is detected. Payload: FeedbackDetectedDetail

FEEDBACK_STOPPED string

Emitted when audio feedback stops. No payload.

AUDIO_INPUT_DEVICE_CHANGED string

Emitted when audio input device changes. Payload: AudioInputDeviceChangedDetail

VIDEO_INPUT_DEVICE_CHANGED string

Emitted when video input device changes. Payload: VideoInputDeviceChangedDetail

AUDIO_OUTPUT_DEVICE_CHANGED string

Emitted when audio output device changes. Payload: AudioOutputDeviceChangedDetail

AUDIO_VALIDATION_FAILED string

Emitted when audio validation fails. Payload: AudioValidationDetail

AUDIO_VALIDATION_WARNING string

Emitted when audio validation has warnings. Payload: AudioValidationDetail

CONSTRAINTS_RELAXED string

Emitted when media constraints are relaxed due to errors. Payload: ConstraintsRelaxedDetail

WAIT_FOR_HOST_STARTED string

Emitted when waiting for host to start meeting begins. Payload: WaitForHostStartedDetail

WAIT_FOR_HOST_ROOM_READY string

Emitted when host has started and room is ready. Payload: WaitForHostRoomReadyDetail

WAIT_FOR_HOST_TIMEOUT string

Emitted when waiting for host times out. Payload: WaitForHostTimeoutDetail

WAIT_FOR_HOST_CANCELLED string

Emitted when waiting for host is cancelled. Payload: WaitForHostCancelledDetail

Examples
// Listen for remote media tracks
client.addEventListener(ClientEvents.MEDIA_TRACK_ADDED, (event) => {
  const { userId, track, kind, paused, audioOnly } = event.detail;
  if (audioOnly) {
    // Create audio-only element for this user
    const audioEl = document.getElementById(`audio-${userId}`);
    audioEl.srcObject = new MediaStream([track]);
  } else if (kind === 'video') {
    const videoEl = document.getElementById(`video-${userId}`);
    videoEl.srcObject = new MediaStream([track]);
  }
});
// Listen for chat messages
client.addEventListener(ClientEvents.RECEIVE_CHAT_MESSAGE, (event) => {
  const { userId, message, timestamp } = event.detail;
  console.log(`[${timestamp}] ${userId}: ${message}`);
});
// Handle connection state
client.addEventListener(ClientEvents.CONNECTED, () => {
  console.log('Connected to room');
});
client.addEventListener(ClientEvents.DISCONNECTED, () => {
  console.log('Disconnected from room');
});

Type Definitions

Object

# AdmitWaitingRoomDetail

Payload for ADMIT_WAITING_ROOM event (sent to user being admitted)

Properties:
Name Type Attributes Description
from string

User ID of the host/moderator who admitted

waitingRoomToken string

Token for joining the room

roomName string

Name of the room being admitted to

message string <optional>

Optional message from the host

Object

# AudioInputDeviceChangedDetail

Payload for AUDIO_INPUT_DEVICE_CHANGED event

Properties:
Name Type Description
previousDeviceId string

The previous audio input device ID

newDeviceId string

The new audio input device ID

Object

# AudioOutputDeviceChangedDetail

Payload for AUDIO_OUTPUT_DEVICE_CHANGED event

Properties:
Name Type Description
previousDeviceId string

The previous audio output device ID

newDeviceId string

The new audio output device ID

updatedElements number

Number of audio elements updated

Object

# AudioValidationDetail

Payload for audio validation events (AUDIO_VALIDATION_FAILED, AUDIO_VALIDATION_WARNING)

Properties:
Name Type Attributes Description
deviceId string <optional>

The audio input device ID being validated

issues Array.<string>

List of validation issues found

recommendations Array.<string>

Suggested fixes for the issues

settings Object

Current audio settings

Object

# ChatMessageDetail

Payload for RECEIVE_CHAT_MESSAGE event

Properties:
Name Type Description
from string

User ID who sent the message

message string

The chat message content (sanitized)

Object

# ConstraintsRelaxedDetail

Payload for CONSTRAINTS_RELAXED event

Properties:
Name Type Attributes Description
level number

The relaxation level applied (1-3)

originalConstraints Object

The original media constraints

relaxedConstraints Object

The new relaxed constraints

failedConstraint string

The constraint that caused the failure

reason string <optional>

Reason for relaxation

Object

# DataMessageDetail

Payload for DATA_MESSAGE event

Properties:
Name Type Description
from string

User ID who sent the message

message *

The message payload (can be any JSON-serializable value)

Object

# ErrorDetail

Payload for ERROR event

Properties:
Name Type Attributes Description
error string

Error message description

originalError Error <optional>

The original error object if available

producerId string <optional>

Producer ID if error relates to media consumption

Object

# FeedbackDetectedDetail

Payload for FEEDBACK_DETECTED event

Properties:
Name Type Attributes Description
level number <optional>

Severity level of detected feedback

frequency number <optional>

Dominant frequency of the feedback

Object

# MediaTrackAddedDetail

Payload for MEDIA_TRACK_ADDED event

Properties:
Name Type Description
userId string

The user ID who owns this track

track MediaStreamTrack

The media track (audio or video)

kind string

The track type: 'audio' or 'video'

paused boolean

Whether the producer is currently paused/muted

audioOnly boolean

Whether the user joined in audio-only mode (no video will be sent)

Object

# MediaTrackRemovedDetail

Payload for MEDIA_TRACK_REMOVED event

Properties:
Name Type Description
userId string

The user ID whose track was removed

producerId string

The producer ID that was removed

kind string

The track type: 'audio' or 'video'

Object

# MuteDetail

Payload for mute events (AUDIO_MUTED, VIDEO_MUTED, OUTPUT_MUTED)

Properties:
Name Type Description
userId string

The user ID whose mute state changed

muted boolean

Whether the user is now muted

Object

# RecordingStartedDetail

Payload for RECORDING_STARTED event

Properties:
Name Type Description
roomName string

Name of the room being recorded

status string

Recording status (e.g., 'starting', 'active')

Object

# RecordingStateChangedDetail

Payload for RECORDING_STATE_CHANGED event

Properties:
Name Type Attributes Description
roomName string

Name of the room

recordingId number

Recording session identifier

transcribingId number <optional>

Transcription session identifier if transcribing

responseId string <optional>

Response identifier

status string

Current recording status (e.g., 'starting', 'active', 'stopping', 'stopped')

Object

# RecordingStoppedDetail

Payload for RECORDING_STOPPED event

Properties:
Name Type Description
roomName string

Name of the room where recording stopped

Object

# RejectWaitingRoomDetail

Payload for REJECT_WAITING_ROOM event (sent to user being rejected)

Properties:
Name Type Attributes Description
from string

User ID of the host/moderator who rejected

roomName string

Name of the room

message string <optional>

Optional rejection message from the host

Object

# RemoteMuteDetail

Payload for remote mute events (REMOTE_AUDIO_MUTED, REMOTE_VIDEO_MUTED, REMOTE_OUTPUT_MUTED)

Properties:
Name Type Description
userId string

The user ID being requested to mute

muted boolean

Whether to mute or unmute

Object

# RoomClosedDetail

Payload for ROOM_CLOSED event

Properties:
Name Type Description
roomName string

Name of the room that was closed

Object

# RoomJoinedDetail

Payload for ROOM_JOINED event (Room object)

Properties:
Name Type Description
id string

Unique room identifier

name string

Room name

owner string

User ID of the room owner

users Array.<string>

Array of user IDs currently in the room

created string

ISO timestamp of room creation

Object

# StreamingStartedDetail

Payload for STREAMING_STARTED event

Properties:
Name Type Description
roomName string

Name of the room being streamed

status string

Streaming status (e.g., 'starting', 'active')

Object

# StreamingStoppedDetail

Payload for STREAMING_STOPPED event

Properties:
Name Type Description
roomName string

Name of the room where streaming stopped

Object

# StreamingUserChangedDetail

Payload for STREAMING_USER_CHANGED event

Properties:
Name Type Description
roomName string

Name of the room

userId string

User ID now being featured in the stream

Object

# TranscriptionReceivedDetail

Payload for TRANSCRIPTION_RECEIVED event (server event: transcription-result)

Properties:
Name Type Attributes Description
roomName string

Name of the room

recordingId number

Recording session identifier

transcriptionData Object

The transcription data object

text string <optional>

Transcribed text content

userId string <optional>

User ID who spoke

timestamp number <optional>

Timestamp of the transcription

isFinal boolean <optional>

Whether this is a final transcription

Object

# UserDisconnectedDetail

Payload for USER_DISCONNECTED event. Note: The server sends just the userId string directly, not an object. The client wraps this in an object for consistency.

Properties:
Name Type Description
userId string

The user ID who disconnected

Object

# UserJoinedRoomDetail

Payload for USER_JOINED_ROOM event

Properties:
Name Type Attributes Description
roomName string

The room name the user joined

userId string

The user ID who joined

externalUserId string <optional>

Application-specific user ID if provided

Object

# VideoInputDeviceChangedDetail

Payload for VIDEO_INPUT_DEVICE_CHANGED event

Properties:
Name Type Description
previousDeviceId string

The previous video device ID

newDeviceId string

The new video device ID

Object

# WaitForHostCancelledDetail

Payload for WAIT_FOR_HOST_CANCELLED event

Properties:
Name Type Description
roomName string

Name of the room

elapsedTime number

Time waited before cancellation in milliseconds

Object

# WaitForHostRoomReadyDetail

Payload for WAIT_FOR_HOST_ROOM_READY event

Properties:
Name Type Description
roomName string

Name of the room that is now ready

elapsedTime number

Time waited in milliseconds

Object

# WaitForHostStartedDetail

Payload for WAIT_FOR_HOST_STARTED event

Properties:
Name Type Description
roomName string

Name of the room waiting for host

timeout number

Maximum wait time in milliseconds

pollingInterval number

Interval between status checks in milliseconds

Object

# WaitForHostTimeoutDetail

Payload for WAIT_FOR_HOST_TIMEOUT event

Properties:
Name Type Description
roomName string

Name of the room

timeout number

The timeout duration in milliseconds

elapsedTime number

Actual time waited in milliseconds