[vlc-devel] [vlc] MediaListPlayer API issues and JVLC update

Javier Gálvez Guerrero javier.galvez.guerrero at gmail.com
Thu Sep 4 12:31:31 CEST 2008

Hi Keith,

Thanks for your answer. I have been analyzing the JVLC source code
(specially MediaList and MediaListPlayer classes) and the problematic
methods, such as MediaList.addMedia(MediaDescriptor), MediaListPlayer.play()
and MediaListPlayer.next().

*The problems:*

*1*. Once the MediaList has been created with one or more elements through
either MediaList.addMedia(String) or MediaList.addMedia(MediaDescriptor)
(the two methods have the same effect), when MediaListPlayer.play() is
executed this message appear in the console:

*** LibVLC Exception not handled: No more element to play
Set a breakpoint in 'libvlc_exception_not_handled' to debug.

Just the same message as if I try to play with an empty MediaList. Anyway,
calling MediaList.size() after each MediaList.add(MediaDescriptor) execution
shows a proper number corresponding the added items. I have noticed that the
MediaList class has an 'items' ArrayList, which is only used for checking
procedures, so the actual MediaList management is done through the Libvlc
methods. In order to get it working properly it must be used the
MediaListPlayer.playItem(int) and similar methods.

*2*. Once the playlist has started to be played through
MediaListPlayer.playItem(0), when the first item finishes the player stops.
If I call MediaListPlayer.next() while playing the first playlist item
(before it reaches its end) the application becomes blocked at this call
while the item 0 continues playing till its end, so it seems that the
'next'method implementation has some problems (Maybe this method is called
as well when the MediaListPlayer listeners get a 'end-reached'-like event,
so that could be a connection between the errors). Anyway, the
MediaListPlayer.next() method code is quite simple as it only delegates on
the Libvlc C function (just as the MediaList.addMedia(MediaDescriptor),
MediaList.size() and nearly all the JVLC methods):

 public void next()
        libvlc_exception_t exception = new libvlc_exception_t();
        jvlc.getLibvlc().libvlc_media_list_player_next(instance, exception);


a) I have checked VLC 0.9.0 test 3 as stand-alone application and managed
the playlist through the GUI, added many files, jumped from one to next and
previous and all works perfectly.

b) Using the corresponding Java bindings (the latest on JVLC website) I have
created a Java Swing application which should allow creating a playlist and
play it, with some additional and simple commands like clearing or jumping
to next items. The source code of this simple application is attached to
this email. However, some bugs have been detected as some methods doesn't
work as expected.

c) The deprecated Playlist class has also been tested, reporting better
results. Anyway, due to the deprecated status of the class, checking the new
MediaList and MediaListPlayer classes behaviour was a priority in order to
develop applications compliant with future VLC releases.

d) The JVLC of MediaList and MediaListPlayer classes seem quite simple and
doesn't give any clue in order to guess which are the causes of these
issues. Nearly all the code lines are based in the LibVlc object which is a
JNA native library binding object, so the calls to VLC C code are made
through this object.

e) I have taken a look at the C implementation of the related functions and,
as far as I can guess how it works, it seems to be ok (obvious? xD). Anyway,
this assertion is supposed to be a stupid one as, as I said in (a), I have
checked the VLC application and it worked properly.

f) C code works fine. Java bindings not, but the conflictive methods are
entirely based in the C functions. So... WHAT THE HELL CAN I DO? xDDDD.

If I could find the errors (always considering that actually they are... It
could be that I don't know how to use the API properly, but this is why I
asked for some help from other developers), then I could recode some JVLC
parts rebuild it and get the jar library as Keith suggested, but I don't
know where the errors are...

So, as always, any help would be much appreciated.


2008/9/3 Keith Kyzivat <kkyzivat at tripleplayint.com>

> Hi Javi,
> I'm currently using JVLC as well, however I haven't chimed up in this
> conversation because I don't use the playlist functionality at all -- just
> the straight media player, and I manage the media choosing, loading
> separately in my java application.
> I'm not sure if I'll have time to investigate switching over to using
> MediaList or Playlist (it seems to work pretty well for me as-is, however
> there have been some niggling things with my implementation that may
> eventually get me to switch, and look into MediaList -- granted, sounds like
> there are some bugs that need to be fixed).
> Have a look at the JVLC source code, and see if you can spot the bugs --
> Just check out the VLC source with git<http://wiki.videolan.org/GetTheSource>,
> and you'll find the Java binding code in <vlc working
> directory>/bindings/java .
> To build it, install a recent JDK (1.5.x is fine, earlier might be fine
> even) and Apache Maven.  When it's all built, you'll have the jars, which
> you should be able to use with any recent 0.9.x vlc build (not sure if there
> are any very new changes that require you to use a latest snapshot, however
> I doubt it) -- no need to actually build the entire vlc sources.
> The Java bindings should only take a few minutes to fetch and build.
> On Wed, Sep 3, 2008 at 11:52 AM, Javier Gálvez Guerrero <
> javier.galvez.guerrero at gmail.com> wrote:
>> Hi,
>> I'm trying to implement a multimedia playlist with the last JVLC API
>> (0.9.0 test3), so I should use MediaList and MediaListPlayer. Anyway, I've
>> tried through many ways to create a playlist and play it but there's no way,
>> it only plays the first media content of the playlist. With the deprecated
>> Playlist class it's so easy and straight-forward and, the most important, it
>> works.
>> I was wondering if anyone got any application using successfully the
>> MediaList and MediaListPlayer objects. If so, how did you get it working?
>> In addition, I would like to know if there is any way to know which item
>> from the MediaList is being played by the MediaListPlayer, getting the
>> MediaDescriptor instance or any other way. Moreover, I can't either see any
>> function to play the previous item at the MediaList but I can see the
>> function 'next()' (although it doesn't work...).
>> As said before, I'm working with VLC 0.9.0 test 3 version due to
>> compatibility requirements with last JVLC library, so, if these methods are
>> implemented in newer VLC versions, please tell me.
>> By the way, is going to appear a new JVLC jar library release in the next
>> days due to the VLC 0.9.1/2 release?
>> Any help is much appreciated.
>> Thank you for your time,
>> Javi
>> ______________________________________________________
>> vlc mailing list
>> To unsubscribe or modify your subscription options:
>> http://mailman.videolan.org/listinfo/vlc
> --
> Keith Kyzivat
> SIPez LLC.
> SIP VoIP, IM and Presence Consulting
> http://www.SIPez.com
> tel: +1 (617) 273-4000
> ______________________________________________________
> vlc mailing list
> To unsubscribe or modify your subscription options:
> http://mailman.videolan.org/listinfo/vlc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20080904/4f2bafdc/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: GUITest.java
Type: text/x-java
Size: 6314 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20080904/4f2bafdc/attachment.java>

More information about the vlc-devel mailing list