开发者

Android: Synchronize Chronometer with MediaPlayer

开发者 https://www.devze.com 2023-03-31 05:28 出处:网络
I\'m using SeekBar in my application and when user seeks it should reset teh chronometer apporpriately.

I'm using SeekBar in my application and when user seeks it should reset teh chronometer apporpriately.

I wrote th开发者_开发问答e code as below.

chronometer.setBase(SystemClock.elapsedRealtime());
chronometer.setBase((mediaPlayer.getCurrentPosition()));

but it didn't help. chronometer shows like 2:48:00, which is very big and unrealistic for a 2:00 file.

Can someone help me with this please.

Thanks in advance.


can you try this

chronometer.setBase(SystemClock.elapsedRealtime() - mediaPlayer.getCurrentPosition());

and tell me what happens.

0

精彩评论

暂无评论...
验证码 换一张
取 消