summaryrefslogtreecommitdiff
path: root/www
diff options
context:
space:
mode:
Diffstat (limited to 'www')
-rwxr-xr-xwww/js/DataModel.js34
-rw-r--r--www/js/MonitorCtrl.js3
-rw-r--r--www/js/MonitorModalCtrl.js6
-rw-r--r--www/js/MontageCtrl.js17
-rw-r--r--www/js/MontageHistoryCtrl.js13
-rw-r--r--www/templates/montage.html7
6 files changed, 43 insertions, 37 deletions
diff --git a/www/js/DataModel.js b/www/js/DataModel.js
index e6b102cb..1fda628c 100755
--- a/www/js/DataModel.js
+++ b/www/js/DataModel.js
@@ -1531,22 +1531,24 @@ angular.module('zmApp.controllers')
return monitors;
},
- killLiveStream: function (mon) {
+ killLiveStream: function (ck,url) {
- var ck = mon.Monitor.connKey;
- // monitors[i].Monitor.mportControlURL = mportControlUrl;
- var url = mon.Monitor.mportControlURL;
+
+ // monitors[i].Monitor.mportControlURL = controlURL;
+ if (!url) url = loginData.url;
+ // var url = mon.Monitor.mportControlURL;
// console.log (JSON.stringify(mon));
// return;
- debug ("Killing live stream ck:"+ck);
+
var myauthtoken = $rootScope.authSession.replace("&auth=", "");
var req = url+'/index.php';
req = req + "?view=request&request=stream";
req = req + "&connkey="+ck;
req = req + "&auth="+myauthtoken;
req = req + "&command=1";
- debug ("Kill command:"+req);
+
+ debug ("DataModel: Killing live stream ck:"+ck+ " with:"+req);
$http.get(req)
.then (
function (s) {
@@ -1557,18 +1559,18 @@ angular.module('zmApp.controllers')
},
- killStream: function (ck) {
+ /*killStream: function (ck) {
debug ("Killing connKey: "+ck);
var myauthtoken = $rootScope.authSession.replace("&auth=", "");
var req = $http(
{
method: 'POST',
- /*timeout: 15000,*/
+
url: loginData.url + '/index.php',
headers:
{
'Content-Type': 'application/x-www-form-urlencoded',
- //'Accept': '*/*',
+ ,
},
transformRequest: function(obj)
{
@@ -1599,7 +1601,7 @@ angular.module('zmApp.controllers')
});
- },
+ },*/
regenConnKeys: function () {
@@ -1634,7 +1636,7 @@ angular.module('zmApp.controllers')
getZmsMultiPortSupport()
.then(function (zmsPort) {
- var mportControlUrl = "";
+ var controlURL = "";
debug ("ZMS Multiport reported: "+zmsPort);
debug ("Monitor URL to fetch is:"+myurl);
@@ -1731,7 +1733,7 @@ angular.module('zmApp.controllers')
baseurl = st;
- mportControlUrl =st;
+ controlURL =st;
st += (s.path ? s.path : p.path);
streamingurl += (s.path ? s.path : p.path);
@@ -1743,7 +1745,7 @@ angular.module('zmApp.controllers')
monitors[i].Monitor.streamingURL = st;
monitors[i].Monitor.baseURL = baseurl;
- monitors[i].Monitor.mportControlURL = mportControlUrl;
+ monitors[i].Monitor.controlURL = controlURL;
//console.log ("** Streaming="+st+" **base="+baseurl);
// starting 1.30 we have fid=xxx mode to return images
monitors[i].Monitor.imageMode = (versionCompare($rootScope.apiVersion, "1.30") == -1) ? "path" : "fid";
@@ -1773,14 +1775,14 @@ angular.module('zmApp.controllers')
var sport2 = parseInt(zmsPort) + parseInt(monitors[i].Monitor.Id);
st2 = st2 + ':'+sport2;
- mportControlUrl = st2;
+ controlURL = st2;
if (p2.path) st2 += p2.path;
- if (p3.path) mportControlUrl +=p3.path;
+ if (p3.path) controlURL +=p3.path;
}
monitors[i].Monitor.streamingURL = st2;
- monitors[i].Monitor.mportControlURL = mportControlUrl;
+ monitors[i].Monitor.controlURL = controlURL;
//debug ("Streaming URL for Monitor " + monitors[i].Monitor.Id + " is " + monitors[i].Monitor.streamingURL );
//console.log ("NO SERVER MATCH CONSTRUCTED STREAMING PATH="+st2);
monitors[i].Monitor.baseURL = loginData.url;
diff --git a/www/js/MonitorCtrl.js b/www/js/MonitorCtrl.js
index eca22d15..928a15b9 100644
--- a/www/js/MonitorCtrl.js
+++ b/www/js/MonitorCtrl.js
@@ -374,6 +374,7 @@ angular.module('zmApp.controllers')
NVRDataModel.debug("MonitorCtrl:Open Monitor Modal with monitor Id=" + mid +
" and Controllable:" + controllable + " with control ID:" + controlid);
+ $scope.controlURL = monitor.Monitor.controlURL;
$scope.monitor = monitor;
//console.log (">>>>>>>>>>>> MONITOR CRL " + $scope.monitor.
$scope.monitorId = mid;
@@ -402,7 +403,7 @@ angular.module('zmApp.controllers')
$scope.presetOn = false;
- $scope.connKey = (Math.floor((Math.random() * 999999) + 1)).toString();
+
$scope.isControllable = controllable;
$rootScope.modalRand = Math.floor(Math.random() * (999999 - 111111 + 1)) + 111111;
diff --git a/www/js/MonitorModalCtrl.js b/www/js/MonitorModalCtrl.js
index ff0368cd..887d3328 100644
--- a/www/js/MonitorModalCtrl.js
+++ b/www/js/MonitorModalCtrl.js
@@ -199,7 +199,7 @@ angular.module('zmApp.controllers').controller('MonitorModalCtrl', ['$scope', '$
NVRDataModel.debug("MonitorModalCtrl: Re-login detected, resetting everything & re-generating connkey");
//NVRDataModel.stopNetwork("MonitorModal-auth success");
- NVRDataModel.killStream($scope.connKey);
+ NVRDataModel.killLiveStream($scope.connKey, $scope.controlURL);
$scope.connKey = (Math.floor((Math.random() * 999999) + 1)).toString();
});
@@ -266,7 +266,7 @@ angular.module('zmApp.controllers').controller('MonitorModalCtrl', ['$scope', '$
$interval.cancel(cycleHandle);
NVRDataModel.debug("Killing single stream...");
- NVRDataModel.killStream($scope.connKey);
+ NVRDataModel.killLiveStream($scope.connKey, $scope.controlURL);
// $interval.cancel(modalIntervalHandle);
// FIXME: Do I need to setAwake(false) here?
@@ -1172,7 +1172,7 @@ angular.module('zmApp.controllers').controller('MonitorModalCtrl', ['$scope', '$
$scope.isModalActive = false;
NVRDataModel.debug("Single monitor exited, killing stream");
- NVRDataModel.killStream($scope.connKey);
+ NVRDataModel.killLiveStream($scope.connKey, $scope.controlURL);
diff --git a/www/js/MontageCtrl.js b/www/js/MontageCtrl.js
index 8c1ab309..d0afd358 100644
--- a/www/js/MontageCtrl.js
+++ b/www/js/MontageCtrl.js
@@ -1123,11 +1123,12 @@ angular.module('zmApp.controllers')
if (simulStreaming=='1') {
NVRDataModel.debug ("Killing all streams in montage to save memory/nw...");
for (var i=0; i < $scope.MontageMonitors.length; i++) {
- NVRDataModel.killLiveStream($scope.MontageMonitors[i]);
+ NVRDataModel.killLiveStream($scope.MontageMonitors[i].Monitor.connKey, $scope.MontageMonitors[i].Monitor.controlURL);
}
}
+ $scope.controlURL = monitor.Monitor.controlURL;
openModal(mid, controllable, controlid, connKey, monitor);
@@ -1216,10 +1217,9 @@ angular.module('zmApp.controllers')
// single connkey is removed in monitorModal
NVRDataModel.debug ("Regenerating connkeys for montage...");
- for (var i=0; i < $scope.MontageMonitors.length; i++) {
- $scope.MontageMonitors[i].Monitor.connKey = (Math.floor((Math.random() * 999999) + 1)).toString();
- }
-
+ NVRDataModel.regenConnKeys();
+ $scope.monitors = NVRDataModel.getMonitorsNow();
+ $scope.MontageMonitors = angular.copy($scope.monitors);
$scope.modal.remove();
// we did the montage, so redo flow
$timeout (function() {initPackery();},zm.packeryTimer);
@@ -1339,7 +1339,7 @@ angular.module('zmApp.controllers')
if (!$scope.singleMonitorModalOpen && simulStreaming=='1') {
NVRDataModel.debug ("Killing all streams in montage to save memory/nw...");
for (i=0; i < $scope.MontageMonitors.length; i++) {
- NVRDataModel.killLiveStream($scope.MontageMonitors[i]);
+ NVRDataModel.killLiveStream($scope.MontageMonitors[i].Monitor.connKey, $scope.MontageMonitors[i].Monitor.controlURL);
}
}
@@ -1374,8 +1374,6 @@ angular.module('zmApp.controllers')
$scope.$on('$destroy', function() {
-
- console.log ("MONTAGE DESTROYED!!!!!!!!!!!!!!!!!");
});
$scope.$on('$ionicView.loaded', function()
@@ -1735,7 +1733,7 @@ angular.module('zmApp.controllers')
if (simulStreaming=='1') {
NVRDataModel.debug ("Killing all streams in montage to save memory/nw...");
for (var i=0; i < $scope.MontageMonitors.length; i++) {
- NVRDataModel.killLiveStream($scope.MontageMonitors[i]);
+ NVRDataModel.killLiveStream($scope.MontageMonitors[i].Monitor.connKey, $scope.MontageMonitors[i].Monitor.controlURL);
}
}
@@ -1746,7 +1744,6 @@ angular.module('zmApp.controllers')
$scope.constructStream = function(monitor) {
var stream = '';
-
if (!isKilled)
stream = monitor.Monitor.streamingURL +
"/nph-zms?mode="+getMode() +
diff --git a/www/js/MontageHistoryCtrl.js b/www/js/MontageHistoryCtrl.js
index 75fcdcc7..7c3c3d9c 100644
--- a/www/js/MontageHistoryCtrl.js
+++ b/www/js/MontageHistoryCtrl.js
@@ -227,7 +227,10 @@ angular.module('zmApp.controllers').controller('zmApp.MontageHistoryCtrl', ['$sc
$scope.dragBorder = "";
$scope.isDragabillyOn = false;
$ionicSideMenuDelegate.canDragContent(false);
- NVRDataModel.stopNetwork("MontageHistory-footerCollapse");
+
+ for (i=0; i < $scope.MontageMonitors.length; i++) {
+ NVRDataModel.killLiveStream($scope.MontageMonitors[i]);
+ }
NVRDataModel.regenConnKeys();
var ld = NVRDataModel.getLogin();
@@ -927,8 +930,12 @@ angular.module('zmApp.controllers').controller('zmApp.MontageHistoryCtrl', ['$sc
// thats why we are doing it beforeLeave
pckry.destroy();
window.removeEventListener("resize", orientationChanged, false);
- NVRDataModel.log("Forcing a window.stop() here");
- NVRDataModel.stopNetwork("MontageHistory-beforeLeave");
+ //NVRDataModel.log("Forcing a window.stop() here");
+ //NVRDataModel.stopNetwork("MontageHistory-beforeLeave");
+
+ for (i=0; i < $scope.MontageMonitors.length; i++) {
+ NVRDataModel.killLiveStream($scope.MontageMonitors[i]);
+ }
});
$scope.$on('$ionicView.unloaded', function() {});
$scope.sliderChanged = function(dirn)
diff --git a/www/templates/montage.html b/www/templates/montage.html
index 1a0b56df..2434ae5a 100644
--- a/www/templates/montage.html
+++ b/www/templates/montage.html
@@ -101,23 +101,22 @@
<figure class="{{dragBorder}}" ng-show="monitor.Monitor.listDisplay!='noshow'">
<!--<div ng-if="!isModalActive" >-->
<!--<div ng-if="$root.authSession!='undefined' && !isBackground() && !areImagesLoading">-->
- <div ng-if="$root.authSession!='undefined' && !isBackground() ">
+ <div ng-if="$root.authSession!='undefined' && $root.authSession!=''">
<div ng-if = "!minimal" >
-
<img class="{{monitor.Monitor.selectStyle}}" id="img-{{$index}}" image-spinner-src="{{constructStream(monitor)}}" ng-click="!isDragabillyOn?openModal(monitor.Monitor.Id, monitor.Monitor.Controllable, monitor.Monitor.ControlId, monitor.Monitor.connKey,monitor):toggleSelectItem(monitor.Monitor.Id);" image-spinner-loader="lines" img-spinner-w="{{monitor.Monitor.Width}}" img-spinner-h="{{monitor.Monitor.Height}}" />
</div>
<div ng-if = "minimal">
- <img id="img-{{$index}}" image-spinner-src="{{monitor.Monitor.streamingURL}}/zms?mode={{getMode()}}&monitor={{monitor.Monitor.Id}}&scale={{LoginData.montageQuality}}{{$root.authSession}}&rand={{randToAvoidCacheMem}}{{appendConnKey(monitor.Monitor.connKey)}}" ng-click="!isDragabillyOn?openModal(monitor.Monitor.Id, monitor.Monitor.Controllable, monitor.Monitor.ControlId, monitor.Monitor.connKey,monitor):toggleSelectItem(monitor.Monitor.Id);" image-spinner-loader="lines" img-spinner-w="{{monitor.Monitor.Width}}" img-spinner-h="{{monitor.Monitor.Height}}" />
+ <img id="img-{{$index}}" image-spinner-src="{{constructStream(monitor)}}" ng-click="!isDragabillyOn?openModal(monitor.Monitor.Id, monitor.Monitor.Controllable, monitor.Monitor.ControlId, monitor.Monitor.connKey,monitor):toggleSelectItem(monitor.Monitor.Id);" image-spinner-loader="lines" img-spinner-w="{{monitor.Monitor.Width}}" img-spinner-h="{{monitor.Monitor.Height}}" />
</div>
</div>
<figcaption id="slowpulse" ng-class="monitor.Monitor.isAlarmed==true?'alarmed-figcaption animated infinite flash':'normal-figcaption'" >&nbsp;
-
+ {{monitor.Monitor.connKey}}&nbsp;
<span ng-if="monitor.Monitor.isStamp && isDragabillyOn"><i class="animated infinite flash ion-pin"></i>&nbsp;</span><i class="ion-ios-videocam"></i>&nbsp;
{{monitor.Monitor.Name}}&nbsp;<i ng-if="$root.runMode!='lowbw'" style="{{monitor.Monitor.alarmState}}" class="ion-record"></i>&nbsp;