mirror of
https://github.com/element-hq/element-android
synced 2024-11-23 18:05:36 +03:00
Voice Broadcast Player - Add missing try catch
This commit is contained in:
parent
402224721b
commit
4a32ccecfa
1 changed files with 8 additions and 1 deletions
|
@ -120,7 +120,14 @@ class VoiceBroadcastPlayer @Inject constructor(
|
|||
}
|
||||
|
||||
private suspend fun prepareMediaPlayer(messageAudioContent: MessageAudioContent): MediaPlayer {
|
||||
val audioFile = session.fileService().downloadFile(messageAudioContent)
|
||||
// Download can fail
|
||||
val audioFile = try {
|
||||
session.fileService().downloadFile(messageAudioContent)
|
||||
} catch (failure: Throwable) {
|
||||
Timber.e(failure, "Unable to start playback")
|
||||
throw VoiceFailure.UnableToPlay(failure)
|
||||
}
|
||||
|
||||
return audioFile.inputStream().use { fis ->
|
||||
MediaPlayer().apply {
|
||||
setAudioAttributes(
|
||||
|
|
Loading…
Reference in a new issue