mirror of
				https://gitlab.com/famedly/fluffychat.git
				synced 2025-11-03 22:07:23 +01:00 
			
		
		
		
	chore: Follow up fix Play audio and video messages
This commit is contained in:
		
							parent
							
								
									c10b38b27b
								
							
						
					
					
						commit
						0454a725f3
					
				@ -10,6 +10,7 @@ import 'package:flutter_gen/gen_l10n/l10n.dart';
 | 
			
		||||
import 'package:matrix/matrix.dart';
 | 
			
		||||
import 'package:path_provider/path_provider.dart';
 | 
			
		||||
 | 
			
		||||
import 'package:fluffychat/utils/localized_exception_extension.dart';
 | 
			
		||||
import 'package:fluffychat/utils/sentry_controller.dart';
 | 
			
		||||
import '../../../utils/matrix_sdk_extensions.dart/event_extension.dart';
 | 
			
		||||
 | 
			
		||||
@ -66,7 +67,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>('url')!;
 | 
			
		||||
      final fileName = widget.event.attachmentOrThumbnailMxcUrl()!.toString();
 | 
			
		||||
      final file = File('${tempDir.path}/$fileName');
 | 
			
		||||
      await file.writeAsBytes(matrixFile.bytes);
 | 
			
		||||
 | 
			
		||||
@ -79,7 +80,7 @@ class _AudioPlayerState extends State<AudioPlayerWidget> {
 | 
			
		||||
      Logs().v('Could not download audio file', e, s);
 | 
			
		||||
      ScaffoldMessenger.of(context).showSnackBar(
 | 
			
		||||
        SnackBar(
 | 
			
		||||
          content: Text(e.toString()),
 | 
			
		||||
          content: Text(e.toLocalizedString(context)),
 | 
			
		||||
        ),
 | 
			
		||||
      );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -41,7 +41,7 @@ class _EventVideoPlayerState extends State<EventVideoPlayer> {
 | 
			
		||||
        _networkUri = html.Url.createObjectUrlFromBlob(blob);
 | 
			
		||||
      } else {
 | 
			
		||||
        final tempDir = await getTemporaryDirectory();
 | 
			
		||||
        final fileName = widget.event.content.tryGet<String>('url')!;
 | 
			
		||||
        final fileName = widget.event.attachmentOrThumbnailMxcUrl()!.toString();
 | 
			
		||||
        final file = File('${tempDir.path}/$fileName');
 | 
			
		||||
        if (await file.exists() == false) {
 | 
			
		||||
          await file.writeAsBytes(videoFile.bytes);
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user