diff --git a/web/skins/classic/views/js/montage.js b/web/skins/classic/views/js/montage.js index e5c10edae4..9db56aa323 100644 --- a/web/skins/classic/views/js/montage.js +++ b/web/skins/classic/views/js/montage.js @@ -1046,7 +1046,7 @@ document.onvisibilitychange = () => { //closing should kill, hiding should stop/pause for (let i = 0, length = monitors.length; i < length; i++) { // Stop instead of pause because we don't want buffering in zms - monitors[i].stop(); + monitors[i].kill(); } }, 15*1000); } else { diff --git a/web/skins/classic/views/js/watch.js b/web/skins/classic/views/js/watch.js index bbc32e1c76..9006b28dcd 100644 --- a/web/skins/classic/views/js/watch.js +++ b/web/skins/classic/views/js/watch.js @@ -1402,7 +1402,10 @@ document.onvisibilitychange = () => { prevStateStarted = 'played'; //Stop only if playing (not paused). // We might want to continue status updates so that alarm sounds etc still happen - monitorStream.stop(); + // Use kill() instead of stop() to send CMD_QUIT and terminate the zms + // process. stop() only sends CMD_STOP which leaves zms running, causing + // orphaned processes to accumulate each time the tab is hidden/shown. + monitorStream.kill(); } } else { prevStateStarted = 'stopped'; diff --git a/web/skins/classic/views/js/zone.js b/web/skins/classic/views/js/zone.js index 22b7b2b0e2..57baa903de 100644 --- a/web/skins/classic/views/js/zone.js +++ b/web/skins/classic/views/js/zone.js @@ -793,7 +793,10 @@ document.onvisibilitychange = () => { TimerHideShow = setTimeout(function() { //Stop monitors when closing or hiding page for (let i = 0, length = monitorData.length; i < length; i++) { - monitors[i].stop(); + // Use kill() instead of stop() to send CMD_QUIT and terminate the zms + // process. stop() only sends CMD_STOP which leaves zms running, causing + // orphaned processes to accumulate each time the tab is hidden/shown. + monitors[i].kill(); } }, 15*1000); } else {