Kakao i Connect Live::Kakao i Connect Live 2.0::API 레퍼런스::iOS::RoomDelegate

페이지 이동경로

RoomDelegate

RoomDelegate는 Room에서 발생하는 이벤트를 처리하기 위한 Callback 이벤트입니다.

RoomDelegate 이벤트 전체 목록
대분류 구분 이벤트 설명
RoomDelegate Event onConnecting Room에 연결이 진행 중인 단계에서 발생
onConnected 참여자가 Room에 연결이 완료되었을 때 발생
onDisconnected Room에서 연결이 해제되면 발생
onError 에러 발생 시 발생
onParticipantEntered Room에 내가 아닌 Remote Participant가 입장을 완료했을 때 발생
onParticipantLeft Remote Participant가 Room에서 퇴장했을 때 발생
onLocalMediaPublished 내가 생성한 로컬 미디어가 게시(송출)되었을 때 발생
onLocalMediaUnpublished Room에서 로컬 미디어의 게시(송출)가 해제되었을 때 발생
onRemoteVideoPublished Remote Participant가 비디오를 게시(송출)했을 때 발생
onRemoteVideoUnpublished Remote Participant가 비디오 게시(송출)를 중단했을 때 발생
onRemoteAudioPublished Remote Participant가 오디오를 게시(송출)했을 때 발생
onRemoteAudioUnpublished Remote Participant가 오디오 게시(송출)를 중단했을 때 발생
onRemoteAudioSubscribed 다른 참여자의 오디오를 구독했을 때 발생
onRemoteAudioUnsubscribed Remote Participant가 오디오 구독을 중단했을 때 발생
onRemoteVideoStateChanged 다른 참여자의 비디오 상태가 변경 시 발생
onRemoteAudioStateChanged 다른 참여자의 오디오 상태가 변경 시 발생
onUserMessage 참여자가 메시지를 전송했을 때 발생

onConnecting

Room에 접속하기까지 단계별 진행률을 전달합니다.

코드예제onConnecting Syntax

func onConnecting(progress: Float) { }

onConnecting Parameters
파라미터 타입 필수 여부 설명
progress Float 필수 Room에 접속하기까지 진행률
- 범위: 1부터 100
- 100에 도달 시 Room에 완전히 접속되었음을 의미

onConnected

참여자가 Room에 연결이 완료되었을 때 발생하는 이벤트입니다. 참여자가 Room에 연결이 완료되면, 현재 Room에 참여 중인 모든 사용자 ID 목록을 반환합니다.

코드예제onConnected Syntax

func onConnected(participantIds: [String: Statistics]) { }

onConnected Parameters
파라미터 타입 필수 여부 설명
participantIds [String: Statistics] 필수 Room에 접속 중인 리모트 참여자(Remote Participant) 목록

onDisconnected

Room에서 연결이 해제되면 발생하는 이벤트입니다. 이 이벤트는 참여자가 직접 연결을 해제한 경우와 에러로 인하여 연결이 해제된 경우에도 발생합니다.

코드예제onDisconnected Syntax

func onDisconnected(reason: DisconnectReason) { }

onDisconnected Parameters
파라미터 타입 필수 여부 설명
reason DisconnectReason 필수 연결 해제 이유
disconnected(기본값): 사용자에 의한 종료, 에러에 의한 종료
destroyed: 서버에서 룸이 종료됨
kicked: 관리자에 의해 연결이 해제됨

onError

Room에서 에러가 발생했을 때 호출됩니다. Room과 연결이 해제되는 중요한 에러인 경우 onError 이벤트가 먼저 발생하고, 그 이후에 onDisconnected 이벤트가 순차적으로 발생합니다. 에러와 관련한 자세한 설명은 Error Code를 참고하시기 바랍니다.

코드예제onError Syntax

func onError(code: Int, message: String, isCritical: Bool) { }

onError Parameters
파라미터 타입 필수 여부 설명
code Int 필수 에러 코드
message String 필수 에러 코드를 설명하는 메시지
isCritical Boolean 필수 중요 에러 여부
true: Room과 연결을 해제한 중요한 에러인 경우
false(기본값): 사소한 에러

onParticipantEntered

새로운 Remote Participant(리모트 참여자)가 Room에 입장했을 때 호출됩니다.

코드예제onParticipantEntered Syntax

func onParticipantEntered(remoteParticipant: RemoteParticipant) { }

onParticipantEntered Parameters
파라미터 타입 필수 여부 설명
remoteParticipant RemoteParticipant 필수 Room에 신규 입장한 리모트 참여자

onParticipantLeft

Remote Participant(리모트 참여자)가 Room에서 퇴장하여 Room과 연결이 끊겼을 때 호출됩니다.

코드예제onParticipantLeft Syntax

func onParticipantLeft(remoteParticipant: RemoteParticipant) { }

onParticipantLeft Parameters
파라미터 타입 필수 여부 설명
remoteParticipant RemoteParticipant 필수 Room에서 퇴장한 리모트 참여자 아이디

onLocalMediaPublished

Local Participant(로컬 참여자)가 자신이 생성한 로컬 미디어를 Room에 송출했을 때 호출됩니다.

코드예제onLocalMediaPublished Syntax

func onLocalMediaPublished(localMedia: LocalMedia) { }

onLocalMediaPublished Parameters
파라미터 타입 필수 여부 설명
localMedia LocalMedia 선택 Local Participant(로컬 참여자)가 생성한 로컬 미디어
- 자세한 정보는 LocalMedia 참고

onLocalMediaUnpublished

Local Participant(로컬 참여자)가 Room에 송출했던 미디어의 송출을 중단하면 호출됩니다.

코드예제onLocalMediaUnpublished Syntax

func onLocalMediaUnpublished(localMedia: LocalMedia) { }

onLocalMediaUnpublished Parameters
파라미터 타입 필수 여부 설명
localMedia LocalMedia 선택 로컬 참여자가 송출을 중단한 로컬 미디어
- 자세한 정보는 LocalMedia 참고

onRemoteVideoPublished

Remote Participant(리모트 참여자)가 Room에 비디오를 송출했을 때 호출됩니다.

코드예제onRemoteVideoPublished Syntax

func onRemoteVideoPublished(remoteParticipant: RemoteParticipant, remoteVideo: RemoteVideo) { }

onRemoteVideoPublished Parameters
파라미터 타입 필수 여부 설명
remoteParticipant RemoteParticipant 필수 비디오를 송출한 리모트 참여자
- 자세한 정보는 RemoteParticipant 참고
remoteVideo RemoteVideo 필수 리모트 참여자가 공유한 비디오
- 자세한 정보는 RemoteVideo 문서 참고

onRemoteVideoUnpublished

Remote Participant(리모트 참여자)가 Room에 송출 중인 비디오의 송출을 해제했을 때 호출됩니다.

코드예제onRemoteVideoUnpublished Syntax

func onRemoteVideoUnpublished(remoteParticipant: RemoteParticipant, remoteVideo: RemoteVideo) { }

onRemoteVideoUnpublished Parameters
파라미터 타입 필수 여부 설명
remoteParticipant RemoteParticipant 필수 비디오를 송출을 중단한 리모트 참여자
- 자세한 정보는 RemoteParticipant 참고
remoteVideo RemoteVideo 필수 송출을 중단한 비디오
- 자세한 정보는 RemoteVideo 문서 참고

onRemoteAudioPublished

Remote Participant(리모트 참여자)가 Room에 오디오를 송출했을 때 호출됩니다.

코드예제onRemoteAudioPublished Syntax

func onRemoteAudioPublished(remoteParticipant: RemoteParticipant, remoteAudio: RemoteAudio) { }

onRemoteAudioPublished Parameters
파라미터 타입 필수 여부 설명
remoteParticipant RemoteParticipant 필수 오디오를 송출한 리모트 참여자
- 자세한 정보는 RemoteParticipant 참고
remoteAudio RemoteAudio 필수 리모트 참여자가 공유한 오디오
- 자세한 정보는 RemoteAudio 문서 참고

onRemoteAudioUnpublished

Remote Participant(리모트 참여자)가 Room에 송출 중인 오디오의 송출을 중단했을 때 호출됩니다.

코드예제onRemoteAudioUnpublished Syntax

func onRemoteAudioUnpublished(remoteParticipant: RemoteParticipant, remoteAudio: RemoteAudio) { }

onRemoteAudioUnpublished Parameters
파라미터 타입 필수 여부 설명
remoteParticipant RemoteParticipant 필수 오디오의 송출을 중단한 리모트 참여자
- 자세한 정보는 RemoteParticipant 참고
remoteAudio RemoteAudio 필수 송출을 중단한 오디오
- 자세한 정보는 RemoteAudio 문서 참고

onRemoteAudioSubscribed

Room에 송출 중인 Remote Participant(리모트 참여자)의 오디오가 구독되었을 때 호출되는 이벤트입니다. 오디오 구독 또는 해제는 별도 요청이 아닌 각 참여자의 발화에 따라 자동으로 처리됩니다.

코드예제onRemoteAudioSubscribed Syntax

func onRemoteAudioSubscribed(remotePariticipant: RemoteParticipant, remoteAudio: RemoteAudio) { }

onRemoteAudioSubscribed Parameters
파라미터 타입 필수 여부 설명
remoteParticipant RemoteParticipant 필수 오디오를 구독한 리모트 참여자
- 자세한 정보는 RemoteParticipant 참고
remoteAudio RemoteAudio 필수 리모트 참여자가 송출한 오디오 스트림
- 자세한 정보는 RemoteAudio 문서 참고

onRemoteAudioUnsubscribed

Remote Participant(리모트 참여자)의 오디오가 오디오 리시버의 점유를 해제하여 오디오 구독이 중단됐을 때 호출됩니다.

코드예제onRemoteAudioUnsubscribed Syntax

func onRemoteAudioUnsubscribed(remoteParticipant: RemoteParticipant, remoteAudio: RemoteAudio) { }

onRemoteAudioUnsubscribed Parameters
파라미터 타입 필수 여부 설명
remoteParticipant RemoteParticipant 필수 구독을 중단한 리모트 참여자
- 자세한 정보는 RemoteParticipant 참고
remoteAudio RemoteAudio 필수 구독을 중단한 리모트 참여자의 오디오 스트림
- 자세한 정보는 RemoteAudio 문서 참고

onRemoteVideoStateChanged

Remote Participant(리모트 참여자)의 비디오 상태가 변경되면 호출됩니다. 예를 들어, 리모트 참여자의 비디오 상태가 활성(active) 상태였다가 비활성 상태로 변경되었을 때 호출됩니다.

코드예제onRemoteVideoStateChanged Syntax

func onRemoteVideoStateChanged(remoteParticipant: RemoteParticipant, remoteVideo: RemoteVideo) { }

onRemoteVideoStateChanged Parameters
파라미터 타입 필수 여부 설명
remoteParticipant RemoteParticipant 필수 비디오 상태가 변경된 리모트 참여자
- 자세한 정보는 RemoteParticipant 참고
remoteVideo RemoteVideo 필수 비디오 상태가 변경된 리모트 참여자의 비디오 스트림
- 자세한 정보는 RemoteVideo 문서 참고

onRemoteAudioStateChanged

Remote Participant의 오디오 상태가 변경 시 발생하는 이벤트입니다. SDK에서는 기본적으로 오디오 송출 시, Room에서 오디오 레벨이 가장 큰 4명의 오디오를 내보냅니다.

코드예제onRemoteAudioStateChanged Syntax

func onRemoteAudioStateChanged(remoteParticipant: RemoteParticipant, remoteAudio: RemoteAudio) { }

onRemoteAudioStateChanged Parameters
파라미터 타입 필수 여부 설명
remoteParticipant RemoteParticipant 필수 오디오 상태가 변경된 리모트 참여자
- 자세한 정보는 RemoteParticipant 참고
remoteAudio RemoteAudio 필수 오디오 상태가 변경된 리모트 참여자의 비디오 스트림
- 자세한 정보는 RemoteAudio 문서 참고

onUserMessage

Remote Participant(리모트 참여자)가 메시지를 전송하면 호출됩니다.

코드예제onUserMessage Syntax

func onUserMessage(senderId: String, message: String) { }

onUserMessage Parameters
파라미터 타입 필수 여부 설명
senderId String 필수 메시지를 전송한 리모트 참여자의 아이디
message String 필수 메시지
이 문서가 만족스러운 이유를 알려주세요.
이 문서에 아쉬운 점을 알려주세요.
평가해주셔서 감사합니다.

더 자세한 의견은 documentation@kakaoenterprise.com 으로 제보해주세요.