Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML <media> elements keep playing after turning pages #121

Open
mickael-menu opened this issue Apr 21, 2020 · 2 comments
Open

HTML <media> elements keep playing after turning pages #121

mickael-menu opened this issue Apr 21, 2020 · 2 comments
Labels
bug Something isn't working

Comments

@mickael-menu
Copy link
Member

When turning an EPUB's pages with <media> elements playing, the playback is not interrupted. It keeps going until the page is destroyed which can take 2 additional page turns for FXL.

https://github.com/readium/r2-navigator-swift/blob/6654a5d266b121de9b1bd1f332cb5b860ce95f3b/r2-navigator-swift/EPUB/EPUBNavigatorViewController.swift#L60-L64

Two questions:

  • Should we interrupt playback when navigating to another resource? (I think so)
  • Should we interrupt playback in a single reflowable resource, when the element is out of screen? (I'm not so sure)
@mickael-menu
Copy link
Member Author

A possible solution could be to send an event when a resource is not visible anymore and loop over all the media/audio/video elements to pause them (i.e. https://stackoverflow.com/questions/20362138/stop-all-html5-audio-video-with-javascript)

@mickael-menu
Copy link
Member Author

On iOS 14.5+, WKWebView.pauseAllMediaPlayback() should be used.

@mickael-menu mickael-menu transferred this issue from readium/r2-navigator-swift Aug 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant