Merge pull request #1763 from famedly/td/audiomscfix
fix: remove msc3245 key from audio events
This commit is contained in:
commit
eac0bdb9fd
|
|
@ -1,19 +1,11 @@
|
||||||
import 'package:matrix/matrix.dart';
|
import 'package:matrix/matrix.dart';
|
||||||
|
|
||||||
extension AudioEventExtension on Event {
|
|
||||||
/// returns if the event is a voice message
|
|
||||||
bool get isVoiceMessage =>
|
|
||||||
content['org.matrix.msc2516.voice'] is Map<String, Object?> ||
|
|
||||||
content['org.matrix.msc3245.voice'] is Map<String, Object?>;
|
|
||||||
}
|
|
||||||
|
|
||||||
extension AudioEventRoomExtension on Room {
|
extension AudioEventRoomExtension on Room {
|
||||||
/// Sends an audio file with appropriate info to this room. Returns the event
|
/// Sends an audio file with appropriate info to this room. Returns the event
|
||||||
/// ID generated by the server for this event.
|
/// ID generated by the server for this event.
|
||||||
Future<String?> sendAudioEvent(
|
Future<String?> sendAudioEvent(
|
||||||
MatrixAudioFile audioFile, {
|
MatrixAudioFile audioFile, {
|
||||||
Event? replyTo,
|
Event? replyTo,
|
||||||
bool isVoiceMessage = false,
|
|
||||||
int? durationInMs,
|
int? durationInMs,
|
||||||
List<int>? waveform,
|
List<int>? waveform,
|
||||||
Map<String, dynamic>? otherFileInfo,
|
Map<String, dynamic>? otherFileInfo,
|
||||||
|
|
@ -24,10 +16,6 @@ extension AudioEventRoomExtension on Room {
|
||||||
otherFileInfo['duration'] = durationInMs;
|
otherFileInfo['duration'] = durationInMs;
|
||||||
}
|
}
|
||||||
if (otherFileInfo != null) extraContent['info'] = otherFileInfo;
|
if (otherFileInfo != null) extraContent['info'] = otherFileInfo;
|
||||||
if (isVoiceMessage) {
|
|
||||||
// No content, this is only used to identify if the event is a voice message.
|
|
||||||
extraContent['org.matrix.msc3245.voice'] = <String, Object?>{};
|
|
||||||
}
|
|
||||||
extraContent['org.matrix.msc1767.audio'] = <String, Object?>{
|
extraContent['org.matrix.msc1767.audio'] = <String, Object?>{
|
||||||
'duration': durationInMs,
|
'duration': durationInMs,
|
||||||
'waveform': waveform,
|
'waveform': waveform,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue