fix: Fix an issue where app would crash when song is changed after seeking when cross-fading
This commit is contained in:
parent
c441674943
commit
de92e1d9a7
1 changed files with 6 additions and 0 deletions
|
@ -93,6 +93,7 @@ class CrossFadePlayer(context: Context) : LocalPlayback(context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun seek(whereto: Int): Int {
|
override fun seek(whereto: Int): Int {
|
||||||
|
endFade()
|
||||||
getNextPlayer()?.stop()
|
getNextPlayer()?.stop()
|
||||||
return try {
|
return try {
|
||||||
getCurrentPlayer()?.seekTo(whereto)
|
getCurrentPlayer()?.seekTo(whereto)
|
||||||
|
@ -235,6 +236,11 @@ class CrossFadePlayer(context: Context) : LocalPlayback(context) {
|
||||||
crossFadeAnimator?.start()
|
crossFadeAnimator?.start()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun endFade() {
|
||||||
|
crossFadeAnimator?.end()
|
||||||
|
crossFadeAnimator = null
|
||||||
|
}
|
||||||
|
|
||||||
private fun cancelFade() {
|
private fun cancelFade() {
|
||||||
crossFadeAnimator?.cancel()
|
crossFadeAnimator?.cancel()
|
||||||
crossFadeAnimator = null
|
crossFadeAnimator = null
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue