Stop media playback when article will disappear
This commit is contained in:
parent
bca3c4216c
commit
3370b834b0
|
@ -124,6 +124,12 @@ class WebViewController: UIViewController {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override func viewWillDisappear(_ animated: Bool) {
|
||||||
|
super.viewWillDisappear(animated)
|
||||||
|
|
||||||
|
stopMediaPlayback()
|
||||||
|
}
|
||||||
|
|
||||||
// MARK: Notifications
|
// MARK: Notifications
|
||||||
|
|
||||||
@objc func webFeedIconDidBecomeAvailable(_ note: Notification) {
|
@objc func webFeedIconDidBecomeAvailable(_ note: Notification) {
|
||||||
|
@ -527,6 +533,10 @@ private extension WebViewController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func stopMediaPlayback() {
|
||||||
|
webView?.evaluateJavaScript("stopMediaPlayback();")
|
||||||
|
}
|
||||||
|
|
||||||
func configureTopShowBarsView() {
|
func configureTopShowBarsView() {
|
||||||
topShowBarsView = UIView()
|
topShowBarsView = UIView()
|
||||||
topShowBarsView.backgroundColor = .clear
|
topShowBarsView.backgroundColor = .clear
|
||||||
|
|
|
@ -145,3 +145,14 @@ function postRenderProcessing() {
|
||||||
ImageViewer.init();
|
ImageViewer.init();
|
||||||
inlineVideos();
|
inlineVideos();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function stopMediaPlayback() {
|
||||||
|
document.querySelectorAll("iframe").forEach(element => {
|
||||||
|
var iframeSrc = element.src;
|
||||||
|
element.src = iframeSrc;
|
||||||
|
});
|
||||||
|
|
||||||
|
document.querySelectorAll("video, audio").forEach(element => {
|
||||||
|
element.pause();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue