Comments (8)
@winniequinn said:
I'm just starting to play with the idea of not using iframes at all. They cause issues with paged-x
(at least on mobile), they can get in the way when using VoiceOver or TalkBack (as the browser sees the iframe as another container to be navigated into), et cetera.
The whole point of using an iframe, at least as far as I know, is to be able to maintain an outer container for the reading system with the iframe being responsible for holding the contents of the book. This certainly makes sense if the goal is to be able to move between different chapters of a book all within the browser as is presently the case with Readium.
At least on mobile though, I think another solution is possible. We could get rid of the iframe, make the browser responsible only for showing a single chapter, and then load up other chapters in different web views that are then swapped into view as appropriate by the application-layer code written in Java, Swift, et cetera. This approach would seem to eliminate the need for an iframe, would make precaching adjacent spine items very simple, and would allow more work to be lifted out of the land of JavaScript and brought into the application layer.
It may well be possible to use the same approach on the desktop as well. Electron has a web view component that presumably could be used to the same effect as WKWebKit
and android.webkit.WebView
. I need to look into this a bit further.
from architecture.
@rkwright replied:
@winniequinn This is not a bad idea (at all). Iframes are certainly not ideal. However, trying to put separate spine items in separate containers has been tried more than once. See the prefetch branch in shared-js. One of the major problems encountered is NOT playing audio and video (as well as scripting) before the web-view is "brought into view". Both EvidentPoint and Bluefire experimented with it, but were unable to resolve it satisfactorily. But YMMV... It WOULD be a good approach if the problems can be resolved.
from architecture.
@HadrienGardeur replied:
This feels like two separate discussions:
- what the reader/container is and how we inject CSS/JS
- how we handle navigation between spine items
I'm also in favour of either dropping the iframe or offering an alternative, as I've said before in #12 (comment)
How we actually handle different spine items is another question, probably worth having its own issue here.
from architecture.
@danielweck replied:
@winniequinn this is how other "i"-named reading systems do it.
In Readium-1 we have reader.html
that effectively bootstraps the entire readium-shared-js
subsystem (rendering engine), which lays out the EPUB content iframe
hosts, and is responsible for injecting behaviours into spine items (Media Overlays, link hijacking, keyboard / input device intercept and forwarding, CSS styling, epubReadingSystem, MathJax, etc.).
Using native webviews instead of iframes would mean writing a large portion of the rendering code in native per-platform code, which I think is acceptable in the context of Readium-2.
Note that we did look into using Electron's special web frame, but this is basically an extended iframe with special features (still in the renderer process though).
from architecture.
Electron webframe:
https://github.com/electron/electron/blob/master/docs/api/web-frame.md
from architecture.
@danielweck
There's also this:
webview tag in electron
https://github.com/electron/electron/blob/master/docs/api/web-view-tag.md
from architecture.
Oh thanks! :)
from architecture.
Part of my comment at #12 (comment) is also relevant here:
3. Serving content
Ideally, I'd like each implementation to support the following things:
- expose a manifest in a format where a single document can contain all the information that we'll need (this covers metadata, spine, manifest and table of contents), which means that I can do a single request and cache it
- serve each resource in the publication in a way that doesn't require to rewrite links and URIs for images/audio/video/CSS/JS, which means that all paths will be relative to the manifest
- allow the ability to inject JS/CSS in HTML documents without using an iframe and injecting in JS (for example using query parameter such as
GET /chapter1.html?js=paginate.js&css=paginate.css
instead of a plainGET /chapter1.html
) and expose this ability via a URI template in the manifest - support media fragments, for example when I need to start audio/video at a specific timestamp
- serve a number of static resources that are useful (HTML reader, JS, CSS)
With all these, I think it would provide a lot of flexibility in what could be achieved by implementers:
- Reading System A can use the default implementation (currently reader.html + iframe)
- Reading System B decides instead that it would prefer to simply use our native implementation with its HTTP server + decryption, get the manifest (and cache it) and handle pagination and the rest itself (for example using the WKWebview APIs for pagination)
- Reading System C only streams EPUB files, and handles the HTTP part on their own server, but uses our JS to handle everything else in a native app with a Webview
from architecture.
Related Issues (20)
- Which parsers should be implemented and how? HOT 4
- Separate the streamer and the navigator concerns HOT 7
- Adding helpers to the Publication HOT 8
- Building a shared set of manual tests HOT 1
- Media types of Readium publications HOT 10
- Splitting the Publication model HOT 7
- Aligning Readium positions with RMSDK pages HOT 5
- Parsing EPUB contributors HOT 21
- Submitting and Archiving Proposals HOT 6
- [Administrative] Creating default community health files HOT 2
- audiobook LPF mapping document: clarify conformsTo HOT 5
- A new Branching Model for the Release Process HOT 19
- Possible incorrect link to r2-navigator on projects page
- Setting up a Community Health folder
- EPUB2 dc:date metadata parsing
- How to compute the positions for a Readium Web Publication? HOT 2
- How to exchange/represent a collection of `Locator` objects? HOT 1
- Osmyne
- Custom DRM implementation HOT 5
- how to create a Publication object when only book pdf file/link is available HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from architecture.