readium / SDKLauncher-iOS

A small iOS application to serve as a launcher/testbed for the Readium SDK.
BSD 3-Clause "New" or "Revised" License
71 stars 47 forks source link

Need to load only one page in a webview #72

Open dilawer opened 8 years ago

dilawer commented 8 years ago

Hi @danielweck ,

I am using readium sdk to make an iOS demo for my client. I am able to many of required things like, I made able to load page horizontally with pagination effect. I also did lazy loading of pages. I actually loaded more then one webviews and loaded required previous and next pages simultaneously. Everything is working according to my requirements but when epub loads for the first time it takes much time to load current, few previous and few next pages at the same time.

What I understand is I am using this code https://cloudup.com/ceXpYNmeShO to load a book in a single webview and opens the required page. This approach is taking much time because I am using "ReadiumSDK.reader.openBook" method.

I want to load only one page in a webview (I dont want it to swipe to load next or previous pages because I manage more webviews to load other pages). I think that will reduce the page loading time. I look the documentation here https://dl.dropboxusercontent.com/u/18642964/Readium/Shared-JS%20JSDoc/ReadiumSDK.Views.ReaderView.html and I hope following methods can help me in loading single page instead of entire book

I do not find any test code to use these methods. I hope you understand my need, can you please let me know how I can use these methods or any other to load only single page contents/resources in a webview to reduce loading time for a single webview?

Thanks and waiting on your response.

Regards, Dilawer Hussain

danielweck commented 8 years ago

Hello, this is an interesting problem that other vendors (Readium integrators) have attempted to solve, in order to implement page pre-fetching + animations in fixed-layout EPUBs (one page = a single HTML spine item), and fast "chapter" loading in reflowable publications (single HTML spine item = many individual virtual pages).

You have already figured-out the pros/cons of loading a webview with an entire instance of Readium (just in order to load the sibling spine items), so now I would advise you to take a look at this feature branch: https://github.com/readium/readium-shared-js/tree/feature/prefetch (please contact the active developer if you need to learn more about it ... the source code is still experimental CC @JCCR + DmitryM)

Note that the JSDoc you linked to in your comment is obsolete. Make sure to use the latest code from the develop branch to run your tests (there's even an npm run apidocs command to build with YUI-doc-JS): https://github.com/readium/readium-shared-js/blob/develop/package.json#L69

I hope this helps. Regards, Daniel

majidtbox commented 8 years ago

@JCCR @danielweck We have looked into this feature branch: https://github.com/readium/readium-shared-js/tree/feature/prefetch But we are unable to find solution for our mentioned problem. Please guide that how we can use this branch to achieve only next spine items loading in a webview instead of complete epub instance.

Thanks.

danielweck commented 8 years ago

'feature/prefetch' is all there is at this point in time. ReadiumJS is an open-source project that depends on voluntary contributions, so if you have any ideas on how to implement what you are suggesting, please let us know. Many thanks, Daniel