TUIRoomEvent

TUIRoomEvent API

TUIRoom Engine events interface

Room Events

EVENT
Description
Error event
Kicked out of room event
Current user is kicked offline
userSig expiration event
Room owner terminates the room event
Room name change event
Seat mode change event
All members' microphone permissions change event
All members' message sending status change event
Room maximum seat count change event
Remote user enters room event
Remote user leaves room event
User role change event
User video status change event
User audio status change event
User message sending status event
User volume change event
User network quality change event
Seats list change event
User is kicked off the seat event
Request received event
Request processed event
Request cancellation event
Device change event
Screen sharing stopped event
Screen sharing disabled for all users in the room event

onError

Error event
const roomEngine = new TUIRoomEngine();
roomEngine.on(TUIRoomEvents.onError, (error) => {
console.log('TUIRoomError error', error);
})
Parameters:
Parameter
Type
Description
code
number
Error code
message
string
Error message

onKickedOutOfRoom

Kicked out of room event
const roomEngine = new TUIRoomEngine();
roomEngine.on(TUIRoomEvents.onKickedOutOfRoom, ({ roomId, reason, message }) => {
console.log('roomEngine.onKickedOutOfRoom', roomId, message);
});
Parameters:
Parameter
Type
Description
roomId
string
Room ID
reason
Reason to kick user out
message
string
Message

onKickedOffLine

Current user is kicked offline
const roomEngine = new TUIRoomEngine();
roomEngine.on(TUIRoomEvents.onKickedOffLine, ({ message }) => {
console.log('roomEngine.onKickedOffLine', message);
});
Parameters:
Parameter
Type
Description
roomId
string
Room ID
message
string
User enter room on other device

onUserSigExpired

userSig expiration event
const roomEngine = new TUIRoomEngine();
roomEngine.on(TUIRoomEvents.onUserSigExpired, () => {
console.log('roomEngine.onUserSigExpired');
});

onRoomDismissed

Room owner terminates the room event
const roomEngine = new TUIRoomEngine();
roomEngine.on(TUIRoomEvents.onRoomDismissed, ({ roomId }) => {
console.log('roomEngine.onRoomDismissed', roomId);
});
Parameters:
Parameter
Type
Description
roomId
string
Room ID

onRoomNameChanged

Room name change event
const roomEngine = new TUIRoomEngine();
roomEngine.on(TUIRoomEvents.onRoomNameChanged, ({ roomId, roomName }) => {
console.log('roomEngine.onRoomNameChanged', roomId, roomName);
});
Parameters:
Parameter
Type
Description
roomId
string
Room ID
roomName
string
Room name

onRoomSeatModeChanged

Seat mode change event
const roomEngine = new TUIRoomEngine();
roomEngine.on(TUIRoomEvents.onRoomSeatModeChanged, ({ roomId, seatMode }) => {
console.log('roomEngine.onRoomSeatModeChanged', roomId, seatMode);
});
Parameters:
Parameter
Type
Description
roomId
string
Room ID
seatMode
Room microphone seat mode

onAllUserCameraDisableChanged

All members' camera permissions change event
const roomEngine = new TUIRoomEngine();
roomEngine.on(TUIRoomEvents.onAllUserCameraDisableChanged, ({ isDisable }) => {
console.log('roomEngine.onAllUserCameraDisableChanged', isDisable);
});
Parameters:
Parameter
Type
Description
isDisable
boolean
Whether to allow user open camera

onAllUserMicrophoneDisableChanged

All members' microphone permissions change event
const roomEngine = new TUIRoomEngine();
roomEngine.on(TUIRoomEvents.onAllUserMicrophoneDisableChanged, ({ isDisable }) => {
console.log('roomEngine.onAllUserMicrophoneDisableChanged', isDisable);
});
Parameters:
Parameter
Type
Description
isDisable
boolean
Whether to allow user open microphone

onSendMessageForAllUserDisableChanged

All members' message sending status change event
const roomEngine = new TUIRoomEngine();
roomEngine.on(TUIRoomEvents.onSendMessageForAllUserDisableChanged, ({ isDisable }) => {
console.log('roomEngine.onSendMessageForAllUserDisableChanged', isDisable);
});
Parameters:
Parameter
Type
Description
isDisable
boolean
Whether to allow user sending message

onRoomMaxSeatCountChanged

Room maximum seats count change event
const roomEngine = new TUIRoomEngine();
roomEngine.on(TUIRoomEvents.onRoomMaxSeatCountChanged, ({ maxSeatNumber }) => {
console.log('roomEngine.onRoomMaxSeatCountChanged', maxSeatNumber);
});
Parameters:
Parameter
Type
Description
maxSeatNumber
number
Maximum seats number

onRemoteUserEnterRoom

Remote user enters room event
const roomEngine = new TUIRoomEngine();
roomEngine.on(TUIRoomEvents.onRemoteUserEnterRoom, ({ roomId, userInfo }) => {
console.log('roomEngine.onRemoteUserEnterRoom', roomId, userInfo);
});
Parameters:
Parameter
Type
Description
roomId
string
Room ID
userInfo
Remote user information

onRemoteUserLeaveRoom

Remote user leaves room event
const roomEngine = new TUIRoomEngine();
roomEngine.on(TUIRoomEvents.onRemoteUserLeaveRoom, ({ roomId, userInfo }) => {
console.log('roomEngine.onRemoteUserLeaveRoom', roomId, userInfo);
});
Parameters:
Parameter
Type
Description
roomId
string
Room ID
userInfo
Remote user information

onUserRoleChanged

User role change event
const roomEngine = new TUIRoomEngine();
roomEngine.on(TUIRoomEvents.onUserRoleChanged, ({ userId, userRole }) => {
console.log('roomEngine.onUserRoleChanged', userId, userRole);
});
Parameters:
Parameter
Type
Description
userId
string
User ID
userRole
TUIRole
New user role value

onUserVideoStateChanged

User video status change event
const roomEngine = new TUIRoomEngine();
roomEngine.on(TUIRoomEvents.onUserVideoStateChanged, ({ userId, streamType, hasVideo, reason }) => {
console.log('roomEngine.onUserVideoStateChanged', userId, streamType, hasVideo, reason);
});
Parameters:
Parameter
Type
Description
userId
string
User ID
streamType
User video stream type
hasVideo
boolean
Whether the video stream exists or not
reason
Change reason, self-operation or room owner/administrator operation

onUserAudioStateChanged

User audio status change event
const roomEngine = new TUIRoomEngine();
roomEngine.on(TUIRoomEvents.onUserAudioStateChanged, ({ userId, hasAudio, reason }) => {
console.log('roomEngine.onUserAudioStateChanged', userId, hasAudio, reason);
});
Parameters:
Parameter
Type
Description
userId
string
User ID
hasVideo
boolean
Whether the audio stream exists or not
reason
Change reason, self-operation or room owner/administrator operation

onSendMessageForUserDisableChanged

User message sending status event
const roomEngine = new TUIRoomEngine();
roomEngine.on(TUIRoomEvents.onSendMessageForAllUserDisableChanged, ({ isDisable }) => {
console.log('roomEngine.onSendMessageForAllUserDisableChanged', isDisable);
});
Parameters:
Parameter
Type
Description
isDisable
boolean
Whether to all user sending message

onUserVoiceVolumeChanged

User volume change event
const roomEngine = new TUIRoomEngine();
roomEngine.on(TUIRoomEvents.onUserVoiceVolumeChanged, ({ userVolumeList }) => {
userVolumeList.forEach(userVolume => {
console.log('roomEngine.onUserVoiceVolumeChanged', userVolume.userId, userVolume.volume);
})
});
Parameters:
Parameter
Type
Description
userVolumes
The volume of all users in the room, including userId and volume information. The volume range is 1 to 100.

onUserNetworkQualityChanged

User network quality change event
const roomEngine = new TUIRoomEngine();
roomEngine.on(TUIRoomEvents.onUserNetworkQualityChanged, ({ userNetworkList }) => {
userNetworkList.forEach(userNetwork => {
console.log('roomEngine.onUserNetworkQualityChanged', userNetwork.userId, userNetwork.quality, userNetwork.upLoss, userNetwork.downLoss, userNetwork.delay);
})
});
Parameters:
Parameter
Type
Description
networkMap
Array<TUINetwork>
The network quality information of all users in the room

onSeatControlEnabled

Seat control mode change event
const roomEngine = new TUIRoomEngine();
roomEngine.on(TUIRoomEvents.onSeatControlEnabled, ({ enabled, maxSeatNumber }) => {
console.log('roomEngine.onSeatControlEnabled', enabled, maxSeatNumber);
});
Parameters:
Parameter
Type
Description
enabled
boolean
Whether to enabled
maxSeatNumber
number
Maximum seats number

onSeatListChanged

Seats list change event
const roomEngine = new TUIRoomEngine();
roomEngine.on(TUIRoomEvents.onSeatListChanged, ({ seatList, seatedList, leftList }) => {
console.log('roomEngine.onSeatListChanged',seatList, seatedList, leftList);
});
Parameters:
Parameter
Type
Description
seatList
Seats list
seatedList
Seats taken by users
leftList
Seats released by users

onKickedOffSeat

User is kicked off the seat event
const roomEngine = new TUIRoomEngine();
roomEngine.on(TUIRoomEvents.onKickedOffSeat, ({ userId }) => {
console.log('roomEngine.onKickedOffSeat', userId);
});
Parameters:
Parameter
Type
Description
userId
String
User ID

onRequestReceived

Request received event
const roomEngine = new TUIRoomEngine();
roomEngine.on(TUIRoomEvents.onRequestReceived, ({ request }) => {
console.log('roomEngine.onRequestReceived', request);
});
Parameters:
Parameter
Type
Description
request
Request information

onRequestProcessed

Request processed event
const roomEngine = new TUIRoomEngine();
roomEngine.on(TUIRoomEvents.onRequestProcessed, ({ request }) => {
console.log('roomEngine.onRequestProcessed', request);
});
Parameters:
Parameter
Type
Description
request
Request information

onRequestCancelled

Request cancellation event
const roomEngine = new TUIRoomEngine();
roomEngine.on(TUIRoomEvents.onRequestCancelled, ({ requestId, userId }) => {
console.log('roomEngine.onRequestCancelled', requestId, userId);
});
Parameters:
Parameter
Type
Description
requestId
string
Request ID
userId
string
User ID who cancelled the request

onDeviceChange

Device change event
const roomEngine = new TUIRoomEngine();
roomEngine.on(TUIRoomEvents.onDeviceChange, ({ deviceId, type, state }) => {
console.log('roomEngine.onDeviceChange', deviceId, type, state);
});
Parameters:
Parameter
Type
Description
deviceId
string
Device ID
type
Device type
state
Device status

onUserScreenCaptureStopped

Screen sharing stopped event
const roomEngine = new TUIRoomEngine();
roomEngine.on(TUIRoomEvents.onUserScreenCaptureStopped, () => {
console.log('roomEngine.onUserScreenCaptureStopped', deviceId, type, state);
});

onScreenShareForAllUserDisableChanged

Screen sharing disabled for all users in the room event
const roomEngine = new TUIRoomEngine();
roomEngine.on(TUIRoomEvents.onScreenShareForAllUserDisableChanged, ({ isDisable }) => {
console.log('roomEngine.onScreenShareForAllUserDisableChanged', isDisable);
});