ExoPlayer icon indicating copy to clipboard operation
ExoPlayer copied to clipboard

Custom data source reading from zip file not working

Open NanyangTaiji opened this issue 3 years ago • 3 comments
trafficstars

I tried to write a ZipDataSource, and used both inputstream = zipFile.getInputStream(videoEntry) fromjava.util.zip.ZipFile package and inputstream = zipFile.getInputStream(videoFileHeader) from net.lingala.zip4j.ZipFile package, but none of them worked due to "UnrecognizedInputFormatException".

NanyangTaiji avatar Jul 14 '22 00:07 NanyangTaiji

Difficult to say what isn't right here. I think I would first unzip that file manually and stream it this way. Once this works, you can do the same with the ZIP source like you suggested above and compare the bytes you get from the zip stream as compared to the working unzipped stream.

marcbaechinger avatar Jul 14 '22 09:07 marcbaechinger

Yes, the unzip files work fine. I don't know how to compare bytes from different streams.

NanyangTaiji avatar Jul 14 '22 23:07 NanyangTaiji

You would need to dump this to a file or similar. It's actually not about doing an analysis of the diff, but more to make sure that unzipping the file programmatically results in the same data as unzipping it with a tool.

If you see this works from the unzipped file but not from what you get when using the ZIP library of your choice, then the logic of programmatically unzipping needs to be changed.

I can't give you extensive support for this I'm afraid. Maybe someone from the community has more experience in this and can give you a hand. So I'm leaving this open for a while.

marcbaechinger avatar Jul 15 '22 12:07 marcbaechinger