1to1 Implementation
1to1 videocall implementation
NOTE: to perform a successful 1to1 video call Customer Chat SDK IS REQUIRED
First step is to implement OnVideoCallRequest interface in your current activity (e.g. MainActivity)
class <YOUR_ACTIVITY> : Activity, MeetingDoctorsClient.OnVideoCallRequest {
....
MeetingDoctorsClient.instance?.setVideoCallRequestListener(this)
....
}
- Next step is to apply required logic to OnVideoCallRequest to perform a 1to1 videocall successfully
override fun perform1to1VideoCall(
professionalHash: String?,
doctorName: String?,
avatar: String?,
speciality: String?,
context: Context?,
videoCallRequestDoneListener: MeetingDoctorsClient.OnVideoCall1to1RequestDone?
) {
VideoCallClient.login(<YOUR_USER_TOKEN>, object : VideoCallClient.LoginResponseListener{
override fun onLoginSuccess() {
VideoCallClient.requestOneToOneCall(currentActivity,professionalHash,doctorName,avatar,speciality,object : VideoCallClient.RequestOneToOneCallListener{
override fun onRequestOneToOneCallSuccess(roomId: String) {
videoCallRequestDoneListener?.performRequestDoneAction(roomId)
}
override fun onRequestOneToOneCallCancelledPrevious(
roomId: String,
professionalHash: String?
) {
videoCallRequestDoneListener?.performSendCancelledCallMessage(roomId,professionalHash)
}
override fun onRequestOneToOneCallFailure(message: String?) {
}
})
}
override fun onLoginFailure(message: String?) {
/* Your code here */
}
})
}
override fun performCancelVideoCall(
context: Context?,
message: String?,
videoCallRequestDoneListener: MeetingDoctorsClient.OnVideoCall1to1RequestDone?,
doctorName: String?
) {
VideoCallClient.requestCancelCallCustomer(object : VideoCallClient.CancelCallResponseListener{
override fun onCancelCallSuccess() {
videoCallRequestDoneListener?.performRequestCancelledAction()
}
override fun onCancelCallCancelledPrevious(roomId: String, hash: String?) {
videoCallRequestDoneListener?.performSendCancelledCallMessage(roomId, hash)
}
override fun onCancelCallFailure(message: String?) {
}
})
}
override fun hasProfessionalAssignedVideoCall(professionalHash: String?): Boolean {
return VideoCallClient.hasAssignedCall() && VideoCallClient.hasProfessionalAssignedCall(
professionalHash.toString()
)
}