'Flutter: Playing sound from UInt8List in Android and iOS

I have a UInt8List which contains sound byte data (can be mp3 or wav).

I am trying to build a small sound player component. However I found no way to put the byte data into a audio player plugin.

  1. Is there a supporting plugin which supports loading from bytes for both platforms?
  2. Is there a way to simulate a local file without need to save the data as a real file in the file system? The idea would be to create a "simulated" local file and put into a player's loadFromFile method.
  3. Another idea was to create some kind of simulated network resourse, maybe creating an URI (Uri.dataFromBytes) and put this into a player's loadFromNetwork method...
  4. ???

I tested several approaches but none worked.

I really wonder why this seems to be very difficult although I believe that must be a very standard use case. Reading from file or network resource is easy, but already having the byte data...

Any hint appreciated! Thanks in advance.

Edit:

Maybe a possible solution would be using two different plugins. There's a plugin, which supports this for Android. Do you know one, which has the support for iOS?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source