From ba348b64c1843e453f1da0abf16bb6897456a5df Mon Sep 17 00:00:00 2001 From: kunfei Date: Thu, 24 Oct 2019 09:49:43 +0800 Subject: [PATCH] up --- .../io/legado/app/service/HttpReadAloudService.kt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/io/legado/app/service/HttpReadAloudService.kt b/app/src/main/java/io/legado/app/service/HttpReadAloudService.kt index 4b277041b..eee68f8e5 100644 --- a/app/src/main/java/io/legado/app/service/HttpReadAloudService.kt +++ b/app/src/main/java/io/legado/app/service/HttpReadAloudService.kt @@ -97,9 +97,14 @@ class HttpReadAloudService : BaseReadAloudService(), private fun playAudio(fd: FileDescriptor) { if (playingIndex != nowSpeak) { playingIndex = nowSpeak - mediaPlayer.reset() - mediaPlayer.setDataSource(fd) - mediaPlayer.prepareAsync() + try { + mediaPlayer.reset() + mediaPlayer.setDataSource(fd) + mediaPlayer.prepareAsync() + } catch (e: Exception) { + e.printStackTrace() + toast(e.localizedMessage) + } } }