TUIRoomEvent

TUIRoomEvent API Introduction

TUIRoomEvent API is the Event Interface for Multiplayer Component.

Event list

EVENT
Description
Error Event
Kicked out of room event
Current user Kicked off line event
UserSig Expiration Event
Host Destroy Room Event
Room Name Change Event
Room Speech Mode Change Event
All members Camera Usage Permission Change Event
All members Mic Usage Permission Change Event
All members Send Message Status Change Event
Room Maximum Seat Count Change Event
Remote User Entered Room Event
Remote User Leave Room Event
User Role Change Event
User Video Status Change Event
User Audio Status Change Event
User Send Message Status Event
User Volume Change Event
User Network Quality Change Event
Seat List Change Event
User Kicked off Seat Event
Request Received Event
Request Cancelled Event
Receive Text Message Event
Receive Custom Message Event
Device Change Event
Screen Sharing Stopped Event When the user uses the built-in browser stop sharing button to end screen sharing, the user will receive the 'onUserScreenCaptureStopped' event to modify the screen sharing status.

onError

Error Event
const roomEngine = new TUIRoomEngine();
roomEngine.on(TUIRoomEvents.onError, (error) => {
console.log('TUIRoomError error', error);
})
The parameters are shown in the table below:
Parameter
Type
Meaning
code
number
Error Code
message
string
Error Information

onKickedOutOfRoom

Kicked out of room event
const roomEngine = new TUIRoomEngine();
roomEngine.on(TUIRoomEvents.onKickedOutOfRoom, ({ roomId, message }) => {
console.log('roomEngine.onKickedOutOfRoom', roomId, message);
});
The parameters are shown in the table below:
Parameter
Type
Meaning
roomId
string
Room ID
message
string
Kicked out of room information

onKickedOffLine

Current user Kicked off line event
const roomEngine = new TUIRoomEngine();
roomEngine.on(TUIRoomEvents.onKickedOffLine, ({ message }) => {
console.log('roomEngine.onKickedOffLine', message);
});
The parameters are shown in the table below:
Parameter
Type
Meaning
roomId
string
Room ID
message
string
User logged in on other end information

onUserSigExpired

UserSig Expiration Event
const roomEngine = new TUIRoomEngine();
roomEngine.on(TUIRoomEvents.onUserSigExpired, () => {
console.log('roomEngine.onUserSigExpired');
});

onRoomDismissed

Host Destroy Room Event
const roomEngine = new TUIRoomEngine();
roomEngine.on(TUIRoomEvents.onRoomDismissed, ({ roomId }) => {
console.log('roomEngine.onRoomDismissed', roomId);
});
The parameters are shown in the table below:
Parameter
Type
Meaning
roomId
string
Room ID

onRoomNameChanged

Room ID Modification Event
const roomEngine = new TUIRoomEngine();
roomEngine.on(TUIRoomEvents.onRoomNameChanged, ({ roomId, roomName }) => {
console.log('roomEngine.onRoomNameChanged', roomId, roomName);
});
The parameters are shown in the table below:
Parameter
Type
Meaning
roomId
string
Room ID
roomName
string
Room Name

onRoomSpeechModeChanged

Room Name Change Event
const roomEngine = new TUIRoomEngine();
roomEngine.on(TUIRoomEvents.onRoomSpeechModeChanged, ({ roomId, speechMode }) => {
console.log('roomEngine.onRoomSpeechModeChanged', roomId, speechMode);
});
The parameters are shown in the table below:
Parameter
Type
Meaning
roomId
string
Room ID
speechMode
Speech Mode

onAllUserCameraDisableChanged

All members Camera Usage Permission Change Event
const roomEngine = new TUIRoomEngine();
roomEngine.on(TUIRoomEvents.onAllUserCameraDisableChanged, ({ isDisable }) => {
console.log('roomEngine.onAllUserCameraDisableChanged', isDisable);
});
The parameters are shown in the table below:
Parameter
Type
Meaning
isDisable
boolean
Allow Camera Usage

onAllUserMicrophoneDisableChanged

All members Mic Usage Permission Change Event
const roomEngine = new TUIRoomEngine();
roomEngine.on(TUIRoomEvents.onAllUserMicrophoneDisableChanged, ({ isDisable }) => {
console.log('roomEngine.onAllUserMicrophoneDisableChanged', isDisable);
});
The parameters are shown in the table below:
Parameter
Type
Meaning
isDisable
boolean
Allow Mic Usage

onSendMessageForAllUserDisableChanged

All members Send Message Permission Change Event
const roomEngine = new TUIRoomEngine();
roomEngine.on(TUIRoomEvents.onSendMessageForAllUserDisableChanged, ({ isDisable }) => {
console.log('roomEngine.onSendMessageForAllUserDisableChanged', isDisable);
});
The parameters are shown in the table below:
Parameter
Type
Meaning
isDisable
boolean
Allow Sending Text Message

onRoomMaxSeatCountChanged

Room Maximum Seat Count Change Event
const roomEngine = new TUIRoomEngine();
roomEngine.on(TUIRoomEvents.onRoomMaxSeatCountChanged, ({ maxSeatNumber }) => {
console.log('roomEngine.onRoomMaxSeatCountChanged', maxSeatNumber);
});
The parameters are shown in the table below:
Parameter
Type
Meaning
maxSeatNumber
number
Maximum Seat Count

onRemoteUserEnterRoom

Remote User Entered Room Event
const roomEngine = new TUIRoomEngine();
roomEngine.on(TUIRoomEvents.onRemoteUserEnterRoom, ({ roomId, userInfo }) => {
console.log('roomEngine.onRemoteUserEnterRoom', roomId, userInfo);
});
The parameters are shown in the table below:
Parameter
Type
Meaning
roomId
string
Room ID
userInfo
User Information

onRemoteUserLeaveRoom

Remote User Leave Room Event
const roomEngine = new TUIRoomEngine();
roomEngine.on(TUIRoomEvents.onRemoteUserLeaveRoom, ({ roomId, userInfo }) => {
console.log('roomEngine.onRemoteUserLeaveRoom', roomId, userInfo);
});
The parameters are shown in the table below:
Parameter
Type
Meaning
roomId
string
Room ID
userInfo
User Information

onUserRoleChanged

User Role Change Event
const roomEngine = new TUIRoomEngine();
roomEngine.on(TUIRoomEvents.onUserRoleChanged, ({ userId, userRole }) => {
console.log('roomEngine.onUserRoleChanged', userId, userRole);
});
The parameters are shown in the table below:
Parameter
Type
Meaning
userId
string
User Id
userRole
TUIRole
User Changed Role

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);
});
The parameters are shown in the table below:
Parameter
Type
Meaning
userId
string
User Id
streamType
User Stream Type
hasVideo
boolean
Has Video streams
reason
Change Reason, Self-operation/Host-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);
});
The parameters are shown in the table below:
Parameter
Type
Meaning
userId
string
User Id
hasVideo
boolean
Has Audio streams
reason
Change Reason, Self-operation/Host-operation

onSendMessageForUserDisableChanged

Member Camera Usage Permission Change Event
const roomEngine = new TUIRoomEngine();
roomEngine.on(TUIRoomEvents.onSendMessageForAllUserDisableChanged, ({ isDisable }) => {
console.log('roomEngine.onSendMessageForAllUserDisableChanged', isDisable);
});
The parameters are shown in the table below:
Parameter
Type
Meaning
isDisable
boolean
Allow Sending Text 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);
})
});
The parameters are shown in the table below:
Parameter
Type
Meaning
userVolumes
Volume of all users in the room, including userId and volume information, volume range is 1-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.volume);
})
});
The parameters are shown in the table below:
Parameter
Type
Meaning
networkMap
Traverse Network Quality Level

onSeatListChanged

Seat List Change Event
const roomEngine = new TUIRoomEngine();
roomEngine.on(TUIRoomEvents.onSeatListChanged, ({ seatList, seatedList, leftList }) => {
console.log('roomEngine.onSeatListChanged',seatList, seatedList, leftList);
});
The parameters are shown in the table below:
Parameter
Type
Meaning
seatList
Array.<TUISeatInfo>
Seat List
seatedList
Array.<TUISeatInfo>
New Seat Information
leftList
Array.<TUISeatInfo>
Left Seat Information

onKickedOffSeat

Seat List Change Event
const roomEngine = new TUIRoomEngine();
roomEngine.on(TUIRoomEvents.onKickedOffSeat, ({ userId }) => {
console.log('roomEngine.onKickedOffSeat', userId);
});
The parameters are shown in the table below:
Parameter
Type
Meaning
userId
String
Kicked off Seat User Id

onRequestReceived

Error Event
const roomEngine = new TUIRoomEngine();
roomEngine.on(TUIRoomEvents.onRequestReceived, ({ request }) => {
console.log('roomEngine.onRequestReceived', request);
});
The parameters are shown in the table below:
Parameter
Type
Meaning
request
Request Received

onRequestCancelled

Request Cancelled Event
const roomEngine = new TUIRoomEngine();
roomEngine.on(TUIRoomEvents.onRequestCancelled, ({ requestId, userId }) => {
console.log('roomEngine.onRequestCancelled', requestId, userId);
});
The parameters are shown in the table below:
Parameter
Type
Meaning
requestId
string
Request Id
userId
string
User Id of Cancelled Request

onReceiveTextMessage

Receive Text Message Event
const roomEngine = new TUIRoomEngine();
roomEngine.on(TUIRoomEvents.onReceiveTextMessage, ({ roomId, message }) => {
console.log('roomEngine.onReceiveTextMessage', roomId, message);
});
The parameters are shown in the table below:
Parameter
Type
Meaning
roomId
string
Room Id
message
Receive Text Message

onReceiveCustomMessage

Receive Custom Message Event
const roomEngine = new TUIRoomEngine();
roomEngine.on(TUIRoomEvents.onReceiveCustomMessage, ({ roomId, message }) => {
console.log('roomEngine.onReceiveCustomMessage', roomId, message);
});
The parameters are shown in the table below:
Parameter
Type
Meaning
roomId
string
Room Id
message
Receive Text Message

onDeviceChange

Device Change Event
const roomEngine = new TUIRoomEngine();
roomEngine.on(TUIRoomEvents.onDeviceChange, ({ deviceId, type, state }) => {
console.log('roomEngine.onReceiveCustomMessage', deviceId, type, state);
});
The parameters are shown in the table below:
Parameter
Type
Meaning
deviceId
string
Device Id
type
Device Type
state
Device Change Status

onUserScreenCaptureStopped

Screen Sharing Stopped Event, when the user uses the built-in browser stop sharing button to end screen sharing, the user will receive the 'onUserScreenCaptureStopped' event to modify the screen sharing status.
const roomEngine = new TUIRoomEngine();
roomEngine.on(TUIRoomEvents.onUserScreenCaptureStopped, () => {
console.log('roomEngine.onReceiveCustomMessage', deviceId, type, state);
});