From 97a03015d7c3ce53db362a4c4622b5f824186003 Mon Sep 17 00:00:00 2001 From: Calin Crisan Date: Sat, 9 Sep 2017 22:49:36 +0300 Subject: [PATCH] framerate dimmer can now be set to 0 (again) and it will refresh once --- motioneye/static/js/main.js | 15 +++++++++++---- motioneye/templates/main.html | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/motioneye/static/js/main.js b/motioneye/static/js/main.js index a1f7452..dbc8452 100644 --- a/motioneye/static/js/main.js +++ b/motioneye/static/js/main.js @@ -4978,20 +4978,27 @@ function refreshCameraFrames() { var count = parseInt(1000 / (refreshInterval * this.config['streaming_framerate'])); var serverSideResize = this.config['streaming_server_resize']; + var cameraId = this.id.substring(6); + count /= framerateFactor; - + + /* if frameFactor is 0, we only want one camera refresh at the beginning, + * and no subsequent refreshes at all */ + if (framerateFactor == 0 && this.refreshDivider == 0) { + refreshCameraFrame(cameraId, this.img, serverSideResize); + this.refreshDivider++; + } + if (this.img.error) { /* in case of error, decrease the refresh rate to 1 fps */ count = 1000 / refreshInterval; } - + if (this.refreshDivider < count) { this.refreshDivider++; } else { - var cameraId = this.id.substring(6); refreshCameraFrame(cameraId, this.img, serverSideResize); - this.refreshDivider = 0; } }); diff --git a/motioneye/templates/main.html b/motioneye/templates/main.html index 55dc700..e55377c 100644 --- a/motioneye/templates/main.html +++ b/motioneye/templates/main.html @@ -125,7 +125,7 @@ ? - + Frame Rate Dimmer ? -- 2.39.5