Stop media playback when the main window is closed. Issue #1646

This commit is contained in:
Maurice Parker
2020-02-27 12:15:41 -08:00
parent a465045888
commit 85bd20ca80
4 changed files with 29 additions and 0 deletions

View File

@@ -358,6 +358,17 @@ private extension ArticleRenderer {
window.webkit.messageHandlers.mouseDidExit.postMessage(anchor.href);
}
function stopMediaPlayback() {
document.querySelectorAll("iframe").forEach(element => {
var iframeSrc = element.src;
element.src = iframeSrc;
});
document.querySelectorAll("video, audio").forEach(element => {
element.pause();
});
}
</script>
"""