Cant set seekbar max value, it must be a video duration, but if look to my code, it show error, because cannot be applied (long), it must be (int). The same when I return value. Anyone have idea how fix it?
DiscreteSeekBar discreteSeekBar1 = (DiscreteSeekBar) findViewById(R.id.discrete1);
discreteSeekBar1.setMin(0);
**discreteSeekBar1.setMax(mVideoView.getDuration());**
discreteSeekBar1.setNumericTransformer(new DiscreteSeekBar.NumericTransformer() {
@Override
public int transform(int value) {
**return mVideoView.seekTo(mVideoView.getCurrentPosition() + value);**
}
});
You can safely cast it to int
. There's no way your video duration exceeds Integer.MAX_VALUE = 2,147,483,647
. It would have to be 2,147,483 seconds long
discreteSeekBar1.setMax((int) mVideoView.getDuration());
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.