catch exceptions thrown at setting up mediaplayer

This commit is contained in:
tibbi 2018-09-14 14:02:26 +02:00
parent d8c9b34cc5
commit 2dba635e2f

View File

@ -146,6 +146,7 @@ class ReminderActivity : SimpleActivity() {
}
val soundUri = Uri.parse(if (alarm != null) alarm!!.soundUri else config.timerSoundUri)
try {
mediaPlayer = MediaPlayer().apply {
setAudioStreamType(AudioManager.STREAM_ALARM)
setDataSource(this@ReminderActivity, soundUri)
@ -154,6 +155,9 @@ class ReminderActivity : SimpleActivity() {
prepare()
start()
}
} catch (e: Exception) {
showErrorToast(e)
}
if (config.increaseVolumeGradually) {
scheduleVolumeIncrease()