use of com.fanap.podchat.util.PodChatException in project pod-chat-android-sdk by FanapSoft.
the class CallAsyncRequestsManager method createTurnOffVideoMessage.
public static String createTurnOffVideoMessage(TurnCallParticipantVideoOffRequest request, String uniqueId) throws PodChatException {
if (request.getCallId() <= 0)
throw new PodChatException(ChatConstant.ERROR_INVALID_THREAD_ID, ChatConstant.ERROR_CODE_INVALID_THREAD_ID);
if (Util.isNullOrEmpty(request.getParticipantsIds()))
throw new PodChatException(ChatConstant.MUTE_USER_LIST_IS_EMPTY, ChatConstant.ERROR_CODE_INVALID_DATA);
String content = App.getGson().toJson(request.getParticipantsIds());
AsyncMessage message = new AsyncMessage();
message.setContent(content);
message.setType(ChatMessageType.Constants.TURN_OFF_VIDEO_CALL);
message.setToken(CoreConfig.token);
message.setSubjectId(request.getCallId());
message.setTokenIssuer(CoreConfig.tokenIssuer);
message.setUniqueId(uniqueId);
message.setTypeCode(Util.isNullOrEmpty(request.getTypeCode()) ? request.getTypeCode() : CoreConfig.typeCode);
JsonObject a = (JsonObject) App.getGson().toJsonTree(message);
return a.toString();
}
use of com.fanap.podchat.util.PodChatException in project pod-chat-android-sdk by FanapSoft.
the class CallAsyncRequestsManager method createGetActiveCallParticipantsMessage.
public static String createGetActiveCallParticipantsMessage(GetCallParticipantsRequest request, String uniqueId) throws PodChatException {
if (request.getCallId() <= 0)
throw new PodChatException("Invalid call id", ChatConstant.ERROR_CODE_INVALID_THREAD_ID, uniqueId);
AsyncMessage message = new AsyncMessage();
message.setType(ChatMessageType.Constants.GET_ACTIVE_CALL_PARTICIPANTS);
message.setToken(CoreConfig.token);
message.setTokenIssuer(CoreConfig.tokenIssuer);
message.setUniqueId(uniqueId);
message.setSubjectId(request.getCallId());
message.setTypeCode(Util.isNotNullOrEmpty(request.getTypeCode()) ? request.getTypeCode() : CoreConfig.typeCode);
return App.getGson().toJson(message);
}
use of com.fanap.podchat.util.PodChatException 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()));
}
}
}
}
use of com.fanap.podchat.util.PodChatException in project pod-chat-android-sdk by FanapSoft.
the class Chat method setupCall.
@Deprecated
public void setupCall(VideoCallParam videoCallParam, AudioCallParam audioCallParam, List<CallPartnerView> remoteViews) {
this.localPartnerView = videoCallParam.getCameraPreview();
this.videoCallPartnerViews = new ArrayList<>(remoteViews);
podVideoCall = new PodCallBuilder(context, new IPodCall() {
@Override
public void onError(String s) {
captureError(new PodChatException(s, ChatConstant.ERROR_CODE_CALL_INITIAL_ERROR));
}
@Override
public void onEvent(String s) {
showLog(s);
}
@Override
public void onCameraReady(PodCall podCall) {
showLog("Camera is ready");
}
}).setVideoCallParam(videoCallParam).setAudioCallParam(audioCallParam).build();
podVideoCall.initial();
}
Aggregations