sendVideoMessage method

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

Implementation

sendVideoMessage(
    String videoPath, String caption, String replyMessageID) async {
  if (!availableFeatures.value.isVideoAttachmentAvailable.checkNull()) {
    DialogUtils.showFeatureUnavailable();
    return;
  }
  var busyStatus = !profile.isGroupProfile.checkNull()
      ? await Mirrorfly.isBusyStatusEnabled()
      : false;
  if (!busyStatus.checkNull()) {
    if (isReplying.value) {
      replyMessageID = replyChatMessage.messageId;
    }
    isReplying(false);
    Platform.isIOS
        ? DialogUtils.showLoading(
            message: getTranslated("compressingVideo"),
            dialogStyle: AppStyleConfig.dialogStyle)
        : null;
    //old method is deprecated Instead of use below new method
    /*return Mirrorfly.sendVideoMessage(
        profile.jid!, videoPath, caption, replyMessageID,topicId: topicId)
        .then((value) {
      clearMessage();
      Platform.isIOS ? DialogUtils.hideLoading() : null;
      ChatMessageModel chatMessageModel = sendMessageModelFromJson(value);
      // chatList.insert(0, chatMessageModel);
      scrollToBottom();
      updateLastMessage(value);
      return chatMessageModel;
    });*/
    return Mirrorfly.sendMessage(
        messageParams: MessageParams.video(
            toJid: profile.jid.checkNull(),
            replyMessageId: replyMessageID,
            topicId: topicId,
            // metaData: messageMetaData, //#metaData
            fileMessageParams:
                FileMessageParams(file: File(videoPath), caption: caption)),
        flyCallback: (response) {
          if (response.isSuccess) {
            LogMessage.d("video message", response.data.toString());
            // clearMessage();
            messageController.text = "";
            Platform.isIOS ? DialogUtils.hideLoading() : 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 : "",
        messageType: Constants.mVideo,
        file: videoPath,
        caption: caption);
    showBusyStatusAlert(disableBusyChatAndSend);
  }
}