kiwix-js
kiwix-js copied to clipboard
Better stream audio/video content with libzim wasm
Libzim supports reading only chunks of data of a DirEntry : https://libzim.readthedocs.io/en/stable/api/classzim_1_1Item.html#_CPPv4NK3zim4Item7getDataE11offset_type9size_type
This is something we are not able to do with our current custom javascript backend.
Making use of this in the ServiceWorker would avoid wasting resources reading the complete data when the browser only requests a chunk. It would probably improve performance when seeking inside audio/video content. In particular when the user is dragging the cursor of the progress bar (which can generate multiple HTTP requests requesting for small chunks)
It should not be very difficult to implement, as it only needs to pass offset and length parameters to getData().