flutter_playout icon indicating copy to clipboard operation
flutter_playout copied to clipboard

How to play URL voice notes in a ListView

Open huxaiphaer opened this issue 4 years ago • 2 comments

When I play a voice note in a listView, the slider on the first index only moves, the rest of the nth ones no longer works , how can I solve this?

This is my sample project.

huxaiphaer avatar Sep 13 '20 18:09 huxaiphaer

Hi @KhuramKhalid , can you help me resolve the issue ?

huxaiphaer avatar Sep 15 '20 11:09 huxaiphaer

The audio player is currently built to run as singleton so creating multiple instances in a list might not work as expected. Instead what you can do is create one instance of audio player in your main.dart and pass that to your audio_widget.dart. Then keep all your individual player state in audio_widget.dart and pass it to the audio player instance. That way behind the scenes it'll be a single audio player playing multiple URLs. I haven't tried this but in theory it should work.

KhuramKhalid avatar Sep 15 '20 11:09 KhuramKhalid