Code example for VideoView

Methods: getCurrentPositiongetDurationseekTo, getBufferPercentage

0
    	int duration;
    	 
		@Override 
		protected Void doInBackground(Void... params) {
             
			int pos = (int) mPlayer.getCurrentPosition();
            pos -= 15000; // milliseconds
            mPlayer.seekTo(pos);
 
            if (mPlayer == null || mDragging) {
                return null; 
            } 
             
            position = (int) mPlayer.getCurrentPosition();
            duration = (int) mPlayer.getDuration();
            if (mProgress != null) {
                if (duration > 0) {
                    // use long to avoid overflow 
                    long pos_tmp = 1000L * position / duration;
                    mProgress.setProgress( (int) pos_tmp);
                } 
                int percent = mPlayer.getBufferPercentage();
                mProgress.setSecondaryProgress(percent * 10);
            } 
             
            return null; 
		}