playing media files using vlcj java wrapper...

This forum is about all development around libVLC.
jdosso
New Cone
New Cone
Posts: 1
Joined: 13 Mar 2013 21:53

playing media files using vlcj java wrapper...

Postby jdosso » 13 Mar 2013 22:01

This is really a quick question, but since the playMedia function requires a mrl String for the location of the mediafile, is it possible to replay a file if it is embedded inside a jar file as a resource? or even as a netbeans module resource?

I have tried several combinations to replay a media file from inside a jar but the only way i have successfully managed to replay a avi file is by using the absolute path to the avi file which is outside the jar file.. any advice or suggestions would be greatfully appricated.

Regards
James

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: playing media files using vlcj java wrapper...

Postby sherington » 13 Mar 2013 22:53

This is really a quick question, but since the playMedia function requires a mrl String for the location of the mediafile, is it possible to replay a file if it is embedded inside a jar file as a resource? or even as a netbeans module resource?

I have tried several combinations to replay a media file from inside a jar but the only way i have successfully managed to replay a avi file is by using the absolute path to the avi file which is outside the jar file.. any advice or suggestions would be greatfully appricated.

Regards
James
Realistically you can not play anything from inside a jar, nor can you play anything that is some resource on your classpath.

You can extract from your Jar to a temporary file and play that.

Conceivably you could actually play a file from inside your jar if you do something like embed a tiny HTTP server to serve your movie from the classpath.

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: playing media files using vlcj java wrapper...

Postby sherington » 28 Mar 2013 19:32

You could also do this... not ideal but it works...

Code: Select all

mediaPlayer.playMedia("zip:///path/to/zip-or-jar/movies.jar!/my-movie.mpg");
Note the use of the "!" - it is required.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 11 guests