JideGuru / epub_viewer

An epub reader for Flutter. Wrapped around Folioreader.(WIP)
https://pub.dev/packages/epub_viewer
Apache License 2.0
146 stars 80 forks source link

Changing epub sdk #49

Open voipworld opened 3 years ago

voipworld commented 3 years ago

hello, would you mind trying a sdk change to Readium, a more stable & well maintained epub sdk for android? folio is not fixing some big issues, like randering a big TOC, and opening big epub files. thanks, Tayeb.

JideGuru commented 3 years ago

Hey, You're right about Folioreader not fixing issues. I'll look into Readium and work on changing it.

voipworld commented 3 years ago

dont you need a flutter plugin for readium?

On 10/31/20, Festus Olusegun notifications@github.com wrote:

Hey, You're right about Folioreader not fixing issues. I'll look into Readium and work on changing it.

-- You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/JideGuru/epub_viewer/issues/49#issuecomment-719989705

JideGuru commented 3 years ago

I'll use the swift and kotlin libraries to turn this one into a Flutter plugin

voipworld commented 3 years ago

otherwise just add it as a platform code and use platform channel to open the epub into a dedicated activity, maybe.

On 11/1/20, Festus Olusegun notifications@github.com wrote:

I'll use the swift and kotlin libraries to turn this one into a Flutter plugin

-- You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/JideGuru/epub_viewer/issues/49#issuecomment-720068191

mrifni commented 3 years ago

any updates on this ?

JideGuru commented 3 years ago

@mrifni The past few weeks have been pretty hectic for me. but I'm almost done with this. Check the readium-android branch if you want contribute. Thanks

JideGuru commented 3 years ago

@mrifni It's this same repo. check the readium-android branch

mrifni commented 3 years ago

any updates on this ?

dhruvkelawala commented 3 years ago

Waiting for the update

ABDERRAHMANE-OUALI commented 3 years ago

any updates on this is the plugin ready ?

winterdl commented 3 years ago

please change to readium sdk, Folioreader not update anymore!

winterdl commented 2 years ago

I've viewed the code of readium, I think we should connect direct from dart to readium js and readium css via webview. If we could implement these from flutter, we could have cross platform epub viewer. In Readium Kotlin and Readium Swift, they connect webview with readium js and css.

JideGuru commented 2 years ago

@winterdl Wow that's a great idea. I actually never thought of that. I'll start looking into that Immediately.

winterdl commented 2 years ago

I didn’t test but you should try this case, android or ios plugin uses r2-stream to create server and addPublication, from flutter we call startServer, stopServer, addEpub, the plugin will return baseUrl after parse and serve publication. Flutter side we use webview to open the baseUrl, inject readium js and readium css. For simple we could try with folioReader js and folioReader css, all native ui now handle by flutter ui. If we have time, we could port r2-server and r2-stream to dart, and remove the native plugins

mrifni commented 2 years ago

you dont have to, its already done by some https://github.com/Mantano/mp_readium

JideGuru commented 2 years ago

Thanks @mrifni and @winterdl. This should make the work easier and faster

winterdl commented 2 years ago

I known the project but they will take time to fully port r2-streamer to dart, and the project doesn’t have r2-navigator port. The r2-streamer-kotlin and r2-streamer-swift are mature and stable now, we should use them as native plugin to hosting publication, and starting implement r2-navigator by flutter. When the porting of r2-streamer- dart done, we could remove the native plugin later. FolioReader itselft is a simplified of r2-navigator reimplement, simple and easier to understand than r2-navigator.

winterdl commented 2 years ago

Good news, with the latest update of the mno packages last day, we could serve publication with flutter, no need to create native plugin:

final pubBox = await EpubParser().parse(filePath);
if (pubBox != null) {
  serverBloc.add(StartServer(
      [FetcherRequestHandler(pubBox.publication)]));
}
winterdl commented 2 years ago

The bad news is the flutter webview not as good as native webview, I've just tested the flutter webview to open a book, It was too laggy and slow, too dificult to swipe if we intergrate webview with pageview, the pageview didnt have preload, if we want to port UI to flutter, it will be long way to go, but we should try, and hope flutter engine will be better.

JideGuru commented 2 years ago

@winterdl that sounds bad. Can you send a link to the repo where you implemented this? Also, I already created a new reading branch(locally) where I'll start working on moving from Folioreader to readium (with mp-readium)

voipworld commented 2 years ago

Hello, is webView required for reading epub? why dont we use a native text widget?

winterdl commented 2 years ago

Both Readium and FolioReader are using webview for rendering html content and paging using css column. If your ebook only text, you could rendering content by canvas, find text_composion for example or flutter_novel, or using html_view. I’ve just quick test, not created repo yet, but the test very simple I will post to gist later.

winterdl commented 2 years ago

The gist contains main functions to open server, load epub from asset and create webview to open publication from created server: https://gist.github.com/winterdl/de0bac7ee7cd9bd932dc486c54ac06a5

webview issues:

https://github.com/flutter/flutter/issues/61795 https://github.com/flutter/flutter/issues/54810 https://github.com/flutter/flutter/issues/34138 https://stackoverflow.com/questions/55587918/web-view-is-too-slow

voipworld commented 2 years ago

i think it would be great to migrate to readium either native or ported, better thant the native webView. this would let the plugin be compatible also with windows, mac, linux and web. what do you think?

voipworld commented 2 years ago

i think we better create a special branch for real test of the plugin with the ported readium library, no?

On 9/24/21, winterdl @.***> wrote:

The gist contains main function to open server, load epub from asset and create webview to open publication from created server: https://gist.github.com/winterdl/de0bac7ee7cd9bd932dc486c54ac06a5

-- You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/JideGuru/epub_viewer/issues/49#issuecomment-926287511

winterdl commented 2 years ago

I've created a testing repo, flutter_readium, reading epub app using only flutter, based on readium project. https://github.com/winterdl/flutter_readium . I dont have time to follow the project, hope everyone could create a repo to mainly development the idea. Thank you.

voipworld commented 2 years ago

Hello, after trying your well writen example, all i can see is the Open book button, but clicking it do nothing. please note that i built the release apk, didnt run flutter run.

On 9/27/21, winterdl @.***> wrote:

I've created a testing repo, flutter_readium, reading epub app using only flutter which based on readium project. https://github.com/winterdl/flutter_readium . I dont have time to follow the project, hope everyone could create a repo to mainly development the idea. Thank you.

-- You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/JideGuru/epub_viewer/issues/49#issuecomment-927558921

winterdl commented 2 years ago

I dont have android device, I just run debug on emulator. I've just tested with the code from repo, it runs okay. The code also working on real ios device.

flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.2.3)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.2)
[✓] VS Code (version 1.60.2)

I've built release apk and installed to emulator, it wont open the book as you said and not throw any errors, maybe these errors came from the parser packages (https://github.com/Mantano) which the app used or came from the embbed webview. I confirmed the bug, but not have time to go further. The parser may contains some issues, hope they will actively development.

winterdl commented 2 years ago

@voipworld I fixed the issue with release build, you should add android.permission.INTERNET to AndroidManifest.xml.

For now, we have 2 ways to changing sdk to readium

vamsijanaki commented 2 years ago

Do you have any ETA for this ? I have someone integrated this to flutter to method channel and it was working good but not 100%. I need someone who can help me integrating into flutter app, Im ready to pay please.

voipworld commented 2 years ago

i think using the ported readium code is better in term of portability. using platform methods mean it will work only for iOs & android. using the ported readium code mean that we can even use it for web i think, also windows, linux, mac.

On 10/9/21, vamsijanaki @.***> wrote:

Do you have any ETA for this ? I have someone integrated this to flutter to method channel and it was working good but not 100%. I need someone who can help me integrating into flutter app, Im ready to pay please.

-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/JideGuru/epub_viewer/issues/49#issuecomment-939245322

jmgeffroy commented 2 years ago

Hi! I'm jumping into this discussion that I just discovered during a googling session. I am the initiator of the Mantano "Iridium" open-source project. I see that @winterdl mentioned our Readium 2 ports, and I simply wanted to add that we have now opened the source code of a Navigator. We also have developed a demo app based on your excellent Flutter Ebook App. We do mention it on different pages. But for a stupid technical reason, the Git history of your Flutter Ebook App and the LICENSE have been squashed. We'll add it back quickly. Sorry for this mistake. I hope the misc. references to you and your work compensate this temporary situation. Basically, we have replaced the OPDS parsing and Epub viewer with ours in your app. The Iridium project source code still contains a few rough or moving parts, and the installation and build instructions are pretty succinct. Test versions are available on the Play Store and TestFlight. I am currently investigating some issues in the navigator (related to preloading), and I'll be happy to discuss if you wish so. I don't want to hijack your thread, but just let you know that (I) we are open to discussing (ii) we clearly advertise the Iridium demo app as being based on your app and forward all deserved credits to you for it! Cheers Jean-Marie

JideGuru commented 2 years ago

Hi @jmgeffroy , Thanks for reaching out. I just tested the demo app and the viewer is awesome. My plan initially was to put all the parts of iridium together to make one viewer (makes it easier for people to use in their apps) just as you've done here. Would you be opened to us working together to achieve that or do you have plans of your own?

jmgeffroy commented 2 years ago

Hi @JideGuru glad to meet you, and congrats on your work! I'm not sure to fully understand your question, since it seems that this is what we've done, basically. This https://github.com/Mantano/iridium/tree/main/app is closely based on your code, except that:

Can you enlighten me? I feel I miss your point. But yes we'll definitely be happy to cooperate on that (knowing that we are developing that in parallel with another app that relies on it).

JideGuru commented 2 years ago

@jmgeffroy i went through the code of the demo app and noticed that you had to import all the different parts of iridium(navigator, streamer, opds etc). This means that if a developer wants to add the viewer to their app they'll need to import all this packages as well then probably copy the code from the view page of the demo app which is totally good for people who wants like a custom integration. But I was thinking more of a quick package that puts all this together already where the developers just need to import this package and write like 5 lines of code to get things up and running. I hope that's clear now. If you've already build something like this you can point me to it. Thanks

jmgeffroy commented 2 years ago

OK understood. If you look at openBook, you just have to instantiate EpubScreen and pass it the file path. So what we need is to extract this part, including EpubScreen and all related machinery in a separate package, let's call it for example "EpubWidget". This was our intent, but we didn't finish it, I'm afraid ;-)

JideGuru commented 2 years ago

@jmgeffroy Alright that makes sense. I'll wait for you to finish that so I can archive this repo then. Thanks

jmgeffroy commented 2 years ago

@JideGuru OK perfect! I'll notify you in this thread as soon as it's done. Cheers

jmgeffroy commented 2 years ago

Hi @JideGuru and all, I have quickly assembled an Iridium reader widget PoC, including an example. It can be improved, this is just the very first iteration. As you can see in the code, integrating a viewer is as simple as:

EpubScreen.fromPath(filePath: widget.dirPath)

Feedback obviously welcome. Cheers

JideGuru commented 2 years ago

Looks pretty good @jmgeffroy . When do you plan on publishing it?

jmgeffroy commented 2 years ago

Thx, I can publish it on Pub.dev tomorrow or on Monday. I also have created a separate Iridium-demo repo forked from your repo. It doesn't use the widget yet, but it will be done shortly.

dymxin commented 2 years ago

Hi! I'm jumping into this discussion that I just discovered during a googling session. I am the initiator of the Mantano "Iridium" open-source project. I see that @winterdl mentioned our Readium 2 ports, and I simply wanted to add that we have now opened the source code of a Navigator. We also have developed a demo app based on your excellent Flutter Ebook App. We do mention it on different pages. But for a stupid technical reason, the Git history of your Flutter Ebook App and the LICENSE have been squashed. We'll add it back quickly. Sorry for this mistake. I hope the misc. references to you and your work compensate this temporary situation. Basically, we have replaced the OPDS parsing and Epub viewer with ours in your app. The Iridium project source code still contains a few rough or moving parts, and the installation and build instructions are pretty succinct. Test versions are available on the Play Store and TestFlight. I am currently investigating some issues in the navigator (related to preloading), and I'll be happy to discuss if you wish so. I don't want to hijack your thread, but just let you know that (I) we are open to discussing (ii) we clearly advertise the Iridium demo app as being based on your app and forward all deserved credits to you for it! Cheers Jean-Marie

Such a beautiful work. I tried the TestFlight, and noticed that the bookmark function doesn’t seem to be working.

jmgeffroy commented 2 years ago

Hi @dymxin

Such a beautiful work. I tried the TestFlight, and noticed that the bookmark function doesn’t seem to be working. Thanks! Much appreciated. I'll double-check this issue and publish an update. Stay tuned!

dymxin commented 2 years ago

Great! Also if there is a possibility to include last location functionality. Whereby on open, a book goes to the last page viewed. Much Love

voipworld commented 2 years ago

hi @@jmgeffroy you'hve made a very good work porting readium arch to dart, this will open the door to so many multi platform ebook reader. i think in your new reader widget you're using flutter beta, the sdk is 2.16 beta. i cant build it using flutter 2.8.1 thank you, Tayeb.

jmgeffroy commented 2 years ago

Hi Tayeb, thank you so much for your positive opinion. Glad to read that. We'd be very happy to see a wide adoption. We strongly believe in Flutter, and clearly our own productivity has been boosted in a tremendous way. I know that this Flutter version isn't on par with the Readium equivalent yet, but I'm confident we'll quickly fill the gap 😉

We are currently building with 2.10.0-0.1.pre, and soon with 0.2, which will hopefully fix a visual glitch. Sorry for the annoyance for you. We can probably downgrade the SDK requirement down to 2.12 in the pubspec. I'll check that on Monday. BTW a few hours ago we have switched to a monorepo, did you see it? It will be easier to maintain. Stay tuned, we're working hard!

Cheers Jean-Marie

voipworld commented 2 years ago

Hi @jmgeffroy yes i saw the new unified repo, good step for the project. i'm currently switching to beta to build and test it, i will test the reader widget in term of usability and accessibility for screen reader users and give fidback on the corresponding repo. i'm pretty happy with this new component, i have been dreaming for a pure flutter epub reading widget for a long time. there was epub_view, but no arabic support.

voipworld commented 2 years ago

i tryed the widget. the reading is pretty easy and well compatible with screen readers. the only issue is the buttons is not labeled, i think you're just using iconButton, can you use textButton.icon? so you can ofer labeling.

voipworld commented 2 years ago

Hello @@jmgeffroy i tested the widget very well, i opened two issues on the newer unified repo. following up!

jmgeffroy commented 2 years ago

Great, thanks a lot, we'll look at your issues right now. Cheers