diff options
Diffstat (limited to 'www/js')
| -rw-r--r-- | www/js/EventModalCtrl.js | 22 | ||||
| -rw-r--r-- | www/js/MontageCtrl.js | 55 | ||||
| -rwxr-xr-x | www/js/app.js | 2 |
3 files changed, 57 insertions, 22 deletions
diff --git a/www/js/EventModalCtrl.js b/www/js/EventModalCtrl.js index 4f9a12ce..cd98ad52 100644 --- a/www/js/EventModalCtrl.js +++ b/www/js/EventModalCtrl.js @@ -18,6 +18,7 @@ angular.module('zmApp.controllers').controller('EventModalCtrl', ['$scope', '$ro var handle; var showLive = true; var broadcastHandles = []; + var isStreamPaused = true; var framearray = { @@ -440,10 +441,7 @@ angular.module('zmApp.controllers').controller('EventModalCtrl', ['$scope', '$ro function onPause() { - NVRDataModel.debug ("EventModal Pause: Deregistering broadcast handles"); - for (var i=0; i < broadcastHandles.length; i++) { - // broadcastHandles[i](); - } + broadcastHandles = []; @@ -451,7 +449,8 @@ angular.module('zmApp.controllers').controller('EventModalCtrl', ['$scope', '$ro // FIXME: Do I need to setAwake(false) here? $interval.cancel(eventQueryHandle); - NVRDataModel.log("EventModalCtrl: paused, killing timer"); + NVRDataModel.log("EventModalCtrl: paused"); + if ($scope.connKey) sendCommand(17, $scope.connKey); } @@ -904,6 +903,10 @@ angular.module('zmApp.controllers').controller('EventModalCtrl', ['$scope', '$ro $scope.isModalActive = true; }; + $scope.constructStream = function (monitor) { + + }; + $scope.scaleImage = function() { @@ -911,12 +914,17 @@ angular.module('zmApp.controllers').controller('EventModalCtrl', ['$scope', '$ro //console.log("Switching image style to " + $scope.imageFit); }; - $scope.$on('$ionicView.enter', function() + $scope.$on('$ionicView.beforeEnter', function() { //console.log (">>>>>>>>>>>>>>>>>>>> MODAL VIEW ENTER"); + isStreamPaused = true; }); + $scope.imageLoaded = function() { + isStreamPaused = false; + } + $scope.$on('modal.shown', function(e, m) { @@ -1105,7 +1113,7 @@ angular.module('zmApp.controllers').controller('EventModalCtrl', ['$scope', '$ro $scope.isModalActive = false; NVRDataModel.debug("Modal removed - killing connkey"); - sendCommand(17, $scope.connKey); + if ($scope.connKey) sendCommand(17, $scope.connKey); //$timeout (function(){NVRDataModel.stopNetwork("Modal removed inside EventModalCtrl");},400); // Execute action diff --git a/www/js/MontageCtrl.js b/www/js/MontageCtrl.js index 3e52842d..a2086e58 100644 --- a/www/js/MontageCtrl.js +++ b/www/js/MontageCtrl.js @@ -613,6 +613,7 @@ angular.module('zmApp.controllers') } $scope.cancelReorder = function () { + areStreamsStopped = false; $scope.modal.remove(); }; @@ -621,21 +622,34 @@ angular.module('zmApp.controllers') // redo packery as monitor status has changed // DOM may need reloading if you've hidden/unhidden stuff - $scope.MontageMonitors = $scope.copyMontage; - $scope.modal.remove(); - - $timeout(function () { - - draggies.forEach(function (drag) { - drag.destroy(); - }); + - pckry.reloadItems(); - draggies = []; - pckry.once('layoutComplete', savePackeryOrder); - pckry.layout(); + // The montage screens might change here so we need + // to destroy/re-create + + $scope.modal.remove(); + + + // assign new arrangement + $scope.MontageMonitors = $scope.copyMontage; + - }, 400); + // manually recreate connkeys in new copy + for (var i = 0; i < $scope.MontageMonitors.length; i++) { + $scope.MontageMonitors[i].Monitor.connKey = (Math.floor((Math.random() * 999999) + 1)).toString(); + } + areStreamsStopped = false; + $timeout(function () // after render + { + draggies.forEach(function (drag) { + drag.destroy(); + }); + + pckry.reloadItems(); + draggies = []; + pckry.once('layoutComplete', savePackeryOrder); + pckry.layout(); + }, zm.packeryTimer); }; @@ -699,6 +713,19 @@ angular.module('zmApp.controllers') } // make a copy of the current list and work on that // this is to avoid packery screw ups while you are hiding/unhiding + + if (simulStreaming) { + NVRDataModel.debug("Killing all streams in montage to save memory/nw..."); + areStreamsStopped = true; + $timeout (function () { + + // remove old monitors + for (var i = 0; i < $scope.MontageMonitors.length; i++) { + if ($scope.MontageMonitors[i].Monitor.listDisplay == 'show') NVRDataModel.killLiveStream($scope.MontageMonitors[i].Monitor.connKey, $scope.MontageMonitors[i].Monitor.controlURL); + } + }); + } + $scope.copyMontage = angular.copy($scope.MontageMonitors); $ionicModal.fromTemplateUrl('templates/reorder-modal.html', { scope: $scope, @@ -1645,7 +1672,7 @@ angular.module('zmApp.controllers') $scope.constructStream = function (monitor) { var stream; - if (areStreamsStopped) return ""; + if (areStreamsStopped || monitor.Monitor.listDisplay == 'noshow') return ""; stream = monitor.Monitor.streamingURL + "/nph-zms?mode=" + getMode() + "&monitor=" + monitor.Monitor.Id + diff --git a/www/js/app.js b/www/js/app.js index c8c5e763..07d467b3 100755 --- a/www/js/app.js +++ b/www/js/app.js @@ -168,7 +168,7 @@ angular.module('zmApp', [ angular.forEach(input, function (item) { if ((item.Monitor.Function != 'None') && - (item.Monitor.Enabled != '0') + (item.Monitor.Enabled != '0') ) { out.push(item); } |
