Code example for VideoView

Methods: setMediaControllersetOnCompletionListenersetOnPreparedListenersetVideoPathstart, requestFocus, setKeepScreenOn, setOnClickListener

0
		/* 
		 * Alternatively,for streaming media you can use 
		 * mVideoView.setVideoURI(Uri.parse(URLstring)); 
		 */ 
		 
		mVideoView.setVideoPath(path);
		MediaController mediaController = new MediaController(getActivity());
		mediaController.setAnchorView(mVideoView);
		mVideoView.setMediaController(mediaController);
		 
		mVideoView.requestFocus();
		mVideoView.setKeepScreenOn(true);
 
		mVideoView.start(); 
		 
		mVideoView.setOnClickListener(new OnClickListener() {
 
			@Override 
			public void onClick(View v) {
				close(); 
			} 
		}); 
 
		mVideoView.setOnPreparedListener(new OnPreparedListener() {
			@Override 
			public void onPrepared(MediaPlayer mp) { 
				mp_ = mp;  
				mp_.setLooping(true);
				 
 
				//mVideoView.animate().rotation(200).alpha((float) 0.5) 
				//		.scaleX(0.2f).scaleY(0.2f).setDuration(2000); 
 
				r = new Runnable() {
					 
					@Override 
					public void run() { 
						for (VideoListener l : listeners) {
							l.onTimeUpdate(mp_.getCurrentPosition(), mp_.getDuration()); 
						}  
						handler.postDelayed(this, 1000);
					} 
				}; 
				 
 
				handler.post(r);
			} 
		}); 
		 
		//mp_.setO 
		 
		mVideoView.setOnCompletionListener(new OnCompletionListener() {
 
			public void onCompletion(MediaPlayer mp) {
 
				//finish(); 
				for (VideoListener l : listeners) {