Skip to content

Commit

Permalink
#827 keep track of last time updated, don't close if <=300ms
Browse files Browse the repository at this point in the history
  • Loading branch information
pliablepixels committed Jun 30, 2019
1 parent 9d7a3ea commit a8be95e
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 6 deletions.
2 changes: 1 addition & 1 deletion config.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<widget android-packageName="com.pliablepixels.zmninja_pro" id="com.pliablepixels.zmninja_pro" ios-CFBundleIdentifier="com.pliablepixels.zmninja-pro" version="1.3.064" xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget android-packageName="com.pliablepixels.zmninja_pro" id="com.pliablepixels.zmninja_pro" ios-CFBundleIdentifier="com.pliablepixels.zmninja-pro" version="1.3.065" xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>zmNinja</name>
<description>
High performance ZoneMinder client
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "zmninjapro",
"description": "Home security mobile app for ZoneMinder",
"version":"1.3.063",
"version": "1.3.063",
"displayName": "zmNinja",
"author": "Pliable Pixels",
"license": "custom see LICENSE.md",
Expand Down Expand Up @@ -133,7 +133,7 @@
"build": {
"artifactName": "${productName}-${version}-${os}-${arch}.${ext}",
"appImage": {
"systemIntegration":"ask"
"systemIntegration": "ask"
},
"appId": "com.pliablepixels.zmninjapro",
"productName": "zmninjapro",
Expand Down Expand Up @@ -192,4 +192,4 @@
]
}
}
}
}
11 changes: 10 additions & 1 deletion www/js/EventCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand 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,
Expand All @@ -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();
Expand Down
8 changes: 8 additions & 0 deletions www/js/EventModalCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -1055,6 +1061,8 @@ angular.module('zmApp.controllers').controller('EventModalCtrl', ['$scope', '$ro
$scope.alarm_images = [];
$scope.snapshotFrameId = 1;
currentStreamState = streamState.STOPPED;



});

Expand Down
4 changes: 3 additions & 1 deletion www/templates/events-modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -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)">
Expand Down

0 comments on commit a8be95e

Please sign in to comment.