startPlayAni method

void startPlayAni(
  1. int duration
)

Implementation

void startPlayAni(int duration) {
  timer = Timer.periodic(const Duration(seconds: 1), (timer) {
    if (duration == 0) {
      setState(() {
        aniIndex = 2;
      });
      timer.cancel();
    } else {
      duration--;
      setState(() {
        aniIndex = (aniIndex + 1) % 3;
      });
    }
  });

  audioPlayerService.playRecording(widget.data.messageContent);
}