AudioPlayer audioPlayer = AudioPlayer(); audioPlayer.onDurationChanged.listen((Duration duration) { print('max duration: ${duration.inSeconds}'); });