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

This code example shows how to use the following methods: isPlaying, release, stop
            throw new RuntimeException("Couldn't load music");
        } 
    } 
 
    public void dispose() { 
        if (mediaPlayer.isPlaying())
            mediaPlayer.stop();
        mediaPlayer.release();
    } 
 
    public boolean isLooping() { 
        return mediaPlayer.isLooping();
    } 
 
    public boolean isPlaying() { 
        return mediaPlayer.isPlaying();
    } 
 
    public boolean isStopped() { 
        return !isPrepared;
Full Snippet Info
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: isPlaying
			mediaPlayer.setVolume(volume * globalVolume, volume * globalVolume);
		} 
	} 
 
	private boolean mayKeepSong(String fileName) {
		return (fileName.equals(currentTrack) && mediaPlayer.isPlaying());
	} 
 
	public void play(String fileName, float volume, float speed, boolean loop) {
		if (mediaPlayer != null) {
			if (mayKeepSong(fileName)) {
				return; 
			} else { 
				mediaPlayer.stop();
			} 
		} 
		currentTrack = fileName;
 
		float streamVolume = manager.getStreamVolume(AudioManager.STREAM_MUSIC);
		streamVolume /= manager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
Full Snippet Info
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: isPlaying, release, stop
	/** 
	 * Get rid of the music 
	 */ 
	public void dispose() { 
		 
		if (mediaPlayer.isPlaying()) {
			 
			mediaPlayer.stop();
		} 
		 
		mediaPlayer.release();
	} 
 
	/** 
	 * Called internal 
	 *  
	 * @param MediaPlayer mediaPlayer 
	 */ 
	public void onCompletion(MediaPlayer mediaPlayer) {
		 
Full Snippet Info
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: isPlaying, stop
    } 
  } 
   
  @Override 
  public void onPause() { 
    if (player.isPlaying()) {
      player.stop();
    } 
     
    super.onPause(); 
  } 
   
  public void onPrepared(MediaPlayer player) {
    player.start();
  } 
} 
Full Snippet Info
9
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: isPlaying
	} 
 
	public void testGetMediaPlayer() { 
		MediaPlayer mediaPlayer = SoundManager.getInstance().getMediaPlayer();
		assertNotNull("SoundManager failed to return a MediaPlayer", mediaPlayer);
		assertFalse("SoundManager provided a MediaPlayer that was already playing", mediaPlayer.isPlaying());
	} 
 
	public void testClear() { 
		SoundManager soundManager = SoundManager.getInstance();
		soundManager.clear();
		assertEquals("SoundManager was destroyed when calling clear", soundManager, SoundManager.getInstance());
 
		MediaPlayer mediaPlayer = SoundManager.getInstance().getMediaPlayer();
		assertNotNull("SoundManager failed to return a MediaPlayer after clear", mediaPlayer);
		assertFalse("SoundManager provided a MediaPlayer that was already playing", mediaPlayer.isPlaying());
	} 
 
	public void testPauseAndResume() throws IllegalStateException, IOException, InterruptedException { 
		final String soundFilePath = soundFile.getAbsolutePath();
Full Snippet Info
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: isPlaying, release, stop
		} 
		return play;
	} 
	public static void cleanup() { 
		if (mMediaPlayer != null) {
			if (mMediaPlayer.isPlaying()) {
				mMediaPlayer.stop();
			} 
			mMediaPlayer.release();
			mMediaPlayer = null;
		} 
	} 
} 
Full Snippet Info
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: isPlaying
		return -1; 
	} 
	 
	public boolean isPlaying() { 
		if (mp != null)
			return mp.isPlaying();
		return false; 
	} 
	 
	public void pause() { 
		if (mp != null)
			mp.pause();
	} 
	 
	public void start() { 
		if (mp != null)
			mp.start();
	} 
 
	public void stop() { 
Full Snippet Info
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: isPlaying, release, stop
            Log.v(TAG, "Tried to release player when it was already released");
            return; 
        } 
        try { 
            if (player != null) {
                if (player.isPlaying()) {
                    player.stop();
                } 
                player.release();
            } 
        } catch (Exception e) {
            Log.e(TAG, e.getMessage(), e);
        } 
        Log.v(TAG, "Released the music.");
        released = true;
    } 
 
    /** 
     * Sets the Volume level in sensible range. Handles special case of someone is calling or if on call. 
     * @param context 
Full Snippet Info
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
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 
	{ 
Full Snippet Info
10
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: isPlaying, stop
		if (null == mMediaPlayer)
		{ 
			return; 
		} 
 
		if (mMediaPlayer.isPlaying())
		{ 
			mMediaPlayer.stop();
		} 
	} 
 
	/** 
	 * Set the sound volume. 
	 * @param vol Volume in the range 0 - 100. 
	 */ 
	void maSoundSetVolume(int vol)
	{ 
		if (null == mMediaPlayer)
		{ 
			return; 
Full Snippet Info
9
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java

Related MediaPlayer isPlaying Questions & Answers:

Other MediaPlayer isPlaying Examples

88:					// check for already playing
89:					if(mp.isPlaying()){
90:						if(mp!=null){
91:							mp.pause();
92:							// Changing button image to play button

Read More

isPlaying Method Overview
Checks whether the MediaPlayer is playing.
See Code Examples for other Android MediaPlayer Methods: