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

Pierre d'Herbemont pdherbemont at free.fr
Mon Nov 30 01:21:29 CET 2009


On Sat, Nov 28, 2009 at 8:49 AM, Tony Anecito <adanecito at yahoo.com> wrote:
> 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.

There should be media.getDuration() and media.isPreparsed(). You just
need to query it once (to trigger preparsing), and then wait for the
media to be preparsed, or for the duration change event.

But, I don't think preparsing works on network stream for obvious reasons.

Pierre.



More information about the vlc-devel mailing list