I am using AppCompatSeekBar.
Everything is working fine Except when I add seekBar.setProgress() in Runnable of activity than the audio becomes slow.
private final Runnable mUpdateTimeTask = new Runnable() {
public void run() {
if (!stopProgressRunnable) {
int curDur = playerService.getCurrentTrackProgress();
int totDur = playerService.getCurrentTrackDuration();
if(seekBar!=null) {
seekBar.setProgress(curDur);
currentDur.setText(durationCalculator(curDur));
TotalDur.setText(durationCalculator(totDur));
}
mHandler.postDelayed(this, 1000);
}
}
};
Here is the seekBar in Layout file.
<android.support.v7.widget.AppCompatSeekBar
android:id="@+id/seekbar"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:padding="4dp"
android:progress="30" />
And I am updating seekBar.setMax() as soon as song changes . So that is not a problem.