chore: Follow up fix Play audio and video messages
This commit is contained in:
parent
f2d9c9ecf1
commit
130b58b24a
2 changed files with 4 additions and 3 deletions
|
|
@ -10,6 +10,7 @@ import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
import 'package:matrix/matrix.dart';
|
import 'package:matrix/matrix.dart';
|
||||||
import 'package:path_provider/path_provider.dart';
|
import 'package:path_provider/path_provider.dart';
|
||||||
|
|
||||||
|
import 'package:fluffychat/utils/localized_exception_extension.dart';
|
||||||
import 'package:fluffychat/utils/sentry_controller.dart';
|
import 'package:fluffychat/utils/sentry_controller.dart';
|
||||||
import '../../../utils/matrix_sdk_extensions.dart/event_extension.dart';
|
import '../../../utils/matrix_sdk_extensions.dart/event_extension.dart';
|
||||||
|
|
||||||
|
|
@ -66,7 +67,7 @@ class _AudioPlayerState extends State<AudioPlayerWidget> {
|
||||||
await widget.event.downloadAndDecryptAttachmentCached();
|
await widget.event.downloadAndDecryptAttachmentCached();
|
||||||
if (matrixFile == null) throw ('Download failed');
|
if (matrixFile == null) throw ('Download failed');
|
||||||
final tempDir = await getTemporaryDirectory();
|
final tempDir = await getTemporaryDirectory();
|
||||||
final fileName = widget.event.content.tryGet<String>('url')!;
|
final fileName = widget.event.attachmentOrThumbnailMxcUrl()!.toString();
|
||||||
final file = File('${tempDir.path}/$fileName');
|
final file = File('${tempDir.path}/$fileName');
|
||||||
await file.writeAsBytes(matrixFile.bytes);
|
await file.writeAsBytes(matrixFile.bytes);
|
||||||
|
|
||||||
|
|
@ -79,7 +80,7 @@ class _AudioPlayerState extends State<AudioPlayerWidget> {
|
||||||
Logs().v('Could not download audio file', e, s);
|
Logs().v('Could not download audio file', e, s);
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(
|
SnackBar(
|
||||||
content: Text(e.toString()),
|
content: Text(e.toLocalizedString(context)),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ class _EventVideoPlayerState extends State<EventVideoPlayer> {
|
||||||
_networkUri = html.Url.createObjectUrlFromBlob(blob);
|
_networkUri = html.Url.createObjectUrlFromBlob(blob);
|
||||||
} else {
|
} else {
|
||||||
final tempDir = await getTemporaryDirectory();
|
final tempDir = await getTemporaryDirectory();
|
||||||
final fileName = widget.event.content.tryGet<String>('url')!;
|
final fileName = widget.event.attachmentOrThumbnailMxcUrl()!.toString();
|
||||||
final file = File('${tempDir.path}/$fileName');
|
final file = File('${tempDir.path}/$fileName');
|
||||||
if (await file.exists() == false) {
|
if (await file.exists() == false) {
|
||||||
await file.writeAsBytes(videoFile.bytes);
|
await file.writeAsBytes(videoFile.bytes);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue