Code example for VideoView

Methods: setOnCompletionListenersetVideoURIstart, setOnTouchListener

0
	} 
 
	private void splashPlayer() 
	{ 
 
		final VideoView videoView = new VideoView(this);
		setContentView(videoView);
		int videoId;
 
		boolean hd1 = CamcorderProfile.hasProfile(CamcorderProfile.QUALITY_720P);
		boolean hd2 = CamcorderProfile.hasProfile(CamcorderProfile.QUALITY_1080P);
		boolean sdHq = CamcorderProfile.hasProfile(CamcorderProfile.QUALITY_480P);
		boolean sdLq = CamcorderProfile.hasProfile(CamcorderProfile.QUALITY_QCIF);
 
		if (hd1 || hd2)
		{ 
			videoId = rawVideoHdId;
		} 
		else if (sdHq)
		{ 
			videoId = rawVideoSdHqId;
		} 
		else if (sdLq)
		{ 
			videoId = rawVideoSdLqId;
		} 
		else 
		{ 
			jumpMain(); 
			return; 
		} 
 
		Uri videoUri = Uri.parse("android.resource://" + getPackageName() + "/" + videoId);
		videoView.setVideoURI(videoUri);
		videoView.setOnCompletionListener(new OnCompletionListener()
		{ 
 
			public void onCompletion(MediaPlayer mp)
			{ 
				jumpMain(); // jump to the next Activity 
			} 
		}); 
 
		videoView.setOnTouchListener(new OnTouchListener()
		{ 
 
			@Override 
			public boolean onTouch(View v, MotionEvent event)
			{ 
				videoView.stopPlayback();
				jumpMain(); 
				return true; 
			} 
 
		}); 
 
		videoView.start();
	} 
 
	protected synchronized void jumpMain() 
	{ 
		Intent intent = new Intent(this, mainActivityClass);