sendVideoMessage method

dynamic sendVideoMessage(
  1. String videoPath,
  2. String caption,
  3. String replyMessageID,
  4. BuildContext context,
)

Implementation

sendVideoMessage(String videoPath, String caption, String replyMessageID,
    BuildContext context) async {
  var busyStatus = !profile.isGroupProfile.checkNull()
      ? await Mirrorfly.isBusyStatusEnabled()
      : false;
  if (!busyStatus.checkNull()) {
    if (isReplying.value) {
      replyMessageID = replyChatMessage.messageId;
    }
    isReplying(false);
    if (context.mounted) {
      if (Platform.isIOS) {
        Helper.showLoading(
            message: AppConstants.compressingVideo, buildContext: context);
      }
    }
    return Mirrorfly.sendMessage(
        messageParams: MessageParams.video(
            toJid: profile.jid.checkNull(),
            replyMessageId: replyMessageID,
            topicId: topicId,
            fileMessageParams:
                FileMessageParams(file: File(videoPath), caption: caption)),
        flyCallback: (response) {
          if (response.isSuccess) {
            mirrorFlyLog("video message", response.data.toString());
            clearMessage();
            Platform.isIOS ? Helper.hideLoading(context: context) : null;
            ChatMessageModel chatMessageModel =
                sendMessageModelFromJson(response.data);
            // chatList.insert(0, chatMessageModel);
            scrollToBottom();
            updateLastMessage(response.data);
            return chatMessageModel;
          } else {
            LogMessage.d("sendMessage", response.errorMessage);
            //PlatformException(500, Not enough storage space on your device. Please free up space in your phone's memory. ErrorCode => 808, com.mirrorflysdk.flycommons.exception.FlyException: Not enough storage space on your device. Please free up space in your phone's memory. ErrorCode => 808
            showError(response.exception);
          }
        });
  } else {
    //show busy status popup
    messageObject = MessageObject(
        toJid: profile.jid.toString(),
        replyMessageId: (isReplying.value)
            ? replyChatMessage.messageId
            : Constants.emptyString,
        messageType: Constants.mVideo,
        file: videoPath,
        caption: caption);
    if (context.mounted) showBusyStatusAlert(disableBusyChatAndSend, context);
  }
}