readium / r2-navigator-js

NodeJS Readium2 "navigator"
BSD 3-Clause "New" or "Revised" License
7 stars 3 forks source link

Can you clarify the support (or lack of support) for web-browsers? #49

Closed kurtome closed 4 years ago

kurtome commented 4 years ago

Hello, and thanks for working on this great open source project. I'm seeing this in the docs:

Note that web-browser Javascript is currently not supported (only NodeJS runtimes).

However it's not clear to me if that means importing this library into a browser javascript app is just not officially support or if it's there are specific features that would totally break. Is there any more information about this? Is this only meant for Electron apps?

danielweck commented 4 years ago

At the beginning, we were hoping that the "JS" Readium2 components (i.e. r2-utils-js, r2-lcp-js, r2-shared-js, r2-opds-js, r2-streamer-js, r2-navigator-js) would somewhat support isomorphic Javascript / dual NodeJS + browser runtimes (with r2-testapp-js and readium-desktop / Thorium focusing specifically on Electron). However in practice the development priorities / real-world integration context has been Electron + NodeJS.

There is some "vanilla" JS/TS available in the codebase, including some useful DOM/CSS-related functionality, but these are currently not isolated / usable as off-the-shelf building blocks for web-browser applications.

As for r2-navigator-js more specifically: this is totally engineered around Electron (webview instead of browser iframe, and quite a few other critical functional dependencies) ... so the package should really be named r2-navigator-electron.

Sorry for the confusion.

kurtome commented 4 years ago

Thank you for the response, this is super helpful!

jfbloom22 commented 3 years ago

This looks like a great project, I wish I was deploying to Electron rather than Web. Any suggestions on a web-browser compatible alternative? I am currently using epub.js, but I am looking for something that supports SMIL and media types. It looks like this might be an option: https://github.com/readium/readium-js but it is not ideal for many reasons, one of which is that it does not appear to be maintained any longer.

danielweck commented 3 years ago

The "Readium Web" project is in its infancy, I'm afraid: https://github.com/readium/web So EPUB.js / ReadiumJS / etc. are indeed your most likely options at the moment.

jfbloom22 commented 3 years ago

ok thanks! I explored pulling out the media-overlays module from r2-navigator-js, but it appears that it will require a fair amount of refactoring before it will function happily in a web browser. Now I am headed down the path of borrowing code from Readium-js that handles parsing the package.opf and the smil XML files. I plan to take this and build my own audio controls and highlighting functionality.

kurtome commented 3 years ago

For what it's worth, it's not too hard to use Readium CSS and them implement your own interactive web page on top of that with whatever JS tools you prefer.