sendAudioMessage method

Future<NIMResult<NIMMessage>> sendAudioMessage(
  1. {required String sessionId,
  2. required NIMSessionType sessionType,
  3. required String filePath,
  4. required int fileSize,
  5. required int duration,
  6. String? displayName,
  7. String? base64,
  8. NIMNosScene nosScene = NIMNosScenes.defaultIm,
  9. MessageAction? action}
)

发送音频消息 displayName 字段无效,不建议使用 base64 字段为web端专用,web端filePath 可传空字符串

Implementation

Future<NIMResult<NIMMessage>> sendAudioMessage({
  required String sessionId,
  required NIMSessionType sessionType,
  required String filePath,
  required int fileSize,
  required int duration,
  String? displayName,
  String? base64,
  NIMNosScene nosScene = NIMNosScenes.defaultIm,
  MessageAction? action,
}) async {
  final message = NIMMessage.audioEmptyMessage(
      sessionId: sessionId,
      sessionType: sessionType,
      filePath: filePath,
      fileSize: fileSize,
      base64: base64,
      duration: duration,
      displayName: displayName,
      nosScene: nosScene);
  return _createMessageAndSend(message, action);
}