Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duration-displayer lags sometimes #1

Open
Palkess opened this issue Nov 18, 2016 · 0 comments
Open

Duration-displayer lags sometimes #1

Palkess opened this issue Nov 18, 2016 · 0 comments

Comments

@Palkess
Copy link
Owner

Palkess commented Nov 18, 2016

It sometimes skips a second.
Found suggestion somewhere, saving for my own reference

Not python:
private long lastPlayTime = 0;
private long lastPlayTimeGlobal = 0;

/**

  • Get current play time (interpolated)

  • @see How to get accurate response from mediaPlayer.getTime() caprica/vlcj#74

  • @return
    */
    public float getCurrentTime(){
    long currentTime = directMediaPlayer.getTime();

    if (lastPlayTime == currentTime && lastPlayTime != 0){
    currentTime += System.currentTimeMillis() - lastPlayTimeGlobal;
    } else {
    lastPlayTime = currentTime;
    lastPlayTimeGlobal = System.currentTimeMillis();
    }

    return currentTime * 0.001f; //to float
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant