Code example for MediaPlayer

Methods: getCurrentPosition

0
    public int progress() { 
        if (mState == RECORDING_STATE) {
            return (int) ((System.currentTimeMillis() - mSampleStart) / 1000);
        } else if (mState == PLAYING_STATE || mState == PLAYING_PAUSED_STATE) {
            if (mPlayer != null) {
                return (int) (mPlayer.getCurrentPosition() / 1000);
            } 
        } 
 
        return 0; 
    } 
 
    public float playProgress() { 
        if (mPlayer != null) {
            return ((float) mPlayer.getCurrentPosition()) / mPlayer.getDuration();
        } 
        return 0.0f; 
    } 
 
    public int sampleLength() { 
Experience pair programming with AI  Get Codota for Java