previous method

Future<void> previous()

Plays the previous video in the sequence.

Pauses the current video, moves to the previous one, and then starts playback.

Implementation

Future<void> previous() async {
  currentController.pause();
  _removePreviousListener();
  _currentIndex =
      (_currentIndex - 1 + controllers.length) % controllers.length;
  currentController.seekTo(Duration(milliseconds: 0));
  await Future.delayed(Duration(seconds: 1));
  play();
}