play method

Future<void> play(
  1. String filename, {
  2. double volume = 1,
})

Implementation

Future<void> play(String filename, {double volume = 1}) async {
  final currentPlayer = audioPlayer;
  if (currentPlayer != null && currentPlayer.state != PlayerState.STOPPED) {
    currentPlayer.stop();
  }

  isPlaying = true;
  audioPlayer = await audioCache.loop(filename, volume: volume);
}