简体   繁体   English

使用VLCJ在jar中运行视频文件

[英]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 我希望将此视频嵌入到我的可执行jar或可以受密码保护的单独zip中

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) 确保路径正确,包括大小写相同(尤其是zip文件中的部分)
  • Try opening the path just with VLC - if that doesn't work then you know the problem isn't related to your code 尝试仅使用VLC打开路径-如果不起作用,则说明问题与您的代码无关
  • 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.) 尝试使用不同的压缩设置的zip文件-也许VLC正在努力读取该特定zip文件的格式(它似乎在其日志中暗示了该内容,尽管我总是对跟踪这些文件感到厌倦。)

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. 如果情况变得最糟,则始终可以将所需文件提取为临时文件 ,然后将该位置传递给VLCJ。 Not an ideal workaround, but one that would at least still let you play the file. 这不是一个理想的解决方法,但是至少可以让您播放文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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