summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.xml2
-rw-r--r--package.json24
-rw-r--r--www/js/EventModalCtrl.js15
-rw-r--r--www/js/MonitorCtrl.js192
-rw-r--r--www/js/NVR.js7
-rw-r--r--www/lang/locale-en.json1
-rw-r--r--www/templates/events-modal.html4
-rw-r--r--www/templates/monitors.html9
8 files changed, 176 insertions, 78 deletions
diff --git a/config.xml b/config.xml
index 96efc0c9..6fd11edb 100644
--- a/config.xml
+++ b/config.xml
@@ -187,5 +187,5 @@
<plugin name="cordova-plugin-whitelist" spec="^1.3.4" />
<plugin name="cordova-plugin-media-pp-fork" spec="^1.0.2-dev" />
<engine name="android" spec="^8.0.0" />
- <engine name="ios" spec="^5.1.1" />
+ <engine name="ios" spec="^4.5.5" />
</widget>
diff --git a/package.json b/package.json
index bfc53c59..c2de688d 100644
--- a/package.json
+++ b/package.json
@@ -61,31 +61,33 @@
"cordova-plugin-inappbrowser": {},
"cordova-plugin-app-version": {},
"cordova-plugin-statusbar-pp-fork": {},
+ "cordova-plugin-statusbar": {},
"cordova-plugin-media-pp-fork": {}
}
},
"dependencies": {
+ "async": "^3.2.0",
"clivas": "^0.2.0",
"cordova-android": "^8.0.0",
"cordova-custom-config": "^5.1.0",
- "cordova-ios": "^5.1.1",
+ "cordova-ios": "^4.5.5",
"cordova-library-helper-pp-fork": "^1.0.1",
- "cordova-plugin-add-swift-support": "1.7.2",
+ "cordova-plugin-add-swift-support": "^1.7.2",
"cordova-plugin-advanced-http": "git+https://github.com/silkimen/cordova-plugin-advanced-http.git",
"cordova-plugin-advanced-websocket": "^1.1.5",
"cordova-plugin-android-fingerprint-auth": "^1.5.0",
- "cordova-plugin-android-permissions": "1.0.2",
- "cordova-plugin-app-version": "0.1.9",
+ "cordova-plugin-android-permissions": "^1.0.2",
+ "cordova-plugin-app-version": "^0.1.9",
"cordova-plugin-cloud-settings": "^1.0.4",
"cordova-plugin-customurlscheme": "^4.4.0",
"cordova-plugin-device": "^2.0.3",
- "cordova-plugin-file": "6.0.2",
+ "cordova-plugin-file": "^6.0.2",
"cordova-plugin-file-transfer": "^1.7.1",
"cordova-plugin-globalization": "^1.11.0",
"cordova-plugin-ignore-lint-translation": "0.0.1",
"cordova-plugin-inappbrowser": "git+https://github.com/apache/cordova-plugin-inappbrowser.git",
"cordova-plugin-insomnia": "^4.3.0",
- "cordova-plugin-ionic-keyboard": "2.2.0",
+ "cordova-plugin-ionic-keyboard": "^2.2.0",
"cordova-plugin-media-pp-fork": "^1.0.2-dev",
"cordova-plugin-multi-window": "0.0.3",
"cordova-plugin-network-information": "^2.0.2",
@@ -93,11 +95,11 @@
"cordova-plugin-pin-dialog": "^0.1.3",
"cordova-plugin-splashscreen": "git+https://github.com/prageeth/cordova-plugin-splashscreen.git",
"cordova-plugin-statusbar-pp-fork": "^2.4.4-dev",
- "cordova-plugin-touch-id": "3.4.0",
+ "cordova-plugin-touch-id": "^3.4.0",
"cordova-plugin-whitelist": "^1.3.4",
- "cordova-plugin-x-socialsharing": "5.6.4",
+ "cordova-plugin-x-socialsharing": "^5.6.4",
"cordova-sqlite-storage": "^1.5.3",
- "cordova-support-google-services": "1.3.2",
+ "cordova-support-google-services": "^1.3.2",
"deep-equal": "^2.0.3",
"define-properties": "^1.1.3",
"dialog": "^0.3.1",
@@ -111,16 +113,18 @@
"is-arguments": "^1.0.4",
"is-date-object": "^1.0.2",
"is-regex": "^1.0.5",
+ "jshint": "^2.11.1",
"json-file": "^0.1.0",
"jsonfile": "^6.0.1",
"keypress": "^0.2.1",
"menu": "^0.2.5",
"minimist": "^1.2.5",
"mkdirp": "^1.0.4",
+ "node-sass": "^4.14.1",
"object-is": "^1.1.2",
"object-keys": "^1.1.1",
"phonegap-plugin-multidex": "^1.0.0",
- "phonegap-plugin-push": "2.3.0",
+ "phonegap-plugin-push": "^2.3.0",
"regexp.prototype.flags": "^1.3.0"
},
"devDependencies": {
diff --git a/www/js/EventModalCtrl.js b/www/js/EventModalCtrl.js
index 351253c8..c62c2cf6 100644
--- a/www/js/EventModalCtrl.js
+++ b/www/js/EventModalCtrl.js
@@ -35,6 +35,7 @@ angular.module('zmApp.controllers').controller('EventModalCtrl', ['$scope', '$ro
var playState = 'play';
var isSeeking = false;
$scope.useFilters = true;
+
var broadcastHandles = [];
@@ -2136,7 +2137,19 @@ angular.module('zmApp.controllers').controller('EventModalCtrl', ['$scope', '$ro
}
- $scope.defaultVideo = event.Event.DefaultVideo;
+
+
+ var ld = NVR.getLogin();
+ if (ld.monitorSpecific[event.Event.MonitorId] &&
+ ld.monitorSpecific[event.Event.MonitorId].forceMjpeg) {
+ NVR.debug ('Monitor:'+event.Event.MonitorId+' has forced MJPEG playback');
+ $scope.defaultVideo ='';
+ } else {
+
+ $scope.defaultVideo = event.Event.DefaultVideo;
+ }
+
+
$scope.connKey = (Math.floor((Math.random() * 999999) + 1)).toString();
diff --git a/www/js/MonitorCtrl.js b/www/js/MonitorCtrl.js
index 1cd695b7..637998df 100644
--- a/www/js/MonitorCtrl.js
+++ b/www/js/MonitorCtrl.js
@@ -78,20 +78,33 @@ angular.module('zmApp.controllers')
// This function takes care of changing monitor parameters
// For now, I've only limited it to enable/disable and change monitor mode
// and changing monitor function
+ // if it's 'All' then rest are empty
//-----------------------------------------------------------------------
- $scope.changeConfig = function (monitorName, monitorId, enabled, func) {
+ $scope.changeConfig = function (monitorName, monitorId, enabled, func, mon_forceMjpeg) {
var checked = false;
+ var i;
+
+
+
+ $scope.forceMjpeg = {
+ value:false
+ };
+ if (!mon_forceMjpeg) $scope.forceMjpeg.value = true; // true if all monitors passed
var monitorsIds = [];
if (monitorName == 'All') {
monitorName = $translate.instant('kAll');
// in all monitors, lets keep enabled on
enabled = '1';
- for (var i = 0; i < $scope.monitors.length; i++) {
+
+ for (i = 0; i < $scope.monitors.length; i++) {
+ // console.log ("HUH "+$scope.monitors[i].Monitor.forceMjpeg);
monitorsIds[i] = $scope.monitors[i].Monitor.Id;
+ if (!$scope.monitors[i].Monitor.forceMjpeg) $scope.forceMjpeg.value = false; // if any is unset, global is unset
}
} else {
monitorsIds[0] = monitorId;
+ $scope.forceMjpeg.value = mon_forceMjpeg;
}
//console.log("called with " + monitorId + ":" + enabled + ":" + func);
@@ -133,11 +146,24 @@ angular.module('zmApp.controllers')
mypromises: []
};
+
+ var oldValues = {
+ myfunc: func,
+ myenabled: checked,
+ forceMjpeg: $scope.forceMjpeg.value
+ };
+
//console.log (JSON.stringify($scope.monfunc));
$rootScope.zmPopup = $ionicPopup.show({
scope: $scope,
cssClass:'widepopup',
- template: '<ion-toggle ng-model="monfunc.myenabled" toggle-class="toggle-calm">'+$translate.instant('kMotionEnabled')+'</ion-toggle><div class="item item-divider" style="background:#666666;color:white;">'+$translate.instant('kChangeMode')+'</div><ion-radio-fix ng-repeat="item in monFunctions" ng-value="item.value" ng-model="monfunc.myfunc"> {{item.text}} </ion-radio-fix>',
+ template: '<ion-toggle ng-model="monfunc.myenabled" toggle-class="toggle-calm">'
+ +$translate.instant('kMotionEnabled')+'</ion-toggle>'
+ +'<ion-toggle ng-model="forceMjpeg.value" toggle-class="toggle-calm">'
+ +$translate.instant('kForceMjpeg')+'</ion-toggle>'+
+ '<div class="item item-divider" style="background:#666666;color:white;">'
+ +$translate.instant('kChangeMode')
+ +'</div><ion-radio-fix ng-repeat="item in monFunctions" ng-value="item.value" ng-model="monfunc.myfunc"> {{item.text}} </ion-radio-fix>',
title: $translate.instant('kChangeSettingsFor') + ' ' + monitorName,
@@ -154,66 +180,93 @@ angular.module('zmApp.controllers')
var loginData = NVR.getLogin();
$scope.monfunc.mymonitorsIds.forEach(function (item, index) {
- var apiMon = loginData.apiurl + "/monitors/" + item + ".json?"+$rootScope.authSession;
- NVR.debug("MonitorCtrl: URLs for changeConfig save:" + apiMon);
-
- var data = {};
- if ($scope.monfunc.myfunc) data['Monitor[Function]'] = $scope.monfunc.myfunc;
- if (isEnabled) data['Monitor[Enabled]'] = isEnabled;
-
- $ionicLoading.show({
- template: $translate.instant('kApplyingChanges') + "...",
- noBackdrop: true,
- duration: zm.largeHttpTimeout,
- });
-
- var httpPromise = $http({
- url: apiMon,
- method: 'post',
- headers: {
- 'Content-Type': 'application/x-www-form-urlencoded',
- 'Accept': '*/*',
- },
- transformRequest: function (obj) {
- var str = [];
- for (var p in obj)
- str.push(encodeURIComponent(p) + "=" +
- encodeURIComponent(obj[p]));
- var foo = str.join("&");
- NVR.debug("MonitorCtrl: parmeters constructed: " + foo);
- return foo;
- },
- data: data
-
- })
- .then(function () {
- NVR.debug("MonitorCtrl: Not restarting ZM - Make sure you have the patch installed in MonitorsController.php or this won't work");
- },
- function (data, status, headers, config) {
- NVR.debug("MonitorCtrl: Error changing monitor " + JSON.stringify(data));
- $scope.monfunc.myfailedIds.push(item);
- });
+ if (!loginData.monitorSpecific[item]) loginData.monitorSpecific[item] = {};
+ loginData.monitorSpecific[item].forceMjpeg = $scope.forceMjpeg.value;
- $scope.monfunc.mypromises.push(httpPromise);
- });
+ for (var m=0; m < $scope.monitors.length; m++) {
+ if ($scope.monitors[m].Monitor.Id == item) {
+ $scope.monitors[m].Monitor.forceMjpeg = $scope.forceMjpeg.value;
+ break;
+ }
+ }
- $q.all($scope.monfunc.mypromises).then(function (e) {
- $ionicLoading.hide();
- // if there's a failed ID, an error has occurred
- if ($scope.monfunc.myfailedIds.length != 0) {
+
+
+ if (oldValues.myfunc != $scope.monfunc.myfunc || oldValues.myenabled != isEnabled) {
+ // lets do HTTP requests only if stuff changes
+ var apiMon = loginData.apiurl + "/monitors/" + item + ".json?"+$rootScope.authSession;
+ NVR.debug("MonitorCtrl: URLs for changeConfig save:" + apiMon);
+
+ var data = {};
+ if ($scope.monfunc.myfunc) data['Monitor[Function]'] = $scope.monfunc.myfunc;
+ if (isEnabled) data['Monitor[Enabled]'] = isEnabled;
+
$ionicLoading.show({
- template: $translate.instant('kErrorChangingMonitors') + ". Monitor IDs : " + $scope.monfunc.myfailedIds.toString(),
+ template: $translate.instant('kApplyingChanges') + "...",
noBackdrop: true,
- duration: 3000,
+ duration: zm.largeHttpTimeout,
});
- } else {
-
- doRefresh();
-
+
+ var httpPromise = $http({
+ url: apiMon,
+ method: 'post',
+ headers: {
+ 'Content-Type': 'application/x-www-form-urlencoded',
+ 'Accept': '*/*',
+ },
+ transformRequest: function (obj) {
+ var str = [];
+ for (var p in obj)
+ str.push(encodeURIComponent(p) + "=" +
+ encodeURIComponent(obj[p]));
+ var foo = str.join("&");
+ NVR.debug("MonitorCtrl: parmeters constructed: " + foo);
+ return foo;
+ },
+ data: data
+
+ })
+ .then(function () {
+ NVR.debug("MonitorCtrl: Not restarting ZM - Make sure you have the patch installed in MonitorsController.php or this won't work");
+ },
+ function (data, status, headers, config) {
+ NVR.debug("MonitorCtrl: Error changing monitor " + JSON.stringify(data));
+ $scope.monfunc.myfailedIds.push(item);
+ });
+
+ $scope.monfunc.mypromises.push(httpPromise);
+
+ } else {
+ NVR.debug ('Not invoing HTTP requests and no functional state changes detected');
+ }
+
+
+ }); //foreach
+
+ NVR.debug ('Updating forcedMjpeg status');
+ NVR.setLogin(loginData);
+
+ if ($scope.monfunc.mypromises.length) {
+ $q.all($scope.monfunc.mypromises).then(function (e) {
+ $ionicLoading.hide();
+ // if there's a failed ID, an error has occurred
+ if ($scope.monfunc.myfailedIds.length != 0) {
+ $ionicLoading.show({
+ template: $translate.instant('kErrorChangingMonitors') + ". Monitor IDs : " + $scope.monfunc.myfailedIds.toString(),
+ noBackdrop: true,
+ duration: 3000,
+ });
+ } else {
- }
- })
- .catch (noop);
+ doRefresh();
+
+
+ }
+ })
+ .catch (noop);
+
+ }
+
}
},
@@ -232,6 +285,17 @@ angular.module('zmApp.controllers')
// console.log("**VIEW ** Monitor Ctrl Loaded");
});
+
+ $scope.changeForceMjpeg = function (mid, value) {
+ NVR.debug ("change forceMjpeg for mid:"+mid+" to "+value);
+ var ld = NVR.getLogin();
+ if (!ld.monitorSpecific[mid]) ld.monitorSpecific[mid] = {};
+ ld.monitorSpecific[mid].forceMjpeg = value;
+ console.log ("UPDATE array:"+JSON.stringify(ld.monitorSpecific));
+ NVR.setLogin(ld);
+
+ };
+
//-------------------------------------------------------------------------
// Lets make sure we set screen dim properly as we enter
// The problem is we enter other states before we leave previous states
@@ -309,11 +373,7 @@ angular.module('zmApp.controllers')
});
- $scope.$on('$ionicView.leave', function () {
- // console.log("**VIEW ** Monitor Ctrl Left, force removing modal");
- if ($scope.modal) $scope.modal.remove();
- });
-
+
$scope.$on('$ionicView.unloaded', function () {
// console.log("**VIEW ** Monitor Ctrl Unloaded");
});
@@ -414,6 +474,14 @@ angular.module('zmApp.controllers')
if (!$scope.monitors.length) {
$scope.monitorLoadStatus = $translate.instant ('kNoMonitors');
+ } else {
+ var mid;
+ for (var i=0; i < $scope.monitors.length; i++) {
+ mid = $scope.monitors[i].Monitor.Id;
+ $scope.monitors[i].Monitor.forceMjpeg = (ld.monitorSpecific[mid] && ld.monitorSpecific[mid].forceMjpeg) ? true:false;
+ // console.log ('********** Monitor :'+mid+" MJPEG="+$scope.monitors[i].Monitor.forceMjpeg );
+
+ }
}
if (!$scope.monitors[0].Monitor_Status ) {
diff --git a/www/js/NVR.js b/www/js/NVR.js
index 2278ad54..196fe66e 100644
--- a/www/js/NVR.js
+++ b/www/js/NVR.js
@@ -227,7 +227,8 @@ angular.module('zmApp.controllers')
'montageHideFooter': false,
'httpCordovaNoEncode': false,
'currentZMGroupNames': [],
- 'unsupported': {}
+ 'unsupported': {},
+ 'monitorSpecific': {}
};
@@ -1762,6 +1763,10 @@ angular.module('zmApp.controllers')
if (typeof loginData.unsupported == 'undefined') {
loginData.unsupported = {};
}
+
+ if (typeof loginData.monitorSpecific == 'undefined') {
+ loginData.monitorSpecific = {};
+ }
diff --git a/www/lang/locale-en.json b/www/lang/locale-en.json
index 76fcd414..0410273d 100644
--- a/www/lang/locale-en.json
+++ b/www/lang/locale-en.json
@@ -143,6 +143,7 @@
"kFootage" :"Footage",
"kForceAlarmConfirm" :"Are you sure you want to force an alarm for Monitor:",
"kForcingAlarm" :"forcing alarm",
+ "kForceMjpeg" :"force MJPEG event playback",
"kFrame" :"frame",
"kFrameUpdate" :"Frame update",
"kFrames" :"frames",
diff --git a/www/templates/events-modal.html b/www/templates/events-modal.html
index 67a174aa..d4f23bbb 100644
--- a/www/templates/events-modal.html
+++ b/www/templates/events-modal.html
@@ -246,12 +246,12 @@
</li>
- <li ng-if="!isVideoLoading">
+ <li ng-if="!isVideoLoading && defaultVideo">
<a href="" ng-click="videoSeek(-10000)">
<i class="ion-arrow-return-left"></i> -10
</a>
</li>
- <li ng-if="!isVideoLoading">
+ <li ng-if="!isVideoLoading && defaultVideo">
<a href="" ng-click="videoSeek(10000)">
<i class="ion-arrow-return-right"></i> +10
</a>
diff --git a/www/templates/monitors.html b/www/templates/monitors.html
index 6d7651ca..4770b139 100644
--- a/www/templates/monitors.html
+++ b/www/templates/monitors.html
@@ -40,7 +40,11 @@
<i class="icon {{monitor.Monitor.char}}" style="color:grey;"></i>
</span>
</div>
+
+
+
<p>{{'kMode' | translate}} :{{monitor.Monitor.Function}}
+ <br /> {{'kForceMjpeg' | translate}}: {{monitor.Monitor.forceMjpeg}}
<br /> {{'kResolution' | translate}}: {{monitor.Monitor.Width}}*{{monitor.Monitor.Height}}
<br /> {{'kMaxFPS' | translate}}: {{monitor.Monitor.MaxFPS}}
<br /> {{'kAlarmMaxFPS' | translate}}:{{monitor.Monitor.AlarmMaxFPS}}
@@ -54,8 +58,11 @@
<br /> <br/>
</p>
+
+
+
<div style="float:right;">
- <a class="button button-small icon icon-left icon ion-gear-a" href="" ng-click="changeConfig(monitor.Monitor.Name, monitor.Monitor.Id,monitor.Monitor.Enabled,monitor.Monitor.Function);">{{'kConfiguration'
+ <a class="button button-small icon icon-left icon ion-gear-a" href="" ng-click="changeConfig(monitor.Monitor.Name, monitor.Monitor.Id,monitor.Monitor.Enabled,monitor.Monitor.Function, monitor.Monitor.forceMjpeg);">{{'kConfiguration'
| translate}}</a>
<a class="button button-small icon icon-left ion-calendar" ng-click="gotoEvents(monitor.Monitor.Id)">{{'kEventsCap'|translate}}</a>
<a class="button button-small icon icon-left ion-ios-eye" ng-click="openModal(monitor.Monitor.Id, monitor.Monitor.Controllable, monitor.Monitor.ControlId, monitor.Monitor.connKey, monitor)">{{'kLiveView'