简体   繁体   中英

Running video file in jar using VLCJ

I am developing an application where i have a startup video

I want this video to be embedded in my executable jar or a separate zip which can be password protected

I have tried to use the following code but its not working

audioPlayer.prepareMedia("zip:///C:/Users/User/Documents/NetBeansProjects/HanumanChalisa/res.zip!/res/startup.mp4");

Please help me for this.

EDIT :

this is the error i am getting

[mov,mp4,m4a,3gp,3g2,mj2 @ 000000000053e320] moov atom not found
[000000000d245358] avcodec demux error: Could not open C:\Users\User\Documents\NetBeansProjects\HanumanChalisa\res.zip!\res\startup.mp4: Specified event object handle is invalid

[000000000d245358] ps demux error: cannot peek

[000000000d2390c8] main input error: no suitable demux module for 'zip/:///C:/Users/User/Documents/NetBeansProjects/HanumanChalisa/res.zip!/res/startup.mp4'

[000000000d2390c8] main input error: VLC can't recognize the input's format

[000000000d2390c8] main input error: The format of 'zip:///C:/Users/User/Documents/NetBeansProjects/HanumanChalisa/res.zip!/res/startup.mp4' cannot be detected. Have a look at the log for details.`

This works for me (when I adjust the path obviously), so I don't think there's anything inherently wrong with the code that you've posted. A couple of things to note:

  • Make sure the path is correct, that includes the case being the same (especially for the part inside the zip file)
  • Try opening the path just with VLC - if that doesn't work then you know the problem isn't related to your code
  • Try a zip file with different compression settings - perhaps VLC is struggling to read the format of that particular zip file (which it seems to allude to in its logs, though I'm always weary of following those too closely.)

If the worst comes to the worst, you could always extract the file you need to a tempoary file and then pass that location to VLCJ. Not an ideal workaround, but one that would at least still let you play the file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM