I've noticed a few timing issues myself, but these can be traced back to vlc. vlcj just calls libvlc (see code below). You should be able to reproduce against vlc (You should list what version of vlc you are using. I'm using 1.1.4. Also, I'm mostly on Windows XP SP3)
What type of media/file is it? Different file formats will probably pass through different codecs. Offhand, I've noticed the following time issues with vlc:
- mp3s: setTime/setPosition is off on a fractional basis, but accumulates over the length of a file. For example, on a 1 GB mp3 file (approx 12 hours), it can be off by as much as 12/15 seconds when setting position (ex: setting to 11 hours 30 minutes 30 seconds sets instead to 11 hours 30 minutes 45 seconds). This difference will only be 3 or 4 seconds when setting to a position at the 3 hour mark. (Note: these numbers are off the top of my head, so they can be off)
Also, not so much related to setTime/setPosition, but vlc does not play the last .25 seconds of an mp3 file.
- DVDs: setTime/setPosition will generally be incorrect. This has to do with the underlying dvdnav library interpolating sectors to arrive at time. (The right way is pretty hard). However you would probably be off by more than 190 milliseconds....
- mkvs: setting time will always jump to the nearest 3 or 5 second marker. For example, setting time to 40 seconds may set instead to 38 or 43. Never 40. I believe this is an issue with the mkv format, and have seen similar behavior in mplayer/Windows MediaPlayer
Hope this is useful.
Code: Select all
// excerpt from 1.1: uk.co.caprica.vlcj.player.MediaPlayer.java
public void setTime(long time) {
Logger.debug("setTime(time={})", time);
libvlc.libvlc_media_player_set_time(mediaPlayerInstance, time);
}
public void setPosition(float position) {
Logger.debug("setPosition(position={})", position);
libvlc.libvlc_media_player_set_position(mediaPlayerInstance, position);
}