From 4b39c23d4b817d05f99912df87c751566be4b0c2 Mon Sep 17 00:00:00 2001 From: Pliable Pixels Date: Fri, 1 Feb 2019 13:31:35 -0500 Subject: #775 take care of gapless and flipovers --- www/css/style.css | 9 +++ www/js/MontageHistoryCtrl.js | 134 ++++++++++++++++++++++++++++++++++--- www/templates/montage-history.html | 73 ++++++++++---------- 3 files changed, 172 insertions(+), 44 deletions(-) diff --git a/www/css/style.css b/www/css/style.css index 3c12a932..e8ba18c7 100644 --- a/www/css/style.css +++ b/www/css/style.css @@ -279,6 +279,7 @@ figcaption { white-space: nowrap; } + .normal-figcaption { background: rgba(0, 0, 0, 0.2); color: #FFF; @@ -311,6 +312,14 @@ figcaption { font-size: 80%; } +.normal-figheader-history { + background: rgba(0, 0, 0, 0.7); + color: #FFF; + opacity: 1; + font-size: 80%; + top:0; +} + .alarmed-figcaption { diff --git a/www/js/MontageHistoryCtrl.js b/www/js/MontageHistoryCtrl.js index d35994e5..9168ade3 100644 --- a/www/js/MontageHistoryCtrl.js +++ b/www/js/MontageHistoryCtrl.js @@ -264,12 +264,12 @@ angular.module('zmApp.controllers').controller('zmApp.MontageHistoryCtrl', ['$sc function getNextSetHistory() { // grab events that start on or after the time - apiurl = ld.apiurl + "/events/index/StartTime >=:" + TimeObjectFrom + "/AlarmFrames >=:" + (ld.enableAlarmCount ? ld.minAlarmCount : 0) + ".json?sort=StartTime&direction=desc"; + apiurl = ld.apiurl + "/events/index/StartTime >=:" + TimeObjectFrom + "/AlarmFrames >=:" + (ld.enableAlarmCount ? ld.minAlarmCount : 0) + ".json?sort=StartTime&direction=asc"; NVR.log("Grabbing history using: " + apiurl); // make sure there are no more than 5 active streams (noevent is ok) $scope.currentLimit = $scope.monLimit; //qHttp.get(apiurl) - console.log ("GETTING "+apiurl); + //console.log ("GETTING "+apiurl); $http({ method: 'get', url: apiurl @@ -861,21 +861,97 @@ angular.module('zmApp.controllers').controller('zmApp.MontageHistoryCtrl', ['$sc //console.log ("Switching orientation"); }; + + $scope.playbackFinished = function(m) { + + console.log ("******* VIDEO PLAYBACK FINISHED FOR MONITOR:"+m.Monitor.Id+ " EVENT:" +m.Monitor.eid); + getNextEvent( m.Monitor.eid) + .then (function (success) { + NVR.debug ("next event for monitor:"+m.Monitor.Id+" is "+success.eid); + + if (success.eid != "null" && success.eid != m.Monitor.eid) { + + var videoURL= m.Monitor.baseURL + "/index.php?view=view_video&eid=" + success.eid; + + if ($rootScope.authSession != 'undefined') videoURL += $rootScope.authSession; + if ($rootScope.basicAuthToken) videoURL = videoURL + "&basicauth=" + $rootScope.basicAuthToken; + + m.Monitor.videoObject = { + config: { + autoPlay: true, + responsive: false, + nativeControls: false, + nativeFullScreen: true, + + playsInline: true, + sources: [{ + src: $sce.trustAsResourceUrl(videoURL), + type: "video/mp4" + } + + ], + + theme: "lib/videogular-themes-default/videogular.css", + cuepoints: { + theme: { + url: "lib/videogular-cuepoints/cuepoints.css" + }, + points: [], + } + } + }; + + + + + // m.Monitor.videoObject.config.sources[0].src = $sce.trustAsResourceUrl(videoURL); + + var element = angular.element(document.getElementById(m.Monitor.Id + "-timeline")); + element.removeClass('animated flipInX'); + element.addClass('animated flipOutX'); + + $timeout (function () { + + element.removeClass('animated flipOutX'); + element.addClass('animated flipInX'); + + NVR.debug ("--->updating videoURL for mid="+m.Monitor.Id+ "to:"+videoURL); + m.Monitor.eid = success.eid; + m.Monitor.StartTime = success.stime; + $timeout (function () { + m.Monitor.handle.play(); + }); + + },700); + + + + + // m.Monitor.handle.play(); + + + } + + }); + }; + + $scope.onVideoError = function (event) { $ionicLoading.hide(); NVR.debug("player reported a video error:" + JSON.stringify(event)); }; - $scope.onPlayerReady = function (api) { + $scope.onPlayerReady = function (api,m) { // we need this timeout to avoid load interrupting // play -- I suppose its an angular digest foo thing - //console.log ("*********** ON PLAY READY"); - var handle; + //console.log ("*********** ON PLAY READY") + m.Monitor.handle = api; + NVR.debug("On Play Ready invoked"); - handle = api; - handle.mediaElement.attr("playsinline", ""); + + m.Monitor.handle.mediaElement.attr("playsinline", ""); $ionicLoading.show({ template: "
" + $translate.instant('kVideoLoading') + "...", @@ -883,9 +959,9 @@ angular.module('zmApp.controllers').controller('zmApp.MontageHistoryCtrl', ['$sc }); NVR.debug("Player is ready"); $timeout(function () { - handle.pause(); - handle.setPlayback(NVR.getLogin().videoPlaybackSpeed); - handle.play(); + m.Monitor.handle.pause(); + m.Monitor.handle.setPlayback(NVR.getLogin().videoPlaybackSpeed); + m.Monitor.handle.play(); NVR.debug("*** Invoking play"); playerReady = true; @@ -894,6 +970,44 @@ angular.module('zmApp.controllers').controller('zmApp.MontageHistoryCtrl', ['$sc // window.stop(); }; + function getNextEvent(eid) { + + + var d = $q.defer(); + // now get event details to show alarm frames + var loginData = NVR.getLogin(); + var myurl = loginData.apiurl + '/events/' + eid + ".json"; + + var r = { + eid:"", + 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; + d.resolve(r); + } + else { + 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); + + } //--------------------------------------------------------------------- // In Android, the app runs full steam while in background mode // while in iOS it gets suspended unless you ask for specific resources diff --git a/www/templates/montage-history.html b/www/templates/montage-history.html index 791932ae..c15fe7d9 100644 --- a/www/templates/montage-history.html +++ b/www/templates/montage-history.html @@ -34,13 +34,31 @@ data-item-size="{{monitor.Monitor.gridScale}}" data-item-listdisplay="{{monitor.Monitor.listDisplay}}">
+ +
+   + + +   + +   + + {{monitor.Monitor.Name}}  +
[{{monitor.Monitor.eid}}] + {{prettifyDateTimeFirst(monitor.Monitor.eventUrlTime)}} + ({{humanizeTime(monitor.Monitor.eventUrlTime)}})  +
+
- + @@ -60,22 +78,7 @@ -
- -   [{{monitor.Monitor.eventType}}] - - -   - -   - - {{monitor.Monitor.Name}}  -
[{{monitor.Monitor.eid}}] - {{prettifyDateTimeFirst(monitor.Monitor.eventUrlTime)}} - ({{humanizeTime(monitor.Monitor.eventUrlTime)}})  -
-
+
@@ -86,26 +89,28 @@
+ +
+   + +   + +   + + {{monitor.Monitor.Name}}  +
[{{monitor.Monitor.eid}}] + {{prettifyDateTimeFirst(monitor.Monitor.eventUrlTime)}} + ({{humanizeTime(monitor.Monitor.eventUrlTime)}})  +
+
+ -
- -   [[ {{monitor.Monitor.eventType}}]] - -   - -   - - {{monitor.Monitor.Name}}  -
[{{monitor.Monitor.eid}}] - {{prettifyDateTimeFirst(monitor.Monitor.eventUrlTime)}} - ({{humanizeTime(monitor.Monitor.eventUrlTime)}})  -
-
+
-- cgit v1.2.3