SDKLauncher-Android icon indicating copy to clipboard operation
SDKLauncher-Android copied to clipboard

readDataFull returns max 10MB of data

Open ronghester opened this issue 5 years ago • 1 comments

This issue is a Bug|Question

Package: org.readium.sdk.android Class: PackageResource Method: readDataFull() Issue: When dealing with resource more than 17MB of size then readDataFull() method is returning maximum 10mb of data. What should be changed in order to get all the data from resource?

If getInputStream(true) method is used then the full track data is returned. However this requires to get the input stream and then change it to bytes[] this process takes time and impacting the performance of the player.

Is there any work around so that readDataFull() return full data.

Thanks

ronghester avatar Apr 04 '19 14:04 ronghester

My comments extracted from the parallel Slack discussion:

You should absolutely avoid loading large audio/video buffers in memory. Instead, stream chunks of data via the HTTP transport layer (HTTP 1.1 partial requests / byte ranges is fine for that). That's how the ReadiumSDK is designed, and it even works with encrypted resources.

Typically, in SDKLauncher apps EPUB resources are served over HTTP, so an audio asset from a (zipped) publication would typically be accessible through a URL like http://120.0.0.1:9090/pub/ID/path/to/audio.mp3 => the HTTP server is 1.1 compliant so it will respond correctly to partial byte range request, i.e. it will emit buffer chunks on demand (and the ReadiumSDK resource stream architecture takes care of fetching small amounts of data from the zipped publication)

danielweck avatar Apr 05 '19 17:04 danielweck