Code example for AudioTrack

Methods: getPlayStategetPlaybackHeadPosition

0
    public void onPeriodicNotification( AudioTrack track ) {
        if (playerCallback != null) {
            int buffered = 0;
 
            try { 
                buffered = writtenTotal - track.getPlaybackHeadPosition()*channels;
            } 
            catch (IllegalStateException e) {
                Log.e( LOG, "onPeriodicNotification(): illegal state=" + track.getPlayState());
                return; 
            } 
 
            int ms = samplesToMs( buffered, sampleRate, channels );
 
            playerCallback.playerPCMFeedBuffer( isPlaying, ms, bufferSizeInMs );
        } 
    } 
 
 
    //////////////////////////////////////////////////////////////////////////// 
    // Runnable