I make a looping function and support running in background, so I choose audio_service and just_audio.
But I want to control the interval between two audios playing.
I hope the first one has finished playing, set 1 second and then play the second effect and I'm new to flutter and hope to get help, thank you!
This is the raw effect.
class MyAudioHandler extends BaseAudioHandler {
...
@override
Future<void> play() async {
sleep(Duration(seconds:1));
_player.play();
}
I tried adding a sleep to the override play function but it didn't work.I'm guessing that the looping is internally cached or something, I don't know。
try:
@override
Future<void> play() async {
await Future.delayed(Duration(seconds:1));
_player.play();
}