catch exceptions thrown at setPlaybackState
This commit is contained in:
parent
a4f8294f46
commit
9df81953d1
1 changed files with 6 additions and 3 deletions
|
@ -424,9 +424,12 @@ class MusicService : Service(), MediaPlayer.OnPreparedListener, MediaPlayer.OnEr
|
|||
}
|
||||
|
||||
val playbackState = if (getIsPlaying()) PlaybackStateCompat.STATE_PLAYING else PlaybackStateCompat.STATE_PAUSED
|
||||
mediaSession!!.setPlaybackState(PlaybackStateCompat.Builder()
|
||||
.setState(playbackState, PLAYBACK_POSITION_UNKNOWN, 1.0f)
|
||||
.build())
|
||||
try {
|
||||
mediaSession!!.setPlaybackState(PlaybackStateCompat.Builder()
|
||||
.setState(playbackState, PLAYBACK_POSITION_UNKNOWN, 1.0f)
|
||||
.build())
|
||||
} catch (ignored: IllegalStateException) {
|
||||
}
|
||||
}
|
||||
|
||||
private fun getContentIntent(): PendingIntent {
|
||||
|
|
Loading…
Reference in a new issue