diff options
| author | Pliable Pixels <pliablepixels@gmail.com> | 2019-02-02 09:10:10 -0500 |
|---|---|---|
| committer | Pliable Pixels <pliablepixels@gmail.com> | 2019-02-02 09:10:10 -0500 |
| commit | 35538f60bedeba2e7dc5262ea1315e23d4394ef8 (patch) | |
| tree | 7333dee6c03492e3e8ba623d5a151b2584eea974 /www | |
| parent | 60a801ac73303888ece6f5da640afef123e6ac89 (diff) | |
#775 - fix start time logic and also allow swipe left and right for videos
Diffstat (limited to 'www')
| -rw-r--r-- | www/js/MontageHistoryCtrl.js | 60 | ||||
| -rw-r--r-- | www/templates/montage-history.html | 2 |
2 files changed, 41 insertions, 21 deletions
diff --git a/www/js/MontageHistoryCtrl.js b/www/js/MontageHistoryCtrl.js index b9d708b9..0c8bf2a0 100644 --- a/www/js/MontageHistoryCtrl.js +++ b/www/js/MontageHistoryCtrl.js @@ -863,10 +863,15 @@ angular.module('zmApp.controllers').controller('zmApp.MontageHistoryCtrl', ['$sc }; - $scope.playbackFinished = function(m) { + $scope.skipVideo= function (m,d) { + + $scope.playbackFinished(m,d); + }; + + $scope.playbackFinished = function(m,d) { console.log ("******* VIDEO PLAYBACK FINISHED FOR MONITOR:"+m.Monitor.Id+ " EVENT:" +m.Monitor.eid); - getNextEvent( m.Monitor.eid) + getNextEvent( m.Monitor.eid,d) .then (function (success) { NVR.debug ("next event for monitor:"+m.Monitor.Id+" is "+success.eid); @@ -975,41 +980,56 @@ angular.module('zmApp.controllers').controller('zmApp.MontageHistoryCtrl', ['$sc // window.stop(); }; - function getNextEvent(eid) { + function getNextEvent(eid,dirn) { - var d = $q.defer(); // now get event details to show alarm frames var loginData = NVR.getLogin(); var myurl = loginData.apiurl + '/events/' + eid + ".json"; + //console.log (">> 1: getting: "+myurl); var r = { eid:"", - stime:"", + stime:"" }; + $http.get(myurl) - .then( function (success) { - if (success.data.event.Event.NextOfMonitor) { - r.eid = success.data.event.Event.NextOfMonitor; - r.stime = success.data.event.Event.StartTime; + .then( function (succ) { + //console.log (JSON.stringify(succ)); + var target = (dirn == -1) ? succ.data.event.Event.PrevOfMonitor: succ.data.event.Event.NextOfMonitor; + //console.log (">> 2: dirn: "+dirn+" target: "+target); + if (!target) target = 'null'; // fallback incase in some API this doesn't exist; + if (target == 'null') { + r.eid = "-1"; + r.stime = "-1"; d.resolve(r); + return d.promise; } else { + r.eid = target; + // now get time of that event + myurl = loginData.apiurl+'/events/'+target + '.json'; + $http.get (myurl) + .then (function (succ) { + r.stime = succ.data.event.Event.StartTime; + d.resolve(r); + return d.promise; + },function (err) { + NVR.debug ("Error getting start time of neighbor:"+JSON.stringify(err)); + r.stime = "-1"; + d.resolve(r); + return d.promise; + }); + return d.promise; + } + }, function (err) { + NVR.debug ("Error getting neighbors:"+JSON.stringify(err)); r.eid = "-1"; r.stime = "-1"; d.resolve(r); - } - return (d.promise); - }, - function (err) { - NVR.debug ("Error geting neighbors:"+JSON.stringify(err)); - r.eid = "-1"; - r.stime = "-1"; - d.resolve(r); - return (d.promise); - }); - + return d.promise; + }); return (d.promise); } diff --git a/www/templates/montage-history.html b/www/templates/montage-history.html index f93908b7..6ef06b75 100644 --- a/www/templates/montage-history.html +++ b/www/templates/montage-history.html @@ -32,7 +32,7 @@ <div ng-if="monitor.Monitor.eventType == 'video'"> <div class="grid-item grid-item-{{monitor.Monitor.gridScale}} " data-item-id="{{monitor.Monitor.Id}}" data-item-size="{{monitor.Monitor.gridScale}}" data-item-listdisplay="{{monitor.Monitor.listDisplay}}"> - <figure height="{{Monitor.monitor.height}}" width="{{Monitor.monitor.width}}" class="{{dragBorder}}" ng-if=" monitor.Monitor.listDisplay!='noshow'"> + <figure height="{{Monitor.monitor.height}}" width="{{Monitor.monitor.width}}" class="{{dragBorder}}" ng-if=" monitor.Monitor.listDisplay!='noshow'" on-swipe-left="skipVideo(monitor, 1)" on-swipe-right="skipVideo(monitor, -1)"> <figcaption class="normal-figheader-history" > |
