skip to Main Content

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

Answers


  1. 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.

    Login or Signup to reply.
  2. 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search