Best code examples for MediaPlayer prepareAsync method (android.media.MediaPlayer.prepareAsync)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for MediaPlayer prepareAsync method.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

MediaPlayer prepareAsync examples from Open Source projects
This code example shows how to use the following methods: prepareAsync
        mMediaPlayer.pause();
    } 
 
    @Override 
    public void prepareAsync() throws IllegalStateException { 
        mMediaPlayer.prepareAsync();
    } 
 
    @Override 
    public void release() { 
        mMediaPlayer.release();
    } 
 
    @Override 
    public void reset() { 
        mMediaPlayer.reset();
    } 
 
    @Override 
    public void seekTo(long msec) throws IllegalStateException {
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: prepare, prepareAsync, setAudioStreamType, setDataSource, setOnPreparedListener
	}	 
	 
	protected void startPlaying(String file) {
		if (isPlaying==false) {
			try { 
				mPlayer = new MediaPlayer();
				isPlaying=true;
				Log.d("Audio startPlaying", "audio: " + file);
				if (isStreaming(file))
				{ 
					Log.d("AudioStartPlaying", "Streaming");
					// Streaming prepare async 
					mPlayer.setDataSource(file);
					mPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);  
					mPlayer.prepareAsync();
				} else { 
					Log.d("AudioStartPlaying", "File");
					// Not streaming prepare synchronous, abstract base directory 
					mPlayer.setDataSource("/sdcard/" + file);
					mPlayer.prepare();

6
CodeRank
This code example shows how to use the following methods: isPlaying, prepareAsync
	public void onPrepared(MediaPlayer mp) {
		mp.start();
	} 
 
	public void play() { 
		if (!media_player.isPlaying()) {
			media_player.prepareAsync();
		} 
	} 
 
	public void pause() { 
		media_player.pause();
	} 
 
	public void stop() { 
		media_player.stop();
	} 
	 
	public void destroy() { 
		stop(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: prepareAsync
        } 
    } 
 
    public void prepare() { 
        try { 
            player.prepareAsync();
        } catch (IllegalStateException e) {
            e.printStackTrace();
            Log.w(TAG, "err prepare: set data source did'n set");
        } 
    } 
 
    public boolean getPrepared() { 
        return isPrepared;
    } 
 
    public boolean isPlaying() { 
        return player.isPlaying();
    } 
 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: prepareAsync, setAudioStreamType, setDataSource, setOnCompletionListener, setOnPreparedListener
    start(); 
  } 
 
  private void start() { 
    if( mediaPlayer != null ) mediaPlayer.release();
    mediaPlayer = new MediaPlayer();
    mediaPlayer.setAudioStreamType(AudioManager.STREAM_VOICE_CALL);
    mediaPlayer.setOnCompletionListener(this);
    mediaPlayer.setOnPreparedListener(this);
 
    String packageName = context.getPackageName();
    Uri dataUri = Uri.parse("android.resource://"+ packageName +"/"+ currentSoundID );
 
    try { 
      mediaPlayer.setDataSource(context, dataUri);
    } catch (IllegalArgumentException e) {
      // TODO Auto-generated catch block 
      e.printStackTrace();
      return; 
    } catch (SecurityException e) {

10
CodeRank
Related MediaPlayer prepareAsync Questions & Answers:
prepareAsync Method Overview
Prepares the player for playback, asynchronously.
See Code Examples for other Android MediaPlayer Methods: