bluefireteam / audioplayers

A Flutter package to play multiple audio files simultaneously (Android/iOS/web/Linux/Windows/macOS)
https://pub.dartlang.org/packages/audioplayers
MIT License
1.97k stars 838 forks source link

Feature: Audio cache - playAll() #228

Open moos opened 5 years ago

moos commented 5 years ago

When I saw the loadAll() method in Audio Cache, I got excited that I'd find a playAll() method as well. Alas, it was not to be. After spending some time mucking around with Futures and Streams (noob to Dart and Flutter) without success, I thought it'd be great if the library provided this functionality, i.e. to play a list of audio files in sequence, i.e.

   player.playAll(['hello.mp3', 'world.mp3']);

or alternatively, a node-style sync method,

  player.playSync('hello.mp3');
  player.playSync('world.mp3');

Yes, there is a clunky brute-force way to get this done (via onPlayerCompletion) but I'm looking for a clean, generalized way.

Would appreciate thoughts or feedback.

luanpotter commented 5 years ago

Neat idea! I'd just change the name from playAll to something making it clear that it would be sequential, rather than simultaneous. Maybe even create two methods for both approaches. I'd love to see a PR about that, if you are willing :)

moos commented 5 years ago

Glad you like the idea. Just got around to implementing a first pass -- comments welcome.

sigjak commented 3 years ago

I second this idea. It would be nice to have e.g. when playing chapters in audiobooks