mirror of
https://github.com/SimpleMobileTools/Simple-Clock.git
synced 2025-01-18 20:01:50 +01:00
catch exceptions thrown at setting up mediaplayer
This commit is contained in:
parent
d8c9b34cc5
commit
2dba635e2f
@ -146,13 +146,17 @@ class ReminderActivity : SimpleActivity() {
|
||||
}
|
||||
|
||||
val soundUri = Uri.parse(if (alarm != null) alarm!!.soundUri else config.timerSoundUri)
|
||||
mediaPlayer = MediaPlayer().apply {
|
||||
setAudioStreamType(AudioManager.STREAM_ALARM)
|
||||
setDataSource(this@ReminderActivity, soundUri)
|
||||
setVolume(lastVolumeValue, lastVolumeValue)
|
||||
isLooping = true
|
||||
prepare()
|
||||
start()
|
||||
try {
|
||||
mediaPlayer = MediaPlayer().apply {
|
||||
setAudioStreamType(AudioManager.STREAM_ALARM)
|
||||
setDataSource(this@ReminderActivity, soundUri)
|
||||
setVolume(lastVolumeValue, lastVolumeValue)
|
||||
isLooping = true
|
||||
prepare()
|
||||
start()
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
showErrorToast(e)
|
||||
}
|
||||
|
||||
if (config.increaseVolumeGradually) {
|
||||
|
Loading…
Reference in New Issue
Block a user