Code example for VideoView

Methods: getCurrentPositiongetDuration, getBufferPercentage

0
					 
						if (mVideoView != null) {
							// if(Constants.LOG)Log.d(" mVideoView.getDuration() : "+ 
							// mVideoView.getDuration(), 
							// "  mVideoView.getBufferPercentage() : "+mVideoView.getBufferPercentage()+" mVideoView.getCurrentPosition() : "+mVideoView.getCurrentPosition()); 
							mDuration = mVideoView.getDuration();
							int percent = mVideoView.getBufferPercentage();
 
//							Log.d("hami", "getCurrentPosition(): " + mVideoView.getCurrentPosition()); 
 
							/* hami */ 
							// show loading when stay at current position 
							/* 
							 * mCurrentPosition = 
							 * mVideoView.getCurrentPosition(); 
							 * mCurrentDuration. 
							 * setText(TimeFormat.milisecondToHMS 
							 * (mCurrentPosition)); 
							 *  
							 * if(mLastPOosition == mCurrentPosition){ if 
							 * (mProgressBar != null && 
							 * mProgressBar.getVisibility() == View.GONE){ 
							 * mProgressBar.setVisibility(View.VISIBLE); } } 
							 * else { mLastPOosition = mCurrentPosition; if 
							 * (mProgressBar != null && 
							 * mProgressBar.getVisibility() == View.VISIBLE){ 
							 * mProgressBar.setVisibility(View.GONE); } } 
							 */ 
							/* #hami */ 
 
							if (mVideoView.getCurrentPosition() != -1 && mDuration != -1) {
 
								mSeekBar.setSecondaryProgress(percent);
								// mSeekBar.setSecondaryProgress(mTestSecondaryProgress++); 
								mSeekBar.setProgress((int) (((float) mVideoView.getCurrentPosition() / mDuration) * 100));
							} 
						} 
					} 
				}); 
			}