Callback(Room.Events)
Room 클래스의 createRoom() 호출 시에 등록하여 처리해야 하는 이벤트 Callback입니다.
표Callback(Room.Events) 이벤트 목록대분류 | 이벤트 | 설명 |
---|---|---|
Room.Events | onConnecting | 참여자가 해당 Room에 접속 진행 중 |
onConnected | 참여자가 해당 Room에 접속 성공 | |
onDisconnected | 참여자가 접속을 종료하거나 서버의 요청에 의해 종료 | |
onError | Room에서 에러 발생 | |
onLocalAudioPublished | Local Participant가 자신의 오디오(음성) 공유 | |
onLocalAudioUnpublished | Local Participant가 공유 중인 오디오 공유 해제 | |
onLocalVideoPublished | Local Participant가 자신의 비디오 공유 | |
onLocalVideoUnpublished | Local Participant가 Room에 공유 중인 비디오 공유 해제 | |
onParticipantEntered | 새로운 Remote Participant가 Room에 입장 | |
onParticipantLeft | Remote Participant가 Room에서 퇴장하여 연결 끊김 | |
onRemoteAudioPublished | Remote Participant가 Room에 오디오 공유 | |
onRemoteAudioUnpublished | Remote Participant가 Room에 공유 중인 오디오 공유 해제 | |
onRemoteAudioStateChanged | Remote Participant의 오디오 상태 변경 | |
onRemoteAudioSubscribed | SDK가 Remote Participant의 오디오 발화에 해당 오디오 자동으로 구독 | |
onRemoteAudioUnsubscribed | SDK가 구독중인 Remote Participant의 오디오 자동으로 구독 종료 | |
onRemoteVideoPublished | Room에 송출 중인 Remote Participant의 비디오 게시 | |
onRemoteVideoStateChanged | Room에 송출 중인 Remote Participant의 리모트 비디오 상태 변경 | |
onRemoteVideoUnpublished | Room에 송출 중인 Remote Participant의 리모트 비디오의 게시 종료됨 | |
onUserMessage | 해당 Room의 다른 참여자가 보낸 메시지를 수신함 |
onConnecting
참여자가 해당 Room에 접속 진행 중인 경우 진행률을 반환합니다.
코드예제onConnecting Syntax
class OnEventListener : EventsCallback {
override fun onConnecting(progress: Float) {
}
}
파라미터 | 타입 | 설명 |
---|---|---|
progress | Float | 진행률(0~1) - 0부터 시작하며, 1이 되면 접속 준비가 완료 되었음을 의미 |
onConnected
참여자가 해당 Room에 접속이 성공했을 경우, 해당 Room의 모든 참여자들의 정보(RemoteParticipant) 목록을 반환하는 Callback 이벤트입니다. RemoteParticipant에서 RemoteVideo를 가져올 수 있으며, VideoRenderer를 바인드하면 영상을 수신할 수 있습니다.
코드예제onConnected Syntax
class OnEventListener : EventsCallback {
override fun onConnected(participants: List<RemoteParticipant>) {
}
}
파라미터 | 타입 | 설명 |
---|---|---|
participants | List<RemoteParticipant> | Room에 참여하고 있는 참여자 목록 - 자세한 정보는 RemoteParticipant 참고 |
onDisconnected
참여자가 접속을 종료하거나 서버의 요청에 의해 종료된 경우 호출되며, 참여자는 해당 Room에서 퇴장 처리됩니다.
코드예제onDisconnected Syntax
class OnEventListener : EventsCallback {
override fun onDisconnected(reason: DisconnectedReason) {
}
}
파라미터 | 타입 | 필수 여부 | 설명 |
---|---|---|---|
reason | DisconnectedReason | 필수 |
Room과 연결이 종료된 원인 |
DISCONNECTED : 정상 종료 |
|||
DESTROYED : 무료 사용 시간 만료 등으로 종료 |
|||
KICKED : 해당 Room에서 강제 퇴장 |
onError
Room에서 에러가 발생했을 때 호출됩니다. 상세 에러 정보는 Error Code 문서를 참고하시기 바랍니다.
코드예제onError Syntax
class OnEventListener : EventsCallback {
override fun onError(code: Int, message: String, isFatal: Boolean) {
}
}
파라미터 | 타입 | 설명 |
---|---|---|
code | Integer | 에러 코드 |
message | String | 에러 메시지 |
isFatal | Boolean | 치명적인 에러 여부 |
true : 치명적인 에러로 Room에 재접속이 필요한 상태 |
||
false : 치명적이지 않고, 일시적인 에러 |
onLocalAudioPublished
Local Participant(로컬 참여자)가 자신의 오디오(음성)를 공유했을 때 호출됩니다.
코드예제onLocalAudioPublished Syntax
class OnEventListener : EventsCallback {
override fun onLocalAudioPublished(audio: LocalAudio) {
}
}
파라미터 | 타입 | 설명 |
---|---|---|
audio | LocalAudio | Local Participant가 공유한 오디오 |
onLocalAudioUnpublished
Local Participant(로컬 참여자)가 Room에 공유 중인 오디오를 공유 해제했을 때 호출됩니다.
코드예제onLocalAudioUnpublished Syntax
class OnEventListener : EventsCallback {
override fun onLocalAudioUnpublished(audio: LocalAudio) {
}
}
파라미터 | 타입 | 설명 |
---|---|---|
audio | LocalAudio | Local Participant가 공유 해제한 오디오 |
onLocalVideoPublished
Local Participant(로컬 참여자)가 자신의 비디오를 공유했을 때 호출됩니다.
코드예제onLocalVideoPublished Syntax
class OnEventListener : EventsCallback {
override fun onLocalVideoPublished(video: LocalVideo) {
}
}
파라미터 | 타입 | 설명 |
---|---|---|
video | LocalVideo | Local Participant가 공유한 비디오 |
onLocalVideoUnpublished
Local Participant(로컬 참여자)가 Room에 공유 중인 비디오를 공유 해제했을 때 호출됩니다.
코드예제onLocalVideoUnpublished Syntax
class OnEventListener : EventsCallback {
override fun onLocalVideoUnpublished(video: LocalVideo) {
}
}
파라미터 | 타입 | 설명 |
---|---|---|
video | LocalVideo | Local Participant가 공유 해제한 비디오 |
onParticipantEntered
새로운 Remote Participant(리모트 참여자)가 Room에 입장했을 때 호출됩니다.
코드예제onParticipantEntered Syntax
class OnEventListener : EventsCallback {
override fun onParticipantEntered(participant: RemoteParticipant) {
}
}
파라미터 | 타입 | 설명 |
---|---|---|
participant | RemoteParticipant | Room에 신규 입장한 Remote Participant |
onParticipantLeft
Remote Participant(리모트 참여자)가 Room에서 퇴장하여 Room과 연결이 끊겼을 때 호출됩니다.
코드예제onParticipantLeft Syntax
class OnEventListener : EventsCallback {
override fun onParticipantLeft(participant: RemoteParticipant) {
}
}
파라미터 | 타입 | 설명 |
---|---|---|
participant | RemoteParticipant | 퇴장한 참여자의 정보 |
onRemoteAudioPublished
Remote Participant(리모트 참여자)가 Room에 오디오를 송출했을 때 호출됩니다.
코드예제onRemoteAudioPublished Syntax
class OnEventListener : EventsCallback {
override fun onRemoteAudioPublished(participant: RemoteParticipant, audio: RemoteAudio) {
}
}
파라미터 | 타입 | 설명 |
---|---|---|
participant | RemoteParticipant | 오디오를 공유한 Remote Participant |
audio | RemoteAudio | Remote Participant가 송출한 오디오 |
onRemoteAudioUnpublished
Remote Participant(리모트 참여자)가 Room에 공유 중인 오디오를 공유 해제했을 때 호출됩니다.
코드예제onRemoteAudioUnpublished Syntax
class OnEventListener : EventsCallback {
override fun onRemoteAudioUnpublished(participant: RemoteParticipant, audio: RemoteAudio) {
}
}
파라미터 | 타입 | 설명 |
---|---|---|
participant | RemoteParticipant | 오디오를 공유 해제한 Remote Participant |
audio | RemoteAudio | Remote Participant가 공유 해제한 오디오 |
onRemoteAudioStateChanged
Remote Participant(리모트 참여자)의 오디오 상태가 변경되면 호출됩니다.
SDK에서는 기본적으로 오디오 송출 시, Room에서 오디오 레벨이 가장 큰 4명의 오디오를 내보냅니다. 만약, 4명의 오디오 레벨과 상관 없이 Local Participant의 오디오를 항상 내보내도록 설정하려면 isAlwaysOn을 true
로 설정하여 always 상태를 설정하면 됩니다. 이렇게 오디오 상태가 always 상태였다가 변경되거나, 또는 그 반대일 때 onRemoteAudioStateChanged 이벤트가 호출됩니다.
코드예제onRemoteAudioStateChanged Syntax
class OnEventListener : EventsCallback {
override fun onRemoteAudioStateChanged(participant: RemoteParticipant, audio: RemoteAudio) {
}
}
파라미터 | 타입 | 설명 |
---|---|---|
participant | RemoteParticipant | 오디오 상태가 변경된 Remote Participant의 정보 |
audio | RemoteAudio | Remote Participant의 오디오 |
onRemoteAudioSubscribed
Room에 송출 중인 Remote Participant(리모트 참여자)의 리모트 오디오 발화 레벨에 따라 SDK가 해당 오디오를 자동으로 구독했을 때 발생하는 Callback 이벤트입니다.
코드예제onRemoteAudioSubscribed Syntax
class OnEventListener : EventsCallback {
override fun onRemoteAudioSubscribed(participant: RemoteParticipant, audio: RemoteAudio) {
}
}
파라미터 | 타입 | 설명 |
---|---|---|
participant | RemoteParticipant | SDK가 자동으로 오디오를 구독한 Remote Participant의 정보 |
audio | RemoteAudio | Remote Participant의 오디오 |
onRemoteAudioUnsubscribed
Remote Participant(리모트 참여자)의 오디오가 오디오 리시버의 점유를 해제하여 오디오 구독이 중단됐을 때 호출됩니다.
코드예제onRemoteAudioUnsubscribed Syntax
class OnEventListener : EventsCallback {
override fun onRemoteAudioUnsubscribed(participant: RemoteParticipant, audio: RemoteAudio) {
}
}
파라미터 | 타입 | 설명 |
---|---|---|
participant | RemoteParticipant | 오디오 구독이 중단된 Remote Participant의 정보 |
audio | RemoteAudio | Remote Participant의 오디오 |
onRemoteVideoPublished
Room에 송출 중인 Remote Participant(리모트 참여자)의 비디오가 게시되었을 때 발생하는 Callback 이벤트입니다. 게시된 RemoteVideo
를 VideoRenderer
에 bind하여 영상을 수신할 수 있습니다.
코드예제onRemoteVideoPublished Syntax
class OnEventListener : EventsCallback {
override fun onRemoteVideoPublished(participant: RemoteParticipant, video: RemoteVideo) {
}
}
파라미터 | 타입 | 설명 |
---|---|---|
participant | RemoteParticipant | 비디오를 게시한 Remote Participant의 정보 |
video | RemoteVideo | Remote Participant의 비디오 |
onRemoteVideoStateChanged
Room에 송출 중인 Remote Participant(리모트 참여자)의 리모트 비디오 상태(isEnabled
)가 변경되었을 때 발생하는 Callback 이벤트입니다.
코드예제onRemoteVideoStateChanged Syntax
class OnEventListener : EventsCallback {
override fun onRemoteVideoStateChanged(participant: RemoteParticipant, video: RemoteVideo) {
}
}
파라미터 | 타입 | 설명 |
---|---|---|
participant | RemoteParticipant | 비디오 상태가 변경된 Remote Participant 정보 - 자세한 정보는 RemoteParticipant 참고 |
video | RemoteVideo | Remote Participant의 비디오 |
onRemoteVideoUnpublished
Room에 송출 중인 Remote Participant(리모트 참여자)의 리모트 비디오의 게시가 종료되었을 때 발생하는 Callback 이벤트입니다.
코드예제onRemoteVideoUnpublished Syntax
class OnEventListener : EventsCallback {
override fun onRemoteVideoUnpublished(participant: RemoteParticipant, video: RemoteVideo) {
}
}
파라미터 | 타입 | 설명 |
---|---|---|
participant | RemoteParticipant | 비디오 상태가 변경된 Remote Participant의 정보 |
video | RemoteVideo | Remote Participant의 비디오 |
onUserMessage
해당 Room의 다른 참여자가 보낸 메시지를 받은 경우 호출됩니다.
코드예제onUserMessage Syntax
class OnEventListener : EventsCallback {
override fun onUserMessage(senderId: String, message: String) {
}
}
파라미터 | 타입 | 설명 |
---|---|---|
senderId | String | 메시지 송출자의 ID |
message | String | 수신된 메시지 |