Search code examples
javavlcj

VLCJ getLength()


I am using VLCJ library to play media files that are located on some web server. The only problem i have is how to get correct length of the media. I try to parseMedia but application hangs and if I call getLength on media player it returns 0. Newerthless if using getPosition() and setPosition(float) it works ok, but this tells only % of media played not the actual length in seconds.

Is it possible to get correct length of streamed media and use the progress to go back and forward?

Thank you.


Solution

  • If getLength() returns 0 it's because VLCJ doesn't know (or hasn't been told) how long the stream is, so it literally can't give you an accurate result!

    The only way I can think of is if you have something else that works server side (perhaps a server instance of VLCJ) that sends the length of the file across separately?