Code example for VideoView

Methods: getCurrentPositiongetDurationstopPlayback

0
    	super.onStart(); 
    } 
	@Override 
	public void onPause() { 
    	// Stop video when the activity is pause. 
    	mPositionWhenPaused = mVideoView.getCurrentPosition();
    	mVideoView.stopPlayback();
    	Log.d(TAG, "OnStop: mPositionWhenPaused = " + mPositionWhenPaused);
    	Log.d(TAG, "OnStop: getDuration  = " + mVideoView.getDuration());
 
    	super.onPause(); 
    } 
	@Override 
	public void onResume() { 
    	// Resume video player 
    	if(mPositionWhenPaused >= 0) {
    		mVideoView.seekTo(mPositionWhenPaused);
    		mPositionWhenPaused = -1;
    	} 
 
    	super.onResume();