I try to show my epub by below code with use epubjs-rn package, every thing is ok in debug build and when I get release build and test, epub book not show and fix loading at begining to show, I debug in android studio console and find same error:
I/ReactNativeJS: readBookEpub id: 4868
I/ReactNativeJS: source: http://localhost:8899/4868/
E/ReactNativeJS: Empty Response
my code:
_showEpub(bookName) {
console.log("_showEpub");
const targetPath = 'http://127.0.0.1:8899/' + bookName + '.epub';
//------------------------------------------------------show Epub
try {
this.streamer.start()
.then((origin) => {
console.log("Served from:", origin);
// this.streamer.check('http://127.0.0.1:8899/moby-dick.epub').then((t) => console.log("hiii"+t));
return this.streamer.get(targetPath);
})
.then((src) => {
console.log("Loading from:", src);
return this.setState({ urlBook: src });
});
}
catch (err) {
console.log("Error: " + err);
}
//---------------------------------------------------
}
for show book , I download book from my server by RNBackgroundDownloader
and save , then unzip it in asset folder for read locally,
my unzip function:
_unZipBook(bookName) {
console.log("_unZipBook")
const sourcePath = Dirs.DocumentDir + '/FaraSource/e/' + bookName + '.zip';
const targetPath = `${Dirs.DocumentDir}/assets/${bookName}`;
unzip(sourcePath, targetPath)
.then((path) => {
console.log("unZip " + bookName + "in" + targetPath);
this._showEpub(bookName);
// return url;
})
}
any one can help me for this problem ?