Example usage for android.media MediaPlayer getCurrentPosition

List of usage examples for android.media MediaPlayer getCurrentPosition

Introduction

In this page you can find the example usage for android.media MediaPlayer getCurrentPosition.

Prototype

public native int getCurrentPosition();

Source Link

Document

Gets the current playback position.

Usage

From source file:com.classiqo.nativeandroid_32bitz.playback.LocalPlayback.java

@Override
public void onSeekComplete(MediaPlayer mp) {
    LogHelper.d(TAG, "onSeekComplete from MediaPlayer: ", mp.getCurrentPosition());

    mCurrentPosition = mp.getCurrentPosition();

    if (mState == PlaybackState.STATE_BUFFERING) {
        registerAudioNoisyReceiver();//from  www  .  ja  va  2s .  c om
        mMediaPlayer.start();
        mState = PlaybackState.STATE_PLAYING;
    }

    if (mCallback != null) {
        mCallback.onPlaybackStatusChanged(mState);
    }
}

From source file:com.allthatseries.RNAudioPlayer.Playback.java

/**
 * Called when MediaPlayer has completed a seek
 *
 * @see OnSeekCompleteListener//from   w  w w .jav a2s  . c  o  m
 */
@Override
public void onSeekComplete(MediaPlayer mp) {
    mCurrentPosition = mp.getCurrentPosition();
    if (mState == PlaybackStateCompat.STATE_BUFFERING) {
        registerAudioNoisyReceiver();
        mMediaPlayer.start();
        mState = PlaybackStateCompat.STATE_PLAYING;
    }
    if (mCallback != null) {
        mCallback.onPlaybackStateChanged(mState);
    }
}

From source file:info.tongrenlu.music.LocalPlayback.java

/**
 * Called when MediaPlayer has completed a seek
 *
 * @see android.media.MediaPlayer.OnSeekCompleteListener
 *//*from ww  w. j a  v a2 s.  com*/
@Override
public void onSeekComplete(MediaPlayer mp) {
    Log.d(TAG, "onSeekComplete from MediaPlayer:" + mp.getCurrentPosition());
    mCurrentPosition = mp.getCurrentPosition();
    if (mState == PlaybackStateCompat.STATE_BUFFERING) {
        mMediaPlayer.start();
        mState = PlaybackStateCompat.STATE_PLAYING;
    }
    if (mCallback != null) {
        mCallback.onPlaybackStatusChanged(mState);
    }
}

From source file:com.example.android.supportv4.media.Playback.java

/**
 * Called when MediaPlayer has completed a seek
 *
 * @see android.media.MediaPlayer.OnSeekCompleteListener
 *///from w  w  w.  ja  v  a 2s  .co m
@Override
public void onSeekComplete(MediaPlayer mp) {
    Log.d(TAG, "onSeekComplete from MediaPlayer:" + mp.getCurrentPosition());
    mCurrentPosition = mp.getCurrentPosition();
    if (mState == PlaybackState.STATE_BUFFERING) {
        mMediaPlayer.start();
        mState = PlaybackState.STATE_PLAYING;
    }
    if (mCallback != null) {
        mCallback.onPlaybackStatusChanged(mState);
    }
}

From source file:com.appdevper.mediaplayer.app.LocalPlayback.java

/**
 * Called when MediaPlayer has completed a seek
 *
 * @see OnSeekCompleteListener/*from  w  ww  .j a  v  a2 s  .  c  om*/
 */
@Override
public void onSeekComplete(MediaPlayer mp) {
    LogHelper.d(TAG, "onSeekComplete from MediaPlayer:", mp.getCurrentPosition());
    mCurrentPosition = mp.getCurrentPosition();
    if (mState == PlaybackState.STATE_BUFFERING) {
        mMediaPlayer.start();
        mState = PlaybackState.STATE_PLAYING;
    }
    if (mCallback != null) {
        mCallback.onPlaybackStatusChanged(mState);
    }
}

From source file:com.example.android.uamp.playback.LocalPlayback.java

/**
 * Called when MediaPlayer has completed a seek
 *
 * @see OnSeekCompleteListener/*from w  w w  .  j a  v  a2  s.c om*/
 */
@Override
public void onSeekComplete(MediaPlayer mp) {
    LogHelper.d(TAG, "onSeekComplete from MediaPlayer:", mp.getCurrentPosition());
    mCurrentPosition = mp.getCurrentPosition();
    if (mState == PlaybackStateCompat.STATE_BUFFERING) {
        registerAudioNoisyReceiver();
        mMediaPlayer.start();
        mState = PlaybackStateCompat.STATE_PLAYING;
    }
    if (mCallback != null) {
        mCallback.onPlaybackStatusChanged(mState);
    }
}

From source file:rocks.stalin.android.app.playback.RemotePlayback.java

/**
 * Called when MediaPlayer has completed a seek
 *//*from w  w  w  . ja v  a  2  s .co  m*/
@Override
public void onSeekComplete(MediaPlayer mp) {
    LogHelper.d(TAG, "onSeekComplete from MediaPlayer:", mp.getCurrentPosition());
    mCurrentPosition = mp.getCurrentPosition();
    if (mState == PlaybackStateCompat.STATE_BUFFERING) {
        registerAudioNoisyReceiver();
        mediaPlayer.start();
        mState = PlaybackStateCompat.STATE_PLAYING;
    }
    if (mCallback != null) {
        mCallback.onPlaybackStatusChanged(mState);
    }
}

From source file:org.dharmaseed.android.PlayTalkActivity.java

public void fastForwardButtonClicked(View view) {
    MediaPlayer mediaPlayer = talkPlayerFragment.getMediaPlayer();
    int currentPosition = mediaPlayer.getCurrentPosition();
    int newPosition = Math.min(currentPosition + 15000, mediaPlayer.getDuration());
    mediaPlayer.seekTo(newPosition);/*from   w w w. ja va 2s  .  c  om*/
}

From source file:org.dharmaseed.android.PlayTalkActivity.java

public void rewindButtonClicked(View view) {
    MediaPlayer mediaPlayer = talkPlayerFragment.getMediaPlayer();
    int currentPosition = mediaPlayer.getCurrentPosition();
    int newPosition = Math.max(currentPosition - 15000, 0);
    mediaPlayer.seekTo(newPosition);/*from ww  w . j ava 2 s  .  co m*/
}

From source file:com.bayapps.android.robophish.playback.LocalPlayback.java

/**
 * Called when MediaPlayer has completed a seek
 *
 * @see OnSeekCompleteListener//ww w.java 2 s .com
 */
@Override
public void onSeekComplete(MediaPlayer mp) {
    LogHelper.d(TAG, "onSeekComplete from MediaPlayer:", mp.getCurrentPosition());
    mCurrentPosition = mp.getCurrentPosition();
    if (mState == PlaybackStateCompat.STATE_BUFFERING) {
        mMediaPlayer.start();
        mState = PlaybackStateCompat.STATE_PLAYING;
    }
    if (mCallback != null) {
        mCallback.onPlaybackStatusChanged(mState);
    }
}