use of com.fanap.podchat.call.audio_call.ICallState in project pod-chat-android-sdk by FanapSoft.
the class Chat method startVideoCall.
private void startVideoCall(ChatResponse<StartedCallModel> info) {
if (podVideoCall != null) {
KafkaConfig kafkaConfig = new KafkaConfig.Builder(info.getResult().getChatDataDTO().getBrokerAddress()).setSsl(info.getResult().getCert_file()).build();
podVideoCall.setKafkaConfig(kafkaConfig);
ClientDTO localClient = info.getResult().getClientDTO();
String sendVideoTopic = localClient.getTopicSendVideo();
String sendAudioTopic = localClient.getTopicSendAudio();
CallPartner.Builder lCallPartnerBuilder = new CallPartner.Builder();
lCallPartnerBuilder.setPartnerType(PartnerType.LOCAL);
lCallPartnerBuilder.setName(info.getResult().getClientDTO().getSendKey() + "" + sendVideoTopic);
if (localClient.getVideo()) {
visibleView(localPartnerView);
localPartnerView.setPartnerId(CoreConfig.userId);
localPartnerView.setPartnerName("You");
lCallPartnerBuilder.setVideoTopic(sendVideoTopic);
lCallPartnerBuilder.setVideoView(localPartnerView);
}
lCallPartnerBuilder.setAudioTopic(sendAudioTopic);
podVideoCall.addPartner(lCallPartnerBuilder.build());
if (Util.isNotNullOrEmpty(info.getResult().getOtherClientDtoList())) {
prepareRemotePartnersByClientDTOList(info);
} else {
captureError(new PodChatException("Util.isNotNullOrEmpty(info.getResult().getOtherClientDtoList()) == false", ChatConstant.ERROR_CODE_INVALID_DATA));
}
try {
podVideoCall.startCall();
} catch (MicrophoneUnavailableException e) {
captureError(new PodChatException(e.getMessage(), ChatConstant.ERROR_CODE_MICROPHONE_NOT_AVAILABLE, info.getUniqueId()));
sendClientCallErrors(new CallClientErrorsRequest.Builder(info.getSubjectId(), ChatConstant.ERROR_CODE_MICROPHONE_NOT_AVAILABLE).build());
} catch (CameraUnavailableException e) {
captureError(new PodChatException(e.getMessage(), ChatConstant.ERROR_CODE_CAMERA_NOT_AVAILABLE, info.getUniqueId()));
sendClientCallErrors(new CallClientErrorsRequest.Builder(info.getSubjectId(), ChatConstant.ERROR_CODE_CAMERA_NOT_AVAILABLE).build());
}
if (callServiceManager != null)
callServiceManager.startCallService(info, new ICallState() {
@Override
public void onInfoEvent(String info) {
}
@Override
public void onErrorEvent(String cause) {
}
@Override
public void onEndCallRequested() {
endCall();
endCall(CallAsyncRequestsManager.createEndCallRequest(info.getSubjectId()));
listenerManager.callOnEndCallRequestFromNotification();
}
});
}
}
Aggregations