0

I am using an audioplayers package. I want to start an sound from an asset and at the same time i want to start second function. It is important to start both a the same time.

I tried to async, await on audioplayer.play(). I tried onCompleted but i am still getting some deley beetwen functions.

Any ideas?

1 Answers1

0

yes you can simply use

await Future.wait([
  startFunctionOne(),
  audioPlayer.play('assets/yourfile.mp3'),
  startFunctionTwo(),
]);

this take a List of function which run at once

Shahzeb Naqvi
  • 313
  • 2
  • 8
  • I describe it wrong. I wanted to rum a function as soon as the music starts to play. But when i make it like. await audioplayer.play, someFunction() i have all the times different delays – Kamil Żebrowski Apr 30 '23 at 19:54