removing a check for stopping playback
This commit is contained in:
parent
889ee5785b
commit
5e656dcab8
1 changed files with 0 additions and 9 deletions
|
@ -497,15 +497,6 @@ class MusicService : Service(), MediaPlayer.OnPreparedListener, MediaPlayer.OnEr
|
|||
|
||||
try {
|
||||
startForeground(NOTIFICATION_ID, notification.build())
|
||||
|
||||
// delay foreground state updating a bit, so the notification can be swiped away properly after initial display
|
||||
Handler(Looper.getMainLooper()).postDelayed({
|
||||
val isFocusLost = mPrevAudioFocusState == AUDIOFOCUS_LOSS || mPrevAudioFocusState == AUDIOFOCUS_LOSS_TRANSIENT
|
||||
val isPlaybackStoppedAfterFocusLoss = mWasPlayingAtFocusLost && isFocusLost
|
||||
if (!getIsPlaying() && !isPlaybackStoppedAfterFocusLoss) {
|
||||
stopForeground(false)
|
||||
}
|
||||
}, 200L)
|
||||
} catch (ignored: ForegroundServiceStartNotAllowedException) {
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue