83.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) {
playButton.isEnabled = false
recordButton.isEnabled = false
stopButton.isEnabled = true
mediaPlayer = MediaPlayer()
mediaPlayer?.setDataSource(audioFilePath)
mediaPlayer?.prepare()
mediaPlayer?.start()
}