NIMMessage.audioEmptyMessage constructor
Implementation
factory NIMMessage.audioEmptyMessage(
{required String sessionId,
required NIMSessionType sessionType,
required String filePath,
required int fileSize,
required int duration,
String? displayName,
String? base64,
NIMNosScene nosScene = NIMNosScenes.defaultIm}) {
/// 最低显示1秒
if (duration < 1000) duration = 1000;
var extension = filePath.split('.').last;
var audioAttachment = NIMAudioAttachment(
path: filePath,
size: fileSize,
duration: duration,
base64: base64,
extension: extension,
nosScene: nosScene);
return NIMMessage(
messageDirection: NIMMessageDirection.outgoing,
messageType: NIMMessageType.audio,
timestamp: new DateTime.now().millisecondsSinceEpoch,
status: NIMMessageStatus.sending,
sessionId: sessionId,
sessionType: sessionType,
messageAttachment: audioAttachment);
}