Search in sources :

Example 1 with CallPartner

use of com.fanap.podcall.model.CallPartner in project pod-chat-android-sdk by FanapSoft.

the class Chat method addScreenSharer.

private void addScreenSharer(ChatResponse<ScreenShareResult> response) {
    if (hasRemotePartnerView()) {
        visibleView(assignScreenShareView());
        CallPartner rPartner = new CallPartner.Builder().setPartnerType(PartnerType.REMOTE).setName("Screen Sharer:" + response.getResult().getScreenOwner().getUserId()).setId(CallPartnerViewPool.SCREEN_SHARE_ID).setVideoTopic(response.getResult().getScreenShare()).setVideoView(getShareScreenView()).build();
        rPartner.setHasVideo(Util.isNotNullOrEmpty(response.getResult().getScreenShare()));
        rPartner.setVideoOn(true);
        podVideoCall.addPartner(rPartner);
        listenerManager.callOnCallParticipantSharedScreen(response);
    }
}
Also used : PodCallBuilder(com.fanap.podcall.PodCallBuilder) CallPartner(com.fanap.podcall.model.CallPartner)

Example 2 with CallPartner

use of com.fanap.podcall.model.CallPartner in project pod-chat-android-sdk by FanapSoft.

the class Chat method handleOnNewCallParticipantJoined.

@Override
void handleOnNewCallParticipantJoined(ChatMessage chatMessage) {
    if (deviceIsInCall) {
        if (sentryResponseLog) {
            showLog("RECEIVE_PARTICIPANT_JOINED", gson.toJson(chatMessage));
        } else {
            showLog("RECEIVE_PARTICIPANT_JOINED");
        }
        ChatResponse<JoinCallParticipantResult> response = CallAsyncRequestsManager.handleOnParticipantJoined(chatMessage);
        if (podVideoCall != null) {
            for (CallParticipantVO callParticipant : response.getResult().getJoinedParticipants()) {
                if (callParticipant.getUserId() == 0)
                    continue;
                if (!callParticipant.getUserId().equals(CoreConfig.userId)) {
                    CallPartner.Builder rPartnerBuilder = new CallPartner.Builder();
                    rPartnerBuilder.setId(callParticipant.getUserId());
                    rPartnerBuilder.setPartnerType(PartnerType.REMOTE).setName("" + callParticipant.getUserId());
                    rPartnerBuilder.setVideoTopic(callParticipant.getSendTopicVideo());
                    rPartnerBuilder.setHasVideo(Util.isNotNullOrEmpty(callParticipant.getSendTopicVideo()));
                    rPartnerBuilder.setVideoOn(callParticipant.hasVideo());
                    if (callParticipant.hasVideo() && hasRemotePartnerView()) {
                        CallPartnerView view = assignCallPartnerView(callParticipant.getUserId());
                        if (view != null) {
                            visibleView(view);
                            view.setPartnerName(callParticipant.getParticipantVO() != null ? callParticipant.getParticipantVO().getName() : "");
                            rPartnerBuilder.setVideoView(view);
                        } else {
                            rPartnerBuilder.setVideoOn(false);
                        }
                    }
                    rPartnerBuilder.setAudioTopic(callParticipant.getSendTopicAudio());
                    rPartnerBuilder.setHasAudio(Util.isNotNullOrEmpty(callParticipant.getSendTopicAudio()));
                    rPartnerBuilder.setAudioOn(!callParticipant.isMute());
                    CallPartner rPartner = rPartnerBuilder.build();
                    podVideoCall.addPartner(rPartner);
                }
            }
        }
        listenerManager.callOnCallParticipantJoined(response);
    }
}
Also used : JoinCallParticipantResult(com.fanap.podchat.call.result_model.JoinCallParticipantResult) CallParticipantVO(com.fanap.podchat.call.model.CallParticipantVO) PodCallBuilder(com.fanap.podcall.PodCallBuilder) CallPartner(com.fanap.podcall.model.CallPartner) CallPartnerView(com.fanap.podcall.view.CallPartnerView)

Example 3 with CallPartner

use of com.fanap.podcall.model.CallPartner in project pod-chat-android-sdk by FanapSoft.

the class Chat method prepareRemotePartnersByClientDTOList.

private void prepareRemotePartnersByClientDTOList(ChatResponse<StartedCallModel> info) {
    boolean hasScreenSharer = CallAsyncRequestsManager.checkIsAnyScreenSharing(info);
    boolean isCallRecording = CallAsyncRequestsManager.checkIsCallIsRecording(info);
    for (ClientDTO client : info.getResult().getOtherClientDtoList()) {
        if (client.getUserId() == 0)
            continue;
        if (!client.getUserId().equals(CoreConfig.userId)) {
            CallPartner.Builder rPartnerBuilder = new CallPartner.Builder();
            rPartnerBuilder.setId(client.getUserId());
            rPartnerBuilder.setPartnerType(PartnerType.REMOTE).setName("" + client.getUserId());
            rPartnerBuilder.setVideoTopic(client.getTopicSendVideo());
            rPartnerBuilder.setHasVideo(Util.isNotNullOrEmpty(client.getTopicSendVideo()));
            rPartnerBuilder.setVideoOn(client.getVideo());
            if (client.getVideo() && hasRemotePartnerView()) {
                CallPartnerView view = assignCallPartnerView(client.getUserId());
                if (view != null) {
                    visibleView(view);
                    rPartnerBuilder.setVideoView(view);
                } else {
                    rPartnerBuilder.setVideoOn(false);
                }
            }
            rPartnerBuilder.setAudioTopic(client.getTopicSendAudio());
            rPartnerBuilder.setHasAudio(Util.isNotNullOrEmpty(client.getTopicSendAudio()));
            rPartnerBuilder.setAudioOn(!client.getMute());
            CallPartner rPartner = rPartnerBuilder.build();
            podVideoCall.addPartner(rPartner);
        }
    }
    if (hasScreenSharer) {
        ChatResponse<ScreenShareResult> sc = CallAsyncRequestsManager.handleOnScreenIsSharing(info);
        addScreenSharer(sc);
    }
    if (isCallRecording) {
        ChatResponse<Participant> response = CallAsyncRequestsManager.handleCallIsRecordingCallResponse(info);
        if (CoreConfig.userId.equals(response.getResult().getId())) {
            removeCallback(info.getUniqueId());
            listenerManager.callOnCallRecordStarted(response);
        } else {
            listenerManager.callOnCallParticipantStartRecording(response);
        }
    }
}
Also used : ScreenShareResult(com.fanap.podchat.call.request_model.screen_share.ScreenShareResult) Participant(com.fanap.podchat.mainmodel.Participant) ClientDTO(com.fanap.podchat.call.model.ClientDTO) PodCallBuilder(com.fanap.podcall.PodCallBuilder) CallPartner(com.fanap.podcall.model.CallPartner) CallPartnerView(com.fanap.podcall.view.CallPartnerView)

Aggregations

PodCallBuilder (com.fanap.podcall.PodCallBuilder)3 CallPartner (com.fanap.podcall.model.CallPartner)3 CallPartnerView (com.fanap.podcall.view.CallPartnerView)2 CallParticipantVO (com.fanap.podchat.call.model.CallParticipantVO)1 ClientDTO (com.fanap.podchat.call.model.ClientDTO)1 ScreenShareResult (com.fanap.podchat.call.request_model.screen_share.ScreenShareResult)1 JoinCallParticipantResult (com.fanap.podchat.call.result_model.JoinCallParticipantResult)1 Participant (com.fanap.podchat.mainmodel.Participant)1