score:2

Accepted answer

a media resource locator (mrl) is not the same as a url.

the log you posted shows what vlc is trying to open. the informative part is:

[1644d0ac] filesystem access error: cannot open file d:\desktop\file:\d:\desktop\app.jar!\media\video.mp4 (invalid argument)

"d:\desktop\file:\d:\desktop\app.jar!\media\video.mp4" is clearly not a valid filename?

so this code is flawed:

string url = getclass().getresource("/media/video.mp4").getfile();

this type of thing, without the .getfile(), is usually used to load resources from the application classpath. that's not the case here though when you try and get the file name.

you should just do something like:

string mrl = new file("res/media/video.mp4").getabsolutepath();

but that of course depends on what is the "current" directory for your application, and won't work inside a jar file.

on the other hand, vlc can play media contained inside zip (and therefore jar) files, with an mrl that looks a little bit like what you posted. something like:

zip://file.jar!/res/media/video.mp4

Related Query

More Query from same tag