massoudss/waveformSeekBar

setSampleFrom is freezing ui

Arsenii76 opened this issue · 1 comments

I'm building a music player and I'm facing a problem where when I call setSampleFrom with a new song my ui freezes. the problem is 100% with this, because if I remove that line, everything works correctly. the song itself is 4 minutes

You have to create samples in background thread and apply it on view in UI thread

Background thread:

val sample = WaveformOptions. getSampleFrom(...)

UI thread:

waveformSeekBar.sample = sample