sendChatroomAudioMessage method

Future<NIMResult<NIMChatroomMessage>> sendChatroomAudioMessage(
  1. {required String roomId,
  2. required String filePath,
  3. required int duration,
  4. NIMNosScene nosScene = NIMNosScenes.defaultIm,
  5. bool resend = false,
  6. ChatroomMessageAction? action}
)

发送聊天室音频消息

Implementation

Future<NIMResult<NIMChatroomMessage>> sendChatroomAudioMessage({
  required String roomId,
  required String filePath,
  required int duration,
  NIMNosScene nosScene = NIMNosScenes.defaultIm,
  bool resend = false,
  ChatroomMessageAction? action,
}) async {
  return _createMessage({
    'roomId': roomId,
    'filePath': filePath,
    'duration': duration,
    'nosScene': nosScene,
    'messageType': 'audio',
  }).then((messageResult) async {
    if (messageResult.isSuccess) {
      final message = messageResult.data as NIMChatroomMessage;
      await action?.call(message);
      return sendChatroomMessage(message, resend);
    } else {
      return messageResult;
    }
  });
}