Code example for MediaPlayer

Methods: setOnErrorListenersetOnInfoListenersetOnPreparedListener

0
	    playerSurfaceHolder.setFixedSize(screenWidth, screenHeight);
		 
		 
 
		 
		player = new MediaPlayer();
//		player.setOnBufferingUpdateListener(new MediaPlayer.OnBufferingUpdateListener() { 
//			@Override 
//			public void onBufferingUpdate(MediaPlayer mp, int percent) { 
////				Log.d("Nick", "buffering: " + percent); 
//			} 
//		}); 
		player.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
	        @Override 
	        public void onPrepared(MediaPlayer mp) {
	    		isLoaded = true; 
	            if(interstitialListener != null) { 
	            	interstitialListener.ready(adView);
	            } 
//	            progressBar.setMax(player.getDuration()); 
	        } 
	    }); 
		player.setOnInfoListener(new MediaPlayer.OnInfoListener() {
			@Override 
			public boolean onInfo(MediaPlayer mp, int what, int extra) {
				return false; 
			} 
		}); 
		player.setOnErrorListener(new MediaPlayer.OnErrorListener() {
			@Override 
			public boolean onError(MediaPlayer mp, int what, int extra) {
				return false; 
			} 
		});