From 628c93bc1e5250f343e9a3479cd65d3a5ead6857 Mon Sep 17 00:00:00 2001 From: DC Date: Wed, 6 Apr 2016 05:47:10 -0700 Subject: [PATCH] Pause audio reliably when closing the window Before it only paused video... --- renderer/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/renderer/index.js b/renderer/index.js index e44a1c54..4a6a86c0 100644 --- a/renderer/index.js +++ b/renderer/index.js @@ -243,8 +243,8 @@ function dispatch (action, ...args) { // and only redraws on requestAnimationFrame(). That means when the user // closes the window (hide window / minimize to tray) and we want to pause // the video, we update the vdom but it keeps playing until you reopen! - var videoTag = document.querySelector('video') - if (videoTag) videoTag.pause() + var mediaTag = document.querySelector('video,audio') + if (mediaTag) mediaTag.pause() } if (action === 'playbackJump') { jumpToTime(args[0] /* seconds */)