readium / readium-js-viewer

👁 ReadiumJS viewer: default web app for Readium.js library
BSD 3-Clause "New" or "Revised" License
549 stars 186 forks source link

ePub3 audio playing issue in double page layout #743

Open sreejith-mangattil opened 3 years ago

sreejith-mangattil commented 3 years ago

In all of our ePub3 books, we are facing an issue with audio playing in the double-page layout. Once the left page reading is done, then the entire page is reloading and then it's playing the right-side page. When I check the network calls in the developer console, after the left page reading again HTTP requests are happening for both the left and right page, then just after that right side audio is playing.

When we check the firebase Readium app, there also the same behavior is happening. Is there any way to stop reloading?

firebase link of the tested book: https://readium.firebaseapp.com/?epub=https%3A%2F%2Fcdn.rawgit.com%2FIDPF%2Fepub-testsuite%2Fmaster%2Fcontent%2F30%2Fepub30-test-0220&goto=epubcfi(/6/12!/4/2%5Bmo-1%5D/1:0)

I am using Readium JS Viewer.

danielweck commented 3 years ago

Hello, I believe this behaviour is simply the result of linking from one HTML document (i.e. EPUB "spine item" in the reading order) to another. This "hard" refresh is probably implemented to guarantee the state of the targeted document. Unfortunately, in two-page spread viewing mode this causes both documents to update.

danielweck commented 3 years ago

For your information, the two-page spread is implemented here: https://github.com/readium/readium-shared-js/blob/master/js/views/fixed_view.js

Each document is rendered via: https://github.com/readium/readium-shared-js/blob/master/js/views/one_page_view.js

The key function call is openContentUrl() in the Media Overlays playback engine: https://github.com/readium/readium-shared-js/blob/master/js/views/media_overlay_player.js#L640

sreejith-mangattil commented 3 years ago

Thanks a lot, Daniel. Let me look into these modules whether there is any way to stop reloading in the double-page view.

If you have any suggestions, that would be helpful.