玩ZIP .mp4档案无解压ZIP档案、ZIP

2023-09-07 15:46:41 作者:别特么假惺惺

在SD卡我有一个包含一个视频文件(MP4)的zip文件。我需要发挥通过VideoView的视频文件,无需解压的压缩。

On the SD-card I have a zip file containing one video file (.mp4). I need to play that video file via a VideoView without extracting the zip.

到目前为止,我曾尝试:

So far I have tried :

ZipFile zipFile = new ZipFile(new File("/sdcard/checking.zip"));
ZipEntry zipEntry = zipFile.getEntry("checking.mp4");
InputStream inStream  = zipFile.getInputStream(zipEntry);

但我不觉得,从的InputStream 播放视频的API。 zipEntry.getSize()确实返回值。

But I don't find any API that plays video from InputStream. zipEntry.getSize() does return the value.

我试过 videoView.setVideoURI(Uri.parse(// SD卡/ checking.zip /checking.mp4!)); 从HERE

但它显示无法播放视频。所以,我怎么做,在Android(在标题中提到)。

But it shows "Can't play video". So how do I do that (mentioned in the title) on android.

推荐答案

说实话我有同样的问题。但扩展文件文档中它说你需要压缩文件中的一个特殊的方式,以从zip文件夹直读。你不应该任何COM pression适用于内的介质。

To be honest I am having the same problem. But in the Expansion Files documentation it says you need to zip the file in a particular way in order to read straight from the zip folder. You shouldn't apply any compression to the media inside.

希望这有助于...

我真的不知道怎么拉链这样的。

I just don't really know how to zip like that.