I'm looking for a way to get a callback when a VideoView
is playing, indicating the video progress. Something like described here, but for a VideoView
. Polling the current progress every fixed duration seems a bad solution…
Is there any listener existing for this that I missed?
You can use a thread to get the progress.
mRunnable = new Runnable() {
public void run() {
Log.i(TAG, "::run: getCurrentPosition = " + mVideoView.getCurrentPosition());
if(mVideoView.isPlaying()){
mHandler1.postDelayed(this, 250);
}
}
};
mHandler1.post(mRunnable);
Runnable onEverySecond=new Runnable() {
public void run() {
if(seekbar != null) {
seekbar.setProgress(mPlayer.getCurrentPosition());
}
if(mPlayer.isPlaying()) {
System.out.println("inside runnable :::::: is playing ");
seekbar.postDelayed(onEverySecond, 10);
}
}
};
seekbar.postDelayed(onEverySecond, 10);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With