Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
nift4 committed Oct 29, 2024
1 parent da8f5eb commit ef09b71
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -932,6 +932,14 @@ class FullBottomSheet
bottomSheetFullLyricView.updateLyricPositionFromPlaybackPos()
}

override fun onPositionDiscontinuity(
oldPosition: Player.PositionInfo,
newPosition: Player.PositionInfo,
reason: Int
) {
positionRunnable.run()
}

override fun onShuffleModeEnabledChanged(shuffleModeEnabled: Boolean) {
bottomSheetShuffleButton.isChecked = shuffleModeEnabled
}
Expand Down Expand Up @@ -980,8 +988,8 @@ class FullBottomSheet
progressDrawable.animate = true
}
if (!runnableRunning) {
handler.postDelayed(positionRunnable, SLIDER_UPDATE_INTERVAL)
runnableRunning = true
handler.postDelayed(positionRunnable, SLIDER_UPDATE_INTERVAL)
}
} else if (playbackState != Player.STATE_BUFFERING) {
if (bottomSheetFullControllerButton.getTag(R.id.play_next) as Int? != 2) {
Expand Down Expand Up @@ -1171,7 +1179,6 @@ class FullBottomSheet

private val positionRunnable = object : Runnable {
override fun run() {
if (!runnableRunning) return
val position =
CalculationUtils.convertDurationToTimeStamp(instance?.currentPosition ?: 0)
val duration = instance?.currentMediaItem?.mediaMetadata?.durationMs
Expand All @@ -1184,7 +1191,7 @@ class FullBottomSheet
bottomSheetFullPosition.text = position
}
bottomSheetFullLyricView.updateLyricPositionFromPlaybackPos()
if (instance?.isPlaying == true) {
if (instance?.isPlaying == true && runnableRunning) {
handler.postDelayed(this, SLIDER_UPDATE_INTERVAL)
} else {
runnableRunning = false
Expand Down

0 comments on commit ef09b71

Please sign in to comment.