Search in sources :

Example 1 with ScreenShareResult

use of com.fanap.podchat.call.request_model.screen_share.ScreenShareResult in project pod-chat-android-sdk by FanapSoft.

the class CallAsyncRequestsManager method handleOnScreenShareStarted.

public static ChatResponse<ScreenShareResult> handleOnScreenShareStarted(ChatMessage chatMessage) {
    ChatResponse<ScreenShareResult> response = null;
    try {
        response = new ChatResponse<>();
        response.setUniqueId(chatMessage.getUniqueId());
        response.setSubjectId(chatMessage.getSubjectId());
        ScreenShareResult screenSharer = App.getGson().fromJson(chatMessage.getContent(), ScreenShareResult.class);
        response.setResult(screenSharer);
    } catch (Exception e) {
        Log.wtf(TAG, e);
    }
    return response;
}
Also used : ScreenShareResult(com.fanap.podchat.call.request_model.screen_share.ScreenShareResult) PodChatException(com.fanap.podchat.util.PodChatException) JsonSyntaxException(com.google.gson.JsonSyntaxException)

Example 2 with ScreenShareResult

use of com.fanap.podchat.call.request_model.screen_share.ScreenShareResult in project pod-chat-android-sdk by FanapSoft.

the class CallAsyncRequestsManager method handleOnScreenIsSharing.

public static ChatResponse<ScreenShareResult> handleOnScreenIsSharing(ChatResponse<StartedCallModel> info) {
    ChatResponse<ScreenShareResult> response = null;
    try {
        response = new ChatResponse<>();
        response.setUniqueId(info.getUniqueId());
        response.setSubjectId(info.getSubjectId());
        ScreenShareResult scr = new ScreenShareResult();
        scr.setScreenshare(info.getResult().getChatDataDTO().getScreenShare());
        CallParticipantVO callParticipantVO = new CallParticipantVO();
        callParticipantVO.setUserId(Long.valueOf(info.getResult().getChatDataDTO().getScreenShareUser()));
        scr.setScreenOwner(callParticipantVO);
        response.setResult(scr);
    } catch (Exception e) {
        Log.wtf(TAG, e);
    }
    return response;
}
Also used : ScreenShareResult(com.fanap.podchat.call.request_model.screen_share.ScreenShareResult) CallParticipantVO(com.fanap.podchat.call.model.CallParticipantVO) PodChatException(com.fanap.podchat.util.PodChatException) JsonSyntaxException(com.google.gson.JsonSyntaxException)

Example 3 with ScreenShareResult

use of com.fanap.podchat.call.request_model.screen_share.ScreenShareResult 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)

Example 4 with ScreenShareResult

use of com.fanap.podchat.call.request_model.screen_share.ScreenShareResult in project pod-chat-android-sdk by FanapSoft.

the class Chat method handOnShareScreenStarted.

@Override
void handOnShareScreenStarted(ChatMessage chatMessage, Callback callback) {
    if (deviceIsInCall) {
        if (sentryResponseLog) {
            showLog("RECEIVE_SHARE_SCREEN_STARTED", gson.toJson(chatMessage));
        } else {
            showLog("RECEIVE_SHARE_SCREEN_STARTED");
        }
        if (podVideoCall != null) {
            ChatResponse<ScreenShareResult> response = CallAsyncRequestsManager.handleOnScreenShareStarted(chatMessage);
            if (Util.isNotNullOrEmpty(response.getResult().getScreenShare())) {
                if (callback != null) {
                    removeCallback(chatMessage.getUniqueId());
                    ScreenSharer screenSharer = new ScreenSharer.Builder().setPartnerType(PartnerType.LOCAL).setName("Your Screen").setVideoTopic(response.getResult().getScreenShare()).build();
                    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                        podVideoCall.addScreenSharer(screenSharer);
                        listenerManager.callOnScreenShareStarted(response);
                    }
                } else {
                    addScreenSharer(response);
                }
            } else {
                captureError(new PodChatException(ChatConstant.ERROR_METHOD_NOT_IMPLEMENTED, ChatConstant.ERROR_CODE_METHOD_NOT_IMPLEMENTED, chatMessage.getUniqueId()));
            }
        }
    }
}
Also used : ScreenShareResult(com.fanap.podchat.call.request_model.screen_share.ScreenShareResult) PodChatException(com.fanap.podchat.util.PodChatException) ScreenSharer(com.fanap.podcall.screenshare.model.ScreenSharer) PodCallBuilder(com.fanap.podcall.PodCallBuilder)

Aggregations

ScreenShareResult (com.fanap.podchat.call.request_model.screen_share.ScreenShareResult)4 PodChatException (com.fanap.podchat.util.PodChatException)3 PodCallBuilder (com.fanap.podcall.PodCallBuilder)2 JsonSyntaxException (com.google.gson.JsonSyntaxException)2 CallPartner (com.fanap.podcall.model.CallPartner)1 ScreenSharer (com.fanap.podcall.screenshare.model.ScreenSharer)1 CallPartnerView (com.fanap.podcall.view.CallPartnerView)1 CallParticipantVO (com.fanap.podchat.call.model.CallParticipantVO)1 ClientDTO (com.fanap.podchat.call.model.ClientDTO)1 Participant (com.fanap.podchat.mainmodel.Participant)1