0
Answered

Stream Epub

Seth Chhim 8 years ago updated by Tom 7 years ago 15

I made an app to load the epubs but it is not an elegant solution. It has to download the entire file first and then post process. In the future, will the epubreader support directly loading a specified page number much like how comicreader works?

Answered

Well, pages don't really exist in epub files (since an epub is only a collection of zipped html files with some metadata).

If you look at the cookies Ubooquity creates to keep track of your progress when you read a book, you'll find two numbers:

- an index identifying the html file in the epub spine

- a progression percentage for this html file


Having page numbers would require Ubooquity to scan the entire epub and guess page numbers using character numbers (ebooks readers like the Kindle or Kobo ones do that).

Too complex for a too little benefit.


But like I said, you can already get a specific html file (usually a chapter) by index, and keep track of the scrollbar on client side.


One solution for that would be to expose a Web Publication Manifest instead: https://github.com/HadrienGardeur/webpub-manifest


Ubooquity would have to parse the OPF in the ZIP container, convert it to a Web Publication Manifest and expose these resources through an HTTP server.
Since the manifest would also be useful for comics, it would be a fairly straightforward way to provide support for both formats in Ubooquity.

True, and part of the work is already done as the embedded Epub reader is already getting the resources contained in the Epub directly from the server.


(although this wouldn't solve the pagination problem)

Stupid question, but how does Google Play books do it. Because pagination in Ubooquity wasnt working, I download from Ubooquity and then uploaded to Google Play. Either way, if a channel could be used or figure out how google displays the epubs.

I never used Google Play books, so I don't know.

if you upload the epub file it will automatically paginate properly depending on the screen size. if it is a book file (epub, mobi...) it should know the size of the screen and end at a margin. or make it port over to something else for reading.

I am convinced they are displaying pages properly.

I just don't have enough time to reverse engineer Google Play Book to try to use their method.

Oh I understand, and believe me, I love what you have done, this to me is just a pain and would love to see in the next release.


As for the use of Google Play, it was just an idea or a visual representation of what I believe the pages should look like.


BTW when is the next release or at least beta coming out?

+1

I'd like to release something around the end of the year.

Since it will contain heavy modifications, I'll also probably publish a beta or two.


+1

Google Play Books actually has to pre-process the book to handle it in their Web viewer or native apps.

I think that there are two clearly separate issues being discussed here:

  • how an EPUB is streamed to a viewer
  • the viewer itself

I fully agree with Thomas, that the primary purpose of Ubooquity is to handle the first part.


As long as a standard solution is used, there will be many options available for the viewer itself (Readium or epub.js for example), one of which Ubooquity might embed by default in the future.

The Android app I'm working on is able to split the epub into separate pages based on number of characters. I'm pretty sure I can get device dimensions and adjust character limit accordingly. So I kind of solved the pagination issue but there is no way to initially load say Page 100 of Page 500 without downloading the entire epub.


My vision for the app is to instantly load an epub with these two conditions:

- the user does not have to install the app (Android Instant Apps)

- the user can "skip" to a page without downloading entire file (Ubooquity serve up specific portion)


This is a non-commercial learning exercise for myself. I'm not requesting any new feature sets (more work for Tom). Just brainstorming and experimenting to learn.

The notion of "page" in EPUB is very abstract as there's really no such thing.


What you should be able to do is to actually get to a specific resource instead (chapter1.html) without loading the entire EPUB, and then be able to paginate and go to the right page.


Most EPUB readers out there actually handle the pagination using CSS, for example with CSS multi-columns or overflow: paged-x and then simply move the viewport.
Here's an example that you can try on Chrome for Android that paginates using CSS: https://hadriengardeur.github.io/webpub-manifest/examples/paged-viewer/

thats close to what i think is needed, the only thing would be to have it good for 2 pages or 1 on a screen.

if it had the good look and feel then I would stop my belly aching :)

Still love the comic side beyond belief.

I just saw readium, that would be above and beyond as part of ubooquity. Please tell me there is a way right now to integrate behind the scenes or will be part of a release.

+1

Not right now, but I have plans to add WebPub support to Ubooquity. This would allow (or at least make easier) the use of alternative readers like Readium.