Avoid resetting position to zero on destroy
This commit is contained in:
parent
8d1d02117b
commit
01ca3d95eb
1 changed files with 2 additions and 8 deletions
|
@ -961,15 +961,9 @@ class MusicService : Service(), MediaPlayer.OnPreparedListener, MediaPlayer.OnEr
|
|||
|
||||
private fun destroyPlayer() {
|
||||
if (!mIsThirdPartyIntent) {
|
||||
val position = mPlayer?.currentPosition ?: 0
|
||||
ensureBackgroundThread {
|
||||
try {
|
||||
queueDAO.resetCurrent()
|
||||
|
||||
if (mCurrTrack != null) {
|
||||
queueDAO.saveCurrentTrack(mCurrTrack!!.mediaStoreId, position)
|
||||
}
|
||||
|
||||
saveTrackProgress()
|
||||
mTracks.forEachIndexed { index, track ->
|
||||
queueDAO.setOrder(track.mediaStoreId, index)
|
||||
}
|
||||
|
@ -1157,7 +1151,7 @@ class MusicService : Service(), MediaPlayer.OnPreparedListener, MediaPlayer.OnEr
|
|||
}
|
||||
|
||||
private fun saveTrackProgress() {
|
||||
if (mCurrTrack != null && mPlayer != null) {
|
||||
if (mCurrTrack != null && mPlayer != null && mPlayer!!.currentPosition != 0) {
|
||||
ensureBackgroundThread {
|
||||
val trackId = mCurrTrack!!.mediaStoreId
|
||||
val position = mPlayer!!.currentPosition
|
||||
|
|
Loading…
Reference in a new issue