Pre loader

problem with xiaomi phones when resume chart after pause it

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

1
0

Hi
I have a chart from a sound.
In xiaomi phones when resume chart after pause it, my line chart faces the severe lag.
In other phones my chart work well.
what should I do?
phone is (Xiaomi mi a3)

private void resume() {

    forceRunInPauseMode = true;
    mediaPlayer.seekTo(currentTime);
    mediaPlayer.start();
    completedState = false;
    pauseState = false;
    updateChart();
}



private void updateChart() {
    schedule = scheduledExecutorService.scheduleWithFixedDelay(() -> {
        if (mediaPlayer.isPlaying() || forceRunInPauseMode){
            UpdateSuspender.using(binding.sciChart, mRunnable);
        }
    }, 0, TIME_INTERVAL, TimeUnit.MILLISECONDS);

}

private Runnable mRunnable = new Runnable() {
    @Override
    public void run() {
        forceRunInPauseMode = false;


        currentTime = mediaPlayer.getCurrentPosition();
        currentRange = currentTime * 2;
        getActivity().runOnUiThread(()->binding.tvCurrentDuration.setText(MiliToTimeConverter.milliToTime(currentTime)));

        if (currentRange < 0)
            currentRange = 0;
        else if (currentRange > xDoubleArray.length - 1)
            currentRange = xDoubleArray.length - 1;

        if (!drawed) {
            DoubleValues xValues = new DoubleValues(Arrays.copyOfRange(xDoubleArray, 0, xDoubleArray.length-1));
            DoubleValues yValues = new DoubleValues(Arrays.copyOfRange(yDoubleArray, 0, yDoubleArray.length-1));
            DoubleSeries doubleSeries = new DoubleSeries(xValues, yValues);
            lineData.append(doubleSeries.getxValues(), doubleSeries.getyValues());
            drawed = true;
        }
        xVisibleRange.setMinMax((double) (currentRange - visibleInterval / 2), (double) (currentRange + visibleInterval / 2));
    }
};
Version
3.0.0.4253
  • Yura Khariton
    Hi there. Are you sure that it’s SciChart related issue? Maybe it could be caused by using MediaPlayer or using ScheduledExecutorService? Did you try to profile application to find out what causes the lag?
  • abolfazl ghanbari
    I didn’t see such an issue in the issues. and also profiled this app. ScheduledExecutorService is ok.
  • Yura Khariton
    I meant are you sure that this issue is caused by using SciChart code? Did you try to comment SciChart code in your application or maybe profiling showed something, that confirmed that lag occurs in SciChart code? Also did you check logcat messages? Maybe there are some errors or other messages, which could help to determine the cause of the issue. I’m asking, because these types of issue ( that occur on some specific device ) are very tricky and hard to fix. Maybe you can provide a full project which reproduces this issue?
  • You must to post comments
Showing 0 results
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies