sendAudioEvent method

Future<String?> sendAudioEvent(
  1. MatrixAudioFile audioFile, {
  2. Event? replyTo,
  3. int? durationInMs,
  4. List<int>? waveform,
  5. Map<String, dynamic>? otherFileInfo,
})

Sends an audio file with appropriate info to this room. Returns the event ID generated by the server for this event.

Implementation

Future<String?> sendAudioEvent(
  MatrixAudioFile audioFile, {
  Event? replyTo,
  int? durationInMs,
  List<int>? waveform,
  Map<String, dynamic>? otherFileInfo,
}) {
  final extraContent = <String, Map<String, Object?>>{};
  if (durationInMs != null) {
    otherFileInfo ??= {};
    otherFileInfo['duration'] = durationInMs;
  }
  if (otherFileInfo != null) extraContent['info'] = otherFileInfo;
  extraContent['org.matrix.msc1767.audio'] = <String, Object?>{
    'duration': durationInMs,
    'waveform': waveform,
  };
  return sendFileEvent(
    audioFile,
    inReplyTo: replyTo,
    extraContent: extraContent,
  );
}