0

I am "seeking" the ability to seek forward and backwards on a video being played under vlcj. Information found in the documentation for vlcj API apparently refers to methods that no longer exist.

Is there still a way to do a forward and reverse seek on a video being played by vlcj? If so, how is this done?

Edit to answer questions asked by Slaw below:

  1. I am using VLCJ 4.7.3, with vlcj-javafx V1.1.0.

  2. On the site: https://www.tabnine.com/code/java/methods/uk.co.caprica.vlcj.player.MediaPlayer/seek

there are several references to a seek() function provided by the MediaPlayer class. That function does not exist in the current vlcj.

  1. On a tutorial provided by TutorialsPoint at:

    https://www.tutorialspoint.com/vlcj/vlcj_seek.htm

there is a reference to a function called

mediaPlayer().controls().skipWhile();

which not only does not exist in the current vlcj that I am using, but is not actually used in the seek example program provided below the referance!

Factor Three
  • 2,094
  • 5
  • 35
  • 51
  • Which version of VLCJ are you using? What is the method that seems to "no longer exist"? – Slaw Aug 14 '22 at 14:54
  • Slaw: please see the added information provided in my question above. – Factor Three Aug 14 '22 at 15:28
  • I assume you're talking about this [`MediaPlayer`](http://caprica.github.io/vlcj/javadoc/4.7.0/uk/co/caprica/vlcj/player/base/MediaPlayer.html) class? There indeed does not seem to be a `seek` method, but it does have a `controls()` method which returns a `ControlsApi`, and that class has a `setTime` method and a `skipTime` method. Is that what you're looking for? – Slaw Aug 14 '22 at 16:44

1 Answers1

1

The way to seek with contemporary versions of vlcj is to use skipTime or skipPosition with a positive or negative delta:

mediaPlayer.controls().skipTime(deltaMillis);

Or:

mediaPlayer.controls().skipPosition(deltaPosition);

If you want to seek to absolute times/positions:

mediaPlayer.controls().setTime(timeMillis);

Or (position between 0.0 and 1.0):

mediaPlayer.controls().setPosition(position);

Note that tabnine and tutorialspoint are not the official or sanctioned documentation for vlcj, so if that's out of date that's an issue for them and not a problem with vlcj's documentation.

In fact, skipWhile has never been a vlcj API function.

Instead, you should look here, or the GitHub project directly:

https://javadoc.io/doc/uk.co.caprica/vlcj/latest/uk/co/caprica/vlcj/player/base/MediaPlayer.html https://javadoc.io/doc/uk.co.caprica/vlcj/latest/uk/co/caprica/vlcj/player/base/ControlsApi.html

caprica
  • 3,902
  • 4
  • 19
  • 39
  • Then this leads to another question. I had used skipPosition() and skipTime() to move forward and backward in a video prior to making this post. Unfortunately, they only perform one "skip" to a specific point in the video. This is inadequate if I want to implement a rewind or fast forward function. My question is: how do I implement such a function? I will, however, ask this question in another post. – Factor Three Aug 14 '22 at 19:28