Properly handle seek bar input events.

This commit is contained in:
Anton Chekulaev 2020-10-08 15:42:32 +11:00
parent 692741f406
commit 7a9e73fb13
2 changed files with 6 additions and 6 deletions

View File

@ -246,12 +246,10 @@ public class AudioSlidePlayer implements SensorEventListener {
} }
public synchronized void seekTo(double progress) throws IOException { public synchronized void seekTo(double progress) throws IOException {
if (mediaPlayer == null) return; if (mediaPlayer == null || !isReady()) {
if (isReady()) {
mediaPlayer.seekTo((long) (mediaPlayer.getDuration() * progress));
} else {
play(progress); play(progress);
} else {
mediaPlayer.seekTo((long) (mediaPlayer.getDuration() * progress));
} }
} }

View File

@ -249,9 +249,11 @@ class WaveformSeekBar : View {
if (abs(event.x - touchDownX) > scaledTouchSlop) { if (abs(event.x - touchDownX) > scaledTouchSlop) {
updateProgress(event, false) updateProgress(event, false)
} }
performClick() performClick()
} }
MotionEvent.ACTION_CANCEL -> {
userSeeking = false
}
} }
return true return true
} }