MediaPlayer setLooping - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for MediaPlayer setLooping method.

This code example shows how to use the following methods: isLooping, isPlaying, pause, seekTo, setLooping
		invokePlay( false ); 
	} 
	 
	private void invokePlay( Boolean loop )
	{ 
		Boolean playing = ( mp.isLooping() || mp.isPlaying() );
		if ( playing )
		{ 
			mp.pause();
			mp.setLooping(loop);
			mp.seekTo(0);
			mp.start();
		} 
		if ( !playing && state == PREPARED )
		{ 
			state = PENDING_LOOP;
			onPrepared( mp );
		} 
		else if ( !playing )
		{ 

9
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: setLooping
	} 
	 
	void setLoop(boolean bLp){
		if(stream){
			if(player!=null)
				player.setLooping(bLp);
		}else{ 
			if(streamID!=-1) pool.setLoop(streamID, -1);
		} 
		loop = bLp;
	} 
	 
	void setMultiPlay(boolean bMp){
		multiPlay = bMp;
		if(fileName!=null && multiPlay && stream){
			Log.w("OF", "multiplay only supported as no stream, reloading " + fileName + " as no stream");
			String currFileName = fileName;
			unloadSound(); 
			loadSound(currFileName, false);
		} 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: setLooping, start
	} 
 
	// plays the song once 
	public void play() { 
		if (_state == IDLE || _state == PAUSED) {
			_mediaPlayer.start();
			_state = PLAYING;
 
			_startTime = System.currentTimeMillis();
		} 
	} 
 
	// loops the song infinitely 
	public void loop() { 
		if (_state == IDLE || _state == PAUSED) {
			_mediaPlayer.setLooping(true);
			play(); 
		} 
	} 
	 
	public int getSongLength() { 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: prepare, seekTo, setLooping, start, stop
		 
		if (mBackgroundMediaPlayer == null){
			Log.e(TAG, "playBackgroundMusic: background media player is null");
		} else {		 
			// if the music is playing or paused, stop it 
			mBackgroundMediaPlayer.stop();			
			 
			mBackgroundMediaPlayer.setLooping(isLoop);
			 
			try { 
				mBackgroundMediaPlayer.prepare();
				mBackgroundMediaPlayer.seekTo(0);
				mBackgroundMediaPlayer.start();
				 
				this.mIsPaused = false;
			} catch (Exception e){
				Log.e(TAG, "playBackgroundMusic: error state");
			}			 
		} 
	} 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: setLooping, start
    //mediaPlayer.release(); 
    //mediaPlayer = null; 
  } 
 
  public void onPrepared(MediaPlayer mp) {
    mediaPlayer.setLooping(loopEnabled);
    mediaPlayer.start();
  } 
} 
Full Snippet Info
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related MediaPlayer setLooping Questions & Answers:

setLooping Method Overview
Sets the player to be looping or non-looping.
See Code Examples for other Android MediaPlayer Methods: