feat: Add audio message support to linux
This commit is contained in:
parent
54dff35ea4
commit
680dd886d8
4 changed files with 34 additions and 8 deletions
|
|
@ -102,6 +102,7 @@ class AudioPlayerState extends State<AudioPlayerWidget> {
|
|||
}
|
||||
|
||||
onAudioPositionChanged ??= audioPlayer.positionStream.listen((state) {
|
||||
if (maxPosition <= 0) return;
|
||||
setState(() {
|
||||
statusText =
|
||||
'${state.inMinutes.toString().padLeft(2, '0')}:${(state.inSeconds % 60).toString().padLeft(2, '0')}';
|
||||
|
|
@ -110,9 +111,10 @@ class AudioPlayerState extends State<AudioPlayerWidget> {
|
|||
.round();
|
||||
});
|
||||
});
|
||||
onDurationChanged ??= audioPlayer.durationStream.listen((max) => max == null
|
||||
? null
|
||||
: setState(() => maxPosition = max.inMilliseconds.toDouble()));
|
||||
onDurationChanged ??= audioPlayer.durationStream.listen((max) {
|
||||
if (max == null || max == Duration.zero) return;
|
||||
setState(() => maxPosition = max.inMilliseconds.toDouble());
|
||||
});
|
||||
onPlayerStateChanged ??=
|
||||
audioPlayer.playingStream.listen((_) => setState(() {}));
|
||||
audioPlayer.setFilePath(audioFile!.path);
|
||||
|
|
|
|||
|
|
@ -112,7 +112,9 @@ class MessageContent extends StatelessWidget {
|
|||
case CuteEventContent.eventType:
|
||||
return CuteContent(event);
|
||||
case MessageTypes.Audio:
|
||||
if (PlatformInfos.isMobile || PlatformInfos.isMacOS) {
|
||||
if (PlatformInfos.isMobile ||
|
||||
PlatformInfos.isMacOS ||
|
||||
PlatformInfos.isLinux) {
|
||||
return AudioPlayerWidget(
|
||||
event,
|
||||
color: textColor,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue