tohodog / QSVideoPlayer

安卓视频播放器AndroidVideoplayer,架构设计优良功能丰富,支持多种解码,支持设置比例,浮窗,倍速,静音等
Apache License 2.0
301 stars 63 forks source link

进度大于int范围错误 #1

Closed Missyouag closed 7 years ago

Missyouag commented 7 years ago

int progress = (int) (((long)position * progressMax) / (duration <= 0 ? 1 : duration));

超过半小时时间不正常。乘以一千超出int范围

tohodog commented 7 years ago

非常感谢提交bug,已修改!

Pengchengistaken commented 7 years ago

这里的time计算貌似也是超范围了:

 @Override
    public void onStopTrackingTouch(SeekBar seekBar) {
        if (getDuration() > 1) {
            int time = seekBar.getProgress() * getDuration() / progressMax;
            seekTo(time);
        }
        startProgressTimer();
        if (currentState == STATE_PLAYING)
            startDismissControlViewTimer(1314);
    }

@Override
    public void seekTo(int duration) {
        if (checkReady()) {
            if (duration >= 0) {
                seek(duration);
            }
        } else
            seekToInAdvance = duration;
    }

复现现象见百度云链接:http://pan.baidu.com/s/1eSgWw98

tohodog commented 7 years ago

哎妈呀防不胜防 老年人写代码 已修改