fix: Videoplayer filenames

This commit is contained in:
Christian Pauly 2022-01-27 21:01:29 +01:00
parent f17ae118d0
commit 89f32bd4c3
2 changed files with 4 additions and 4 deletions

View File

@ -66,8 +66,7 @@ class _AudioPlayerState extends State<AudioPlayerWidget> {
await widget.event.downloadAndDecryptAttachmentCached();
if (matrixFile == null) throw ('Download failed');
final tempDir = await getTemporaryDirectory();
final fileName =
widget.event.content.tryGet<String>('filename') ?? matrixFile.name;
final fileName = widget.event.infoMap['url'] as String;
final file = File('${tempDir.path}/$fileName');
await file.writeAsBytes(matrixFile.bytes);

View File

@ -40,8 +40,9 @@ class _EventVideoPlayerState extends State<EventVideoPlayer> {
final blob = html.Blob([videoFile.bytes]);
_networkUri = html.Url.createObjectUrlFromBlob(blob);
} else {
final tmpDir = await getTemporaryDirectory();
final file = File(tmpDir.path + videoFile.name);
final tempDir = await getTemporaryDirectory();
final fileName = widget.event.infoMap['url'] as String;
final file = File('${tempDir.path}/$fileName');
if (await file.exists() == false) {
await file.writeAsBytes(videoFile.bytes);
}