ionic-epubjs
ionic-epubjs copied to clipboard
cant load epub data
i build an app using ionic 3 with epubjs, but i have problem when access bookPage (when read epub) the epub data not load so next, pevious button can't be function. And when i tap burger icon (TOC page) and select the list i got error message : "cannot call method 'getElemetById' of undefined "
how can i solve this problem? sorry if my english bad
What it the first error you get in the browsers console or network panel?
https://ionic.zone/debug/remote-debug-your-app#android
Does it work if you just check out the repository and build it directly without doing any changes?
the error just occur when i run on emulator. when run ionic serve -l the app work normal (can load epub)
when i build from fresh clone repository using ionic cordova build android and run with emulator the error only occur when epub source from outside and access by url or API (book4, book5, book5 from HomePage.ts), the rest (book1 - book3) can load epub because from local source. the error is same as above
when run ionic serve -l the app work normal (can load epub)
That should actually not be the case - book number 5 should not work in ionic serve
.
the error is same as above
"same as above" doesn't mean anything as the first screenshot doesn't show enough data. You have to use the browser's dev tools to connect to the device and show what actually goes wrong in the console or network panel.
sorry for not enough data, i try to run with my android device and the log show this
the function above _updatetotalPages is error. i try to get data with rest API from my project.
and on android device i got error like this
for my system is
cli packages: (C:\Users\riser\AppData\Roaming\npm\node_modules)
@ionic/cli-utils : 1.19.1
ionic (Ionic CLI) : 3.19.1
global packages:
cordova (Cordova CLI) : 7.1.0
local packages:
@ionic/app-scripts : 3.1.6
Cordova Platforms : none
Ionic Framework : ionic-angular 3.9.2
System:
Android SDK Tools : 26.1.1
Node : v8.9.1
npm : 5.5.1
OS : Windows 10
Environment Variables:
ANDROID_HOME : C:\Users\riser\AppData\Local\Android\sdk
Misc:
backend : pro
Again, these are the console logs from the ionic
console. You have to look at both the console and network panel in a browser's dev tool as described here: https://ionic.zone/debug/remote-debug-your-app#android
sorry, i just understand to use browser's dev tool :(
for console logs
and for network
Can you share the URL you are trying to load? What "book"/URL did you replace with yours? Can you post the second screenshot with more visible of the name/path column (first one)?
for epub url? if yes this the url : http://bukufi.com/storage/book/book_files/1505488522_file_Metamorphosis.epub
i replace "book" URL at book.ts with my rest api URL. the URL on book.ts become like this
// load book
this.book = this.book = ePub(`http://bukufi.com/storage/book/book_files/${book}`);
and then for display book list i replace let book
on home.ts become
getPopularBooks() {
this.bukufiRest.getPopBooks()
.then(data => {
this.popularBooks = data;
console.log('==> Popular Book Data :', this.popularBooks);
});
}
and for clear network screenshot is
Does it work if you leave all the REST stuff out, just use my repository and replace one URL with the URL you are testing right now?
Can you fork the repository and make your changes on your fork and commit them to Github and post the URL? Then I can have a look.
change one URL on home.ts? for the fork repo, the change is only the URL or all current change?
Is adding an entry here https://github.com/janpio/ionic-epubjs/blob/master/src/pages/home/home.ts#L21-L49 with your URL http://bukufi.com/storage/book/book_files/1505488522_file_Metamorphosis.epub enough to trigger the failure?
i change book6 with http://bukufi.com/storage/book/book_files/1505488522_file_Metamorphosis.epub, build an apk and run on my device the app work fine
Ok, that means that the book file is not the problem but something else you did.
You will have to upload your code somewhere. Best on a fork of this repo, because then it is super easy to see exactly what you changed.