Can you tell me how I can I get the current position of seek bar and play the video from where I want? I used the code to get current position and video duration. I got the video duration but can't get the current position of the video.
MediaPlayer mp = MediaPlayer.create(this, Uri.parse(decryptedFile));
mp.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
int duration=mp.getDuration()/1000;
int hours = duration / 3600;
int minutes = (duration / 60) - (hours * 60);
int seconds = duration - (hours * 3600) - (minutes * 60) ;
Log.d("asdf", "onPrepared: "+seconds+" "+minutes+" "+duration);
int currentPosition = mp.getCurrentPosition()/1000;
Log.d("currentpostion", "onUserLeaveHint: "+currentPosition);
mp.release();
}
});
Can you tell me how I can I get the current position of seek bar and play the video from where I want? I used the code to get current position and video duration. I got the video duration but can't get the current position of the video. MediaPlayer mp = MediaPlayer.create(this, Uri.parse(decryptedFile));