0

how to reuse sound in init State() every second?

  _timer = Timer.periodic(Duration(milliseconds: widget.time), (timer) {
      setState(() {
audioPlayer.play(AssetSource('audios/sound1.wav'));
});

is there some mistake in this part

Is there a play function in audioCache?

I use audioplayer ^4.1.0

1 Answers1

0

you can try

final player = AudioPlayer();
await player.play(AssetSource('audios/sound1.wav'));

Also, you can refer this for other solutions as well.

Khyati Modi
  • 630
  • 1
  • 9
  • 19