mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-05-15 18:14:36 -04:00
Merge branch 'master' of github.com:ZoneMinder/zoneminder
This commit is contained in:
@@ -316,6 +316,7 @@ function MonitorStream(monitorData) {
|
||||
}
|
||||
stream.onerror = this.img_onerror.bind(this);
|
||||
stream.onload = this.img_onload.bind(this);
|
||||
this.started = true;
|
||||
}; // this.start
|
||||
|
||||
this.stop = function() {
|
||||
@@ -331,6 +332,7 @@ function MonitorStream(monitorData) {
|
||||
this.streamCommand(CMD_STOP);
|
||||
this.statusCmdTimer = clearInterval(this.statusCmdTimer);
|
||||
this.streamCmdTimer = clearInterval(this.streamCmdTimer);
|
||||
this.started = false;
|
||||
};
|
||||
|
||||
this.kill = function() {
|
||||
|
||||
@@ -1103,12 +1103,19 @@ function changeMonitorStatusPositon() {
|
||||
// Kick everything off
|
||||
$j(window).on('load', () => initPage());
|
||||
|
||||
//Stop monitors when closing page
|
||||
document.onvisibilitychange = () => {
|
||||
if (document.visibilityState === "hidden") {
|
||||
//Stop monitors when closing or hiding page
|
||||
for (let i = 0, length = monitorData.length; i < length; i++) {
|
||||
monitors[i].kill();
|
||||
}
|
||||
} else {
|
||||
//Start monitors when show page
|
||||
for (let i = 0, length = monitorData.length; i < length; i++) {
|
||||
if (!monitors[i].started) {
|
||||
monitors[i].start();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user