background-size: cover;
width: 48px;
height: 48px;
- transition: transform 0.1s ease;
+ transition: transform 0.1s linear;
}
div.settings-top-bar.open div.button.settings-button {
border: 0.2em solid #212121;
border-right-width: 0px;
border-bottom-width: 0px;
- transition: all 0.1s, opacity 0s;
+ transition: all 0.1s linear, opacity 0s;
opacity: 0;
vertical-align: top;
cursor: pointer;
left: 0.2em;
bottom: 0.2em;
opacity: 0;
- transition: opacity 0.2s ease;
+ transition: all 0.2s linear;
}
div.camera-overlay.visible {
div.camera-overlay-top,
div.camera-overlay-bottom {
position: absolute;
- background-color: rgba(49, 49, 49, 0.8);
+ background-color: rgba(0, 0, 0, 0.7);
+ transition: background-color 0.1s linear;
left: 0px;
width: 100%;
}
var moviesButton = cameraFrameDiv.find('div.camera-top-button.media-movies');
var fullScreenButton = cameraFrameDiv.find('div.camera-top-button.full-screen');
- var cameraInfoDiv = cameraFrameDiv.find('div.camera-info');
+ var fpsSpan = cameraFrameDiv.find('span.camera-info.fps');
var lockButton = cameraFrameDiv.find('div.camera-action-button.lock');
var unlockButton = cameraFrameDiv.find('div.camera-action-button.unlock');
}(cameraId));
/* add the action button handlers */
-// if (cameraConfig.at-most-4-buttons) {
+// if (cameraConfig.at-most-4-buttons) { TODO
// cameraOverlay.find('div.camera-overlay-bottom').addClass('few-buttons');
// }
//TODO add handlers
- // TODO move this to the refresh function
- cameraInfoDiv.append('');
+ var FPS_LEN = 4;
+ cameraImg[0].fpsTimes = [];
/* error and load handlers */
cameraImg[0].onerror = function () {
cameraPlaceholder.css('opacity', 1);
cameraProgress.removeClass('visible');
cameraFrameDiv.removeClass('motion-detected');
+ fpsSpan.html('');
};
cameraImg[0].onload = function () {
if (refreshDisabled[cameraId]) {
}
this.lastCookieTime = now;
+
+ if (this.fpsTimes.length == FPS_LEN) {
+ var fps = this.fpsTimes.length * 1000 / (this.fpsTimes[this.fpsTimes.length - 1] - this.fpsTimes[0]);
+ fps = fps.toFixed(1);
+ fpsSpan.html(fps + ' fps');
+ }
+ }
+
+ /* compute the actual framerate */
+ if (cameraFrameDiv[0].config['proto'] != 'mjpeg') {
+ this.fpsTimes.push(now);
+ while (this.fpsTimes.length > FPS_LEN) {
+ this.fpsTimes.shift();
+ }
}
if (fullScreenCameraId) {
function checkCameraErrors() {
/* properly triggers the onerror event on the cameras whose imgs were not successfully loaded,
* but the onerror event hasn't been triggered, for some reason (seems to happen in Chrome) */
- var cameraFrames = getPageContainer().find('img.camera');
-
- cameraFrames.each(function () {
+ var cameraImgs = getPageContainer().find('img.camera');
+ var now = new Date().getTime();
+
+ cameraImgs.each(function () {
if (this.complete === true && this.naturalWidth === 0 && !this.error && this.src) {
$(this).error();
}
+
+ /* fps timeout */
+ if (this.fpsTimes.length && (now - this.fpsTimes[this.fpsTimes.length - 1]) > 2000) {
+ $(this).parents('div.camera-frame').find('span.camera-info.fps').html('0 fps');
+ }
});
-
- setTimeout(checkCameraErrors, 500);
+
+ setTimeout(checkCameraErrors, 1000);
}