audioplayers icon indicating copy to clipboard operation
audioplayers copied to clipboard

Feature: Audio cache - playAll()

Open moos opened this issue 5 years ago • 3 comments

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.

moos avatar Jul 14 '19 19:07 moos

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 :)

luanpotter avatar Jul 14 '19 22:07 luanpotter

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

moos avatar Jul 14 '19 23:07 moos

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

sigjak avatar Feb 18 '21 18:02 sigjak