python改写播放进度条位置_我怎样才能改变一个进度条的位置,videoView的时间后?...

i have the following code:

final SeekBar videoBar = (SeekBar) findViewById(R.id.videoBar);

final VideoView videoView = (VideoView) findViewById(R.id.videoViewPaint);

videoView.setVideoPath(videoPath);

videoView.start();

videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {

@Override

public void onPrepared(MediaPlayer mp) {

long duration = videoView.getDuration();

videoBar.setMax((int) duration);

LogService.log("in runnable", "videoView duration= " + videoView.getDuration());

}

});

videoBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {

@Override

public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {

if (isVideo) {

videoView.seekTo(progress);

}

}

@Override

public void onStartTrackingTouch(SeekBar seekBar) {

}

@Override

public void onStopTrackingTouch(SeekBar seekBar) {

}

});

playBtn.setOnClickListener(new OnClickListener() {

@Override

public void onClick(View arg0) {

if (isPlaying) {

// Button is ON

videoView.pause();

playBtn.setImageResource(R.drawable.play);// Do Something

isPlaying = false;

} else if (!isPlaying) {

// Button is OFF

videoView.start(); // Do Something

playBtn.setImageResource(R.drawable.pause);

isPlaying = true;

}

}

});

Now if i move the progressBar (videoBar), it takes the the video to that part of the video, but if the video plays, it does not move to progress bar, alongside. How can I make it, move the progress bar while the video is playing?

解决方案

This helped me get it right, now it works. The first answer

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值