[vlc-devel] When to read movie length using mediaPlayer?

Rémi Denis-Courmont remi at remlab.net
Sat Nov 28 10:43:55 CET 2009

Le samedi 28 novembre 2009 09:49:18 Tony Anecito, vous avez écrit :
> Hi All,
> I am running into an issue regarding viewing youtube videos using 1.0.4 &
>  JVLC. I noticed that if I try to get the video length using
>  mediaPlayer.getLength() right after play has started the video may report
>  0 length or crash. Can the length of a video for youtube videos be
>  determined without playing it first using the mediaPlayer object? The same
>  question would be important for vidoes viewed via http.

In theory, LibVLC could load the file without playing it. The VLC playlist 
already does that - but I think it's not implemented in LibVLC. Patch is 
always welcome.

That said, it only works for local files, as it would be too slow for remote 
inputs. So I think it wouldn't really help you. LibVLC emits an event when the 
file has been parsed shortly after playback starts.

Rémi Denis-Courmont

More information about the vlc-devel mailing list