0

I using a package called flutter_sound to record audio in Web but the result after finish the record is like that

blob:http://localhost:54779/f1b68f68-8007-4168-abd3-3de5ec8cabbe

how to convert it to a Uint8List in flutter to upload it to anything such as firestore.

2 Answers2

0

Try to read for an answer here: How to get a Uint8List from a Network image by url in Flutter?

You have a binary object that you have url to. Just download it and store it as UIntList.

0
if (kIsWeb) {
  final blobFilePath = html.window.sessionStorage[audioFilePath];
  if (blobFilePath != null) {
    final uri = Uri.parse(blobFilePath);
    final client = http.Client();
    final request = await client.get(uri);
    final bytes = await request.bodyBytes;
    print('response bytes.length: ${bytes.length}');
  }
}

audioFilePath is the blob url actually, can be found in startPlayer method in demo.dart file for example.

Hope this helps.

P.S. http package has been added in pubspec.yaml file, http.Client() imported from it.

ermekk
  • 66
  • 5