Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable Readium to open File objects directly #82

Closed

Conversation

johanpoirier
Copy link
Contributor

Readium can now open a File object (Blob) directly.

For example, if you're using the DeviceStorage API, you can read an epub file from the sdcard of a device :

var sdcard = navigator.getDeviceStorage('sdcard');
var request = sdcard.get("9782019111281.epub");
request.onsuccess = function () {
    var file = this.result;
    var readium = new Readium({ jsLibRoot: './libs/' }, { el: '#reader-frame' });
        readium.openPackageDocument(file, function (packageDocument, options) {
            // do whatever you want with your packageDocument...
        });
};

@danielweck
Copy link
Member

Very interesting!
Although your code changes make perfect sense, we just need to double-check that there are no side effects, and to test across multiple platforms. Definitely worth pursuing, IMO.

@johanpoirier
Copy link
Contributor Author

Hi @danielweck, did you had the time to test it across multiple platforms ?

@danielweck
Copy link
Member

I am afraid not, as our current development priority is in the native ReadiumSDK at the moment.
By the way, is this something we could use for drag-n-drop'ing EPUB files onto the cloud reader? This would be a neat feature.

@danielweck
Copy link
Member

Follow-up on this: as much as I love the idea of being able to open (zipped) EPUB from any data source that can ultimately provide a binary Blob (e.g. drag-n-drop, LocalStorage, SDcard, etc.), there are a number of serious caveats when using non-exploded/expanded EPUBs (regardless of the actual data source).

Documentation:
https://docs.google.com/document/d/1bwv89vSmLbUs4tHOwiqyeV546k5CG3RCJ1S6_-4wvvc/

In a nutshell, list of broken features:

  • EPUB3 Media Overlays
  • Any large video/audio HTML5 media
  • Some SVG
  • Any dynamically-injected resource (via scripting, i.e. not via static markup declarations)
  • Dynamic hyperlinks
    ...basically, anything that can not easily be replaced with BlobURIs at parsing time (statically).

Thus the "low" priority on this issue / PR.

@danielweck
Copy link
Member

@johanpoirier thank you very much for your PR! I adapted it and merged it to develop:
#115

@johanpoirier
Copy link
Contributor Author

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants