diff options
| author | Pliable Pixels <pliablepixels@gmail.com> | 2018-04-18 17:34:56 -0400 |
|---|---|---|
| committer | Pliable Pixels <pliablepixels@gmail.com> | 2018-04-18 17:34:56 -0400 |
| commit | 99cd8bbe82ec968e6f28d24d98f32f96a554d44b (patch) | |
| tree | d9e895ae351f2b8679ad697a682539755c043052 | |
| parent | a092da7535099b4a618bbca6faaa4af5b2aa48e4 (diff) | |
#606 more montage cleanup
| -rw-r--r-- | www/js/EventModalCtrl.js | 22 | ||||
| -rw-r--r-- | www/js/MontageCtrl.js | 55 | ||||
| -rwxr-xr-x | www/js/app.js | 2 | ||||
| -rw-r--r-- | www/templates/events-modal.html | 2 | ||||
| -rw-r--r-- | www/templates/montage.html | 2 |
5 files changed, 60 insertions, 23 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); } diff --git a/www/templates/events-modal.html b/www/templates/events-modal.html index c838f128..7d59995b 100644 --- a/www/templates/events-modal.html +++ b/www/templates/events-modal.html @@ -11,12 +11,14 @@ <div style="width:100vw; height:100vh;"> <img ng-if="!liveFeedMid" image-spinner-src="{{loginData.streamingurl}}/nph-zms?source=event&mode=jpeg&event={{eventId}}&frame=1&replay={{currentStreamMode}}&rate=100&connkey={{connKey}}&scale={{singleImageQuality}}{{$root.authSession}}" ng-class="{'object-fit_cover':imageFit==false, 'object-fit_contain':imageFit==true}" on-double-tap="closeModal();" img-spinner-w="1024" img-spinner-h="768" + onload="imageLoaded()" /> <div ng-if="liveFeedMid"> <img image-spinner-src="{{loginData.streamingurl}}/nph-zms?mode=jpeg&monitor={{liveFeedMid}}&connkey={{connKey}}{{$root.authSession}}" ng-class="{'object-fit_cover':imageFit==false, 'object-fit_contain':imageFit==true}" on-double-tap="closeModal();" img-spinner-w="1024" img-spinner-h="768" + onload="imageLoaded()" /> <div class="events-range-modal-text"><span class="events-range-modal-warning-text">{{eventWarning}}</span> </div> </div> diff --git a/www/templates/montage.html b/www/templates/montage.html index 4f341c5a..5952ad9e 100644 --- a/www/templates/montage.html +++ b/www/templates/montage.html @@ -98,7 +98,7 @@ </figure>--> - <figure class="{{dragBorder}}" ng-if="monitor.Monitor.listDisplay!='noshow'"> + <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' && $root.authSession!=''"> |
