diff options
| author | Pliable Pixels <pliablepixels@gmail.com> | 2019-06-30 11:55:39 -0400 |
|---|---|---|
| committer | Pliable Pixels <pliablepixels@gmail.com> | 2019-06-30 11:55:39 -0400 |
| commit | 44a2a2905fc0e4e51c12540757b058fe4bab01ef (patch) | |
| tree | daf565426af590d8a8e26c821d1a9e85ac2a212d /www | |
| parent | 73aee14a9a7686ef909d2105afff56c8dc0a2b5f (diff) | |
#827 keep track of last time updated, don't close if <=300ms
Diffstat (limited to 'www')
| -rw-r--r-- | www/js/EventCtrl.js | 11 | ||||
| -rw-r--r-- | www/js/EventModalCtrl.js | 8 | ||||
| -rw-r--r-- | www/templates/events-modal.html | 4 |
3 files changed, 21 insertions, 2 deletions
diff --git a/www/js/EventCtrl.js b/www/js/EventCtrl.js index dc3c2453..d873e514 100644 --- a/www/js/EventCtrl.js +++ b/www/js/EventCtrl.js @@ -2543,6 +2543,7 @@ angular.module('zmApp.controllers') $scope.modalGraph = function () { + $scope.lastVideoStateTime = ''; $ionicModal.fromTemplateUrl('templates/events-modalgraph.html', { scope: $scope, // give ModalCtrl access to this scope animation: 'slide-in-up', @@ -2663,7 +2664,9 @@ angular.module('zmApp.controllers') if (ld.showLiveForInProgressEvents) { sl = 'enabled'; } - + $scope.lastVideoStateTime = { + 'time':'' + }; NVR.debug("Shall I follow the same monitor for prev/next?:"+$scope.followSameMonitor); $ionicModal.fromTemplateUrl('templates/events-modal.html', { scope: $scope, @@ -2690,6 +2693,12 @@ angular.module('zmApp.controllers') //-------------------------------------------------------- $scope.closeModal = function () { NVR.debug(">>>EventCtrl:Close & Destroy Modal"); + var diff = moment().diff($scope.lastVideoStateTime.time); + if (diff <= 300) { + NVR.debug ("Not closing model, time interval was only:"+diff+" ms"); + return; + } + NVR.setAwake(false); if ($scope.modal !== undefined) { $scope.modal.remove(); diff --git a/www/js/EventModalCtrl.js b/www/js/EventModalCtrl.js index e2f122f9..d5a410f9 100644 --- a/www/js/EventModalCtrl.js +++ b/www/js/EventModalCtrl.js @@ -194,6 +194,12 @@ angular.module('zmApp.controllers').controller('EventModalCtrl', ['$scope', '$ro }; + + $scope.onPlayerState = function (state) { + // parent scope + $scope.lastVideoStateTime.time = moment(); + }; + $scope.onPlayerReady = function (api) { // we need this timeout to avoid load interrupting @@ -1055,6 +1061,8 @@ angular.module('zmApp.controllers').controller('EventModalCtrl', ['$scope', '$ro $scope.alarm_images = []; $scope.snapshotFrameId = 1; currentStreamState = streamState.STOPPED; + + }); diff --git a/www/templates/events-modal.html b/www/templates/events-modal.html index 6fa1f094..34ec051b 100644 --- a/www/templates/events-modal.html +++ b/www/templates/events-modal.html @@ -69,7 +69,9 @@ <div on-swipe-left="onSwipeEvent(nextId,1)" on-swipe-right="onSwipeEvent(prevId,-1)" ng-style="{'height':$root.devHeight+'px', 'width':$root.devWidth+'px'}"> <videogular id="testaut_events_playwindow" vg-can-play="onCanPlay()" vg-native-fullscreen="videoObject.config.nativeFullScreen" - vg-player-ready="onPlayerReady($API)" vg-update-playback="onPlaybackUpdate($playBack)" + vg-player-ready="onPlayerReady($API)" + vg-update-state="onPlayerState($state)" + vg-update-playback="onPlaybackUpdate($playBack)" vg-plays-inline="videoObject.config.playsInline" vg-theme="videoObject.config.theme" vg-complete="playbackFinished()" on-double-tap="closeModal();" vg-autoplay="videoObject.config.autoPlay" vg-responsive="videoObject.config.responsive" vg-update-time="videoTime(event.Event.StartTime,$currentTime)" vg-error="onVideoError($event)"> |
