SeekBar and media player in android

前端 未结 12 2046
天涯浪人
天涯浪人 2020-11-28 03:13

I have a simple player and recorder. Everything works great but have a one problem. I want to add seek bar to see progress in playing record and use this seek bar to set pl

12条回答
  •  无人及你
    2020-11-28 04:06

    check this, you should give arguments in msecs, Dont just send progress to seekTo(int)

    and also check this getCurrentPostion() and getDuration().

    You can do some calcuations, ie., convert progress in msec like msce = (progress/100)*getDuration() then do seekTo(msec)

    Or else i have an easy idea, you don't need to change any code anywer else just add seekBar.setMax(mPlayer.getDuration()) once your media player is prepared.

    and here is link exactly what you want seek bar update

提交回复
热议问题