MediaPlayer isLooping - 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 isLooping method.

This code example shows how to use the following methods:isLooping, isPlaying, pause, seekTo
		} 
	} 
	 
	public void stop() throws IOException 
	{ 
		if ( mp.isLooping() || mp.isPlaying() )
		{ 
			state = INVALID;
			mp.pause();
			mp.seekTo(0);
		} 
	} 
	 
	public void loop() throws IOException 
	{ 
		invokePlay( true ); 
	} 
	 
	public void unload() throws IOException 
	{ 
10
CodeRank
This code example shows how to use the following methods:isLooping, prepare, release, setDataSource, setLooping
 
    public static boolean isLooping(String filePath) {        
        MediaPlayer mp = null;
         
        try { 
            mp = new MediaPlayer();
            if (mp.isLooping()) {
                Log.v(TAG, "MediaPlayer.isLooping() returned true after ctor");
                return false; 
            } 
            mp.setDataSource(filePath);
            mp.prepare();
 
            mp.setLooping(true);
            if (!mp.isLooping()) {
                Log.v(TAG, "MediaPlayer.isLooping() returned false after setLooping(true)");
                return false; 
            } 
             
            mp.setLooping(false);

7
CodeRank
This code example shows how to use the following methods:isLooping, isPlaying, prepare, reset, setDataSource
	} 
 
	private void playNotesound() { 
		try { 
			MediaPlayer mp = getMediaPlayer();
			if (mp.isPlaying() || mp.isLooping()) {
				mp.stop();
			} 
			mp.reset();
			FileInputStream fis = new FileInputStream(getCacheDir() + "/note.mid");
			mp.setDataSource(fis.getFD());
			mp.prepare();
			mp.start();
			fis.close();
		} catch (Exception e) {
			e.printStackTrace();
		} 
	} 
 
	private void setupListeners() { 
6
CodeRank
This code example shows how to use the following methods:isLooping, isPlaying, prepare, stop
    public void start() { 
        player.start();
    } 
 
    public void stop() { 
        if (player.isLooping() && player.isPlaying()) {
            player.stop();
            try { 
                player.prepare();
            } catch (final IllegalStateException e) {
                Logger.debug("AndroidSounds.stop()", e.getMessage());
            } catch (final IOException e) {
                Logger.debug("AndroidSounds.stop()", e.getMessage());
            } 
        } 
    } 
 
    public void startLoop() { 
        player.setLooping(true);
        player.start();
6
CodeRank
This code example shows how to use the following methods:isLooping, isPlaying, pause, seekTo
		} 
	} 
	 
	public void stop() throws IOException 
	{ 
		if ( mp.isLooping() || mp.isPlaying() )
		{ 
			state = INVALID;
			mp.pause();
			mp.seekTo(0);
		} 
	} 
	 
	public void loop() throws IOException 
	{ 
		invokePlay( true ); 
	} 
	 
	public void unload() throws IOException 
	{ 
7
CodeRank
This code example shows how to use the following methods:isLooping, isPlaying, pause, release, seekTo
		} 
	} 
	 
	public void stop() throws IOException 
	{ 
		if ( mp.isLooping() || mp.isPlaying() )
		{ 
			state = INVALID;
			mp.pause();
			mp.seekTo(0);
		} 
	} 
	 
	public void loop() throws IOException 
	{ 
		invokePlay( true ); 
	} 
	 
	public void unload() throws IOException 
	{ 

6
CodeRank
This code example shows how to use the following methods:isLooping, prepare, release, setDataSource, setLooping
 
    public static boolean isLooping(String filePath) {        
        MediaPlayer mp = null;
         
        try { 
            mp = new MediaPlayer();
            if (mp.isLooping()) {
                Log.v(TAG, "MediaPlayer.isLooping() returned true after ctor");
                return false; 
            } 
            mp.setDataSource(filePath);
            mp.prepare();
 
            mp.setLooping(true);
            if (!mp.isLooping()) {
                Log.v(TAG, "MediaPlayer.isLooping() returned false after setLooping(true)");
                return false; 
            } 
             
            mp.setLooping(false);

6
CodeRank
This code example shows how to use the following methods:getCurrentPosition, getDuration, isLooping, isPlaying
    result.put("tag", getDefault(tag));
    if (player == null) {
      result.put("loaded", false);
    } else { 
      result.put("loaded", true);
      result.put("duration", player.getDuration());
      result.put("position", player.getCurrentPosition());
      result.put("isplaying", player.isPlaying());
      result.put("url", getUrl(tag));
      result.put("looping", player.isLooping());
    } 
    return result;
  } 
 
  @Rpc(description = "Lists currently loaded media", returns = "List of Media Tags") 
  public Set<String> mediaPlayList() {
    return mPlayers.keySet();
  } 
 
  @Rpc(description = "Set Looping", returns = "True if successful") 
6
CodeRank
This code example shows how to use the following methods:isLooping
	} 
 
	public boolean isLooping() { 
		// valid in any other state 
		if (_state != RELEASED) {
			return _mediaPlayer.isLooping();
		} 
		return false; 
	} 
 
	public boolean isPlaying() { 
		return _state == PLAYING;
	} 
	 
	public void setVolume(float volume) {
		// valid in any other state 
		if (_state != RELEASED) {
			_mediaPlayer.setVolume(volume, volume);
		} 
	} 
5
CodeRank
This code example shows how to use the following methods:isLooping, prepare, release, setDataSource, setLooping
 
    public static boolean isLooping(String filePath) {        
        MediaPlayer mp = null;
         
        try { 
            mp = new MediaPlayer();
            if (mp.isLooping()) {
                Log.v(TAG, "MediaPlayer.isLooping() returned true after ctor");
                return false; 
            } 
            mp.setDataSource(filePath);
            mp.prepare();
 
            mp.setLooping(true);
            if (!mp.isLooping()) {
                Log.v(TAG, "MediaPlayer.isLooping() returned false after setLooping(true)");
                return false; 
            } 
             
            mp.setLooping(false);

5
CodeRank

Related MediaPlayer isLooping Questions & Answers:

isLooping Method Overview
Checks whether the MediaPlayer is looping or non-looping.
See Code Examples for other Android MediaPlayer Methods: