epub_viewer icon indicating copy to clipboard operation
epub_viewer copied to clipboard

Changing epub sdk

Open voipworld opened this issue 3 years ago • 52 comments

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.

voipworld avatar Oct 31 '20 18:10 voipworld

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

JideGuru avatar Oct 31 '20 21:10 JideGuru

dont you need a flutter plugin for readium?

On 10/31/20, Festus Olusegun [email protected] 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

voipworld avatar Nov 01 '20 10:11 voipworld

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

JideGuru avatar Nov 01 '20 10:11 JideGuru

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 [email protected] 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

voipworld avatar Nov 01 '20 11:11 voipworld

any updates on this ?

mrifni avatar Nov 30 '20 08:11 mrifni

@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 avatar Nov 30 '20 09:11 JideGuru

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

JideGuru avatar Nov 30 '20 10:11 JideGuru

any updates on this ?

mrifni avatar Jan 25 '21 15:01 mrifni

Waiting for the update

dhruvkelawala avatar Mar 01 '21 13:03 dhruvkelawala

any updates on this is the plugin ready ?

ABDERRAHMANE-OUALI avatar Aug 12 '21 07:08 ABDERRAHMANE-OUALI

please change to readium sdk, Folioreader not update anymore!

winterdl avatar Aug 25 '21 11:08 winterdl

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.

winterdl avatar Sep 13 '21 06:09 winterdl

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

JideGuru avatar Sep 13 '21 11:09 JideGuru

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

winterdl avatar Sep 20 '21 00:09 winterdl

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

mrifni avatar Sep 20 '21 16:09 mrifni

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

JideGuru avatar Sep 20 '21 16:09 JideGuru

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 avatar Sep 21 '21 00:09 winterdl

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 avatar Sep 22 '21 05:09 winterdl

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.

winterdl avatar Sep 23 '21 12:09 winterdl

@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)

JideGuru avatar Sep 23 '21 12:09 JideGuru

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

voipworld avatar Sep 23 '21 13:09 voipworld

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 avatar Sep 23 '21 15:09 winterdl

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

winterdl avatar Sep 24 '21 02:09 winterdl

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 avatar Sep 24 '21 09:09 voipworld

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

voipworld avatar Sep 24 '21 10:09 voipworld

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.

winterdl avatar Sep 27 '21 06:09 winterdl

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

voipworld avatar Oct 02 '21 21:10 voipworld

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 avatar Oct 04 '21 02:10 winterdl

@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

  • Porting all readium projects to flutter (https://github.com/Mantano done almost the hard works), I've just demo a prototype at above repo, I though this is a promise way, we could write one time and run on ios and android, this way could apply to FolioReader as well.
  • Write each native plugin, we have the branch https://github.com/JideGuru/epub_viewer/tree/readium-android, we need a prototype ios plugin.

winterdl avatar Oct 06 '21 10:10 winterdl

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.

vamsijanaki avatar Oct 09 '21 07:10 vamsijanaki