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

This code example shows how to use the following methods:setOnInfoListener
This code example shows how to use the following methods:prepareAsync, setDataSource, setOnCompletionListener, setOnErrorListener, setOnInfoListener
        throws java.io.IOException 
    { 
        Log.i(TAG, "AudioPlayerControl constructed with path " + path);
        this.path = path;
 
        player = new MediaPlayer();
        player.setDataSource(path);
 
        player.setOnPreparedListener(listenerActivity);
        player.setOnInfoListener(listenerActivity);
        player.setOnErrorListener(listenerActivity);
        player.setOnCompletionListener(listenerActivity);
        /* 
        player.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { 
                public void onCompletion(MediaPlayer mp) { 
                    Log.i(TAG, "AudioPlayerControl onCompletion called"); 
                    player.reset(); 
                } 
            }); 
        */ 

7
CodeRank
This code example shows how to use the following methods:setOnBufferingUpdateListener, setOnCompletionListener, setOnErrorListener, setOnInfoListener, setOnPreparedListener
    public static final String TAG = DefMediaPlayer.class.getName();
 
    private MediaPlayer mMediaPlayer = null;
 
    protected DefMediaPlayer() { 
        mMediaPlayer = new MediaPlayer();
        mMediaPlayer.setOnBufferingUpdateListener(this);
        mMediaPlayer.setOnCompletionListener(this);
        mMediaPlayer.setOnErrorListener(this);
        mMediaPlayer.setOnInfoListener(this);
        mMediaPlayer.setOnPreparedListener(this);
        mMediaPlayer.setOnSeekCompleteListener(this);
        mMediaPlayer.setOnVideoSizeChangedListener(this);
    } 
 
    @Override 
    public long getCurrentPosition() { 
        try { 
            return mMediaPlayer.getCurrentPosition();
        } catch (IllegalStateException e) {
6
CodeRank
This code example shows how to use the following methods:prepareAsync, setDataSource, setOnCompletionListener, setOnInfoListener, setOnPreparedListener
This code example shows how to use the following methods:setDisplay, setOnBufferingUpdateListener, setOnCompletionListener, setOnErrorListener, setOnInfoListener
This code example shows how to use the following methods:setOnBufferingUpdateListener, setOnCompletionListener, setOnErrorListener, setOnInfoListener, setOnPreparedListener
 
 
  @Override 
  public void onCreate() { 
    super.onCreate(); 
    mediaPlayer = new MediaPlayer();
    mediaPlayer.setOnBufferingUpdateListener(this);
    mediaPlayer.setOnCompletionListener(this);
    mediaPlayer.setOnErrorListener(this);
    mediaPlayer.setOnInfoListener(this);
    mediaPlayer.setOnPreparedListener(this);
    notificationManager = (NotificationManager) getSystemService(
        Context.NOTIFICATION_SERVICE);
    playlist = new PlaylistRepository(getApplicationContext(),
        getContentResolver());
 
    Log.d(LOG_TAG, "Playback service created");
 
    telephonyManager = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
    // Create a PhoneStateListener to watch for off-hook and idle events 
5
CodeRank
This code example shows how to use the following methods:prepareAsync, setAudioStreamType, setDataSource, setOnBufferingUpdateListener, setOnCompletionListener
	public void initMediaPlayer(Radio r) {
		client.onInitializePlayerStart("Menyambung...");
		radio = r;
		onRadio = true;
		ss = Executors.newScheduledThreadPool(1);
		mMediaPlayer = new MediaPlayer();
		mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
		try { 
			mMediaPlayer.setDataSource(radio.getUrl());
 
		} catch (Exception e) {
			e.printStackTrace();
		} 
 
		mMediaPlayer.setOnBufferingUpdateListener(this);
		mMediaPlayer.setOnInfoListener(this);
		mMediaPlayer.setOnPreparedListener(this);
		mMediaPlayer.setOnErrorListener(this);
		mMediaPlayer.setOnCompletionListener(this);
		mMediaPlayer.prepareAsync();

5
CodeRank
This code example shows how to use the following methods:prepareAsync, setAudioStreamType, setDataSource, setOnBufferingUpdateListener, setOnCompletionListener
5
CodeRank
This code example shows how to use the following methods:setLooping, setOnInfoListener, setOnSeekCompleteListener
  public void onPrepared( MediaPlayer mediaPlayer ) {
    if( this.mediaPlayer != mediaPlayer ) {
      this.mediaPlayer = mediaPlayer;
      registerCallbacks( mediaPlayer );
      registerMediaController(); 
      mediaPlayer.setLooping( isLooping );
      isPrepared = true;
      videoController.prepareCompleted();
    } 
  } 
 
  public void registerMediaController() { 
    if( shouldHaveMediaController ) {
      mediaController = createMediaController( getContext() );
      super.setMediaController( mediaController );
 
      View anchor = videoHolder.getAnchorView();
      int[] location = new int[ 2 ];
      anchor.getLocationOnScreen( location );
      mediaController.setAnchorView( anchor );

5
CodeRank
This code example shows how to use the following methods:setOnBufferingUpdateListener, setOnCompletionListener, setOnErrorListener, setOnInfoListener, setOnPreparedListener

Related MediaPlayer setOnInfoListener Questions & Answers:

setOnInfoListener Method Overview
Register a callback to be invoked when an info/warning is available.
See Code Examples for other Android MediaPlayer Methods: