From dcbe9531073a2c0d5cdd0d062bc7d69d562b24b5 Mon Sep 17 00:00:00 2001 From: kunfei Date: Mon, 23 Dec 2019 22:04:09 +0800 Subject: [PATCH] up --- .../io/legado/app/service/AudioPlayService.kt | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/io/legado/app/service/AudioPlayService.kt b/app/src/main/java/io/legado/app/service/AudioPlayService.kt index 0a3c24e35..6855b8b84 100644 --- a/app/src/main/java/io/legado/app/service/AudioPlayService.kt +++ b/app/src/main/java/io/legado/app/service/AudioPlayService.kt @@ -134,14 +134,18 @@ class AudioPlayService : BaseService(), } private fun pause(pause: Boolean) { - AudioPlayService.pause = pause - handler.removeCallbacks(mpRunnable) - position = mediaPlayer.currentPosition - mediaPlayer.pause() - upMediaSessionPlaybackState(PlaybackStateCompat.STATE_PAUSED) - AudioPlay.status = Status.PAUSE - postEvent(Bus.AUDIO_STATE, Status.PAUSE) - upNotification() + if (url.contains(".m3u8", false)) { + stopSelf() + } else { + AudioPlayService.pause = pause + handler.removeCallbacks(mpRunnable) + position = mediaPlayer.currentPosition + mediaPlayer.pause() + upMediaSessionPlaybackState(PlaybackStateCompat.STATE_PAUSED) + AudioPlay.status = Status.PAUSE + postEvent(Bus.AUDIO_STATE, Status.PAUSE) + upNotification() + } } private fun resume() {