waveformSeekBar icon indicating copy to clipboard operation
waveformSeekBar copied to clipboard

Coordination with mediaplayer

Open dwf2008 opened this issue 1 year ago • 4 comments

Hi there, looks like a great product. I have it running but there's a little problem with coordination with the media player. Probably just my lack of knowledge about how to set the values. Depending on the values I use the seekbar ends before the mediaplayer is done playing the song or vice versa. My code:

WFSB.setSampleFrom(holder.lblUri.getText().toString()); float Max = Float.parseFloat(duration); WFSB.setMaxProgress(Max); WFSB.setProgress(0f);

and

int currentPosition = myMediaPlayer.getCurrentPosition(); WFSB.setProgress((float) currentPosition);

Is this the right approach or do I need to do something different? Thanks

dwf2008 avatar Aug 08 '23 06:08 dwf2008

@dwf2008 same issues is there any way to sync waves progress with seekbar ?

Jeel7584 avatar Aug 11 '23 12:08 Jeel7584

@dwf2008 @Jeel7584 I made a fork that includes a new view that incorporates a mediaPlayer and is synced. It not perfect yet, but it works

mirco0 avatar Aug 11 '23 17:08 mirco0

can anyone help regarding this also i want to synch with my media player in recyclerview adapter

SaaifKhan avatar Oct 05 '23 10:10 SaaifKhan

My method is to just spawn a thread that runs until the media player is stopped and constantly updates the WFSB progress (with a small sleep in between updates, to not flood the processor). It seems to be pretty synced up that way, and the Progress Changed callback listener can differentiate between a user interacted change and a code change using the fromUser callback variable.

ghost avatar Oct 10 '23 16:10 ghost