82.10 Implementing the playAudio() method
The playAudio() method will simply create a new MediaPlayer instance, assign the audio file located on the SD card as the data source and then prepare and start the playback:
fun playAudio(view: View) {
binding.playButton.isEnabled = false
binding.recordButton.isEnabled = false
binding.stopButton.isEnabled = true
mediaPlayer = MediaPlayer()
mediaPlayer?.setDataSource(audioFilePath)
mediaPlayer?.prepare()
mediaPlayer?.start()
}