Fix issue with audio file with spaces not playing

This commit is contained in:
Tanay Neotia
2022-12-23 14:12:14 -05:00
parent 2f553bbe78
commit 10c0534675

View File

@ -5,6 +5,7 @@ import 'package:bluebubbles/models/models.dart';
import 'package:bluebubbles/services/services.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:universal_io/io.dart';
class AudioPlayer extends StatefulWidget {
final PlatformFile file;
@ -51,6 +52,10 @@ class _AudioPlayerState extends OptimizedState<AudioPlayer> with AutomaticKeepAl
void initBytes() async {
if (attachment != null) controller = cvController?.audioPlayers[attachment!.guid];
if (controller == null) {
final uriPath = Uri.parse(file.path!).path;
if (!(await File(uriPath).exists())) {
await File(file.path!).copy(uriPath);
}
controller = PlayerController()..addListener(() {
setState(() {});
});