Get Duration of media

This forum is about all development around libVLC.
ronins
New Cone
New Cone
Posts: 9
Joined: 17 Nov 2010 12:43

Get Duration of media

Postby ronins » 18 Nov 2010 11:33

Hello again,us I see the mediaPlayer.getlength() has some problems.
If the file that i have choose isn't playing the getlength() gives me 0 length.When the file that i have choose starts playing the length of file is correct.
Any way to take the duration of the media file that i have choose before playing the file?
The mediaPlayer.prepareMedia() what stands for?with this command the mediaplayer() loads the file for playing and waits for play command???

sherington
Cone that earned his stripes
Cone that earned his stripes
Posts: 491
Joined: 10 Sep 2008 11:57
VLC version: master
Operating System: Linux

Re: Get Duration of media

Postby sherington » 18 Nov 2010 14:53

Hello again,us I see the mediaPlayer.getlength() has some problems.
If the file that i have choose isn't playing the getlength() gives me 0 length.When the file that i have choose starts playing the length of file is correct.
Any way to take the duration of the media file that i have choose before playing the file?
You're talking about Java bindings, right?

mediaPlayer.getLength() simply calls the native libvlc_media_player_get_length() - the 'problem' you are describing is just how it works.

I don't think you can get the behaviour you are asking for. I think it's not so easy to know in advance how to get the length for all the various different types of video data.

Hopefully someone else knows better.
The mediaPlayer.prepareMedia() what stands for?with this command the mediaplayer() loads the file for playing and waits for play command???
Some users asked for a feature whereby they could 'prepare' the media for playing, without actually playing it. That's what this prepareMedia() is for, rather than playMedia(). That's the only difference.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 9 guests