summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPliable Pixels <pliablepixels@gmail.com>2020-05-15 14:28:54 -0400
committerPliable Pixels <pliablepixels@gmail.com>2020-05-15 14:28:54 -0400
commitfd4c4ebb402a82fabd5ca3dcc870c3867e028b77 (patch)
treee7c9bd7f50408ed6d530c5a217971084f2bdb1e4
parente1f49312c58bf77044a05f6ecbc3839be046620a (diff)
make sure seek doesn't reset play
-rw-r--r--www/js/EventModalCtrl.js32
1 files changed, 30 insertions, 2 deletions
diff --git a/www/js/EventModalCtrl.js b/www/js/EventModalCtrl.js
index 228817c5..351253c8 100644
--- a/www/js/EventModalCtrl.js
+++ b/www/js/EventModalCtrl.js
@@ -33,7 +33,7 @@ angular.module('zmApp.controllers').controller('EventModalCtrl', ['$scope', '$ro
var eventId = 0;
var isSnapShotEnabled = false;
var playState = 'play';
-
+ var isSeeking = false;
$scope.useFilters = true;
@@ -255,7 +255,7 @@ angular.module('zmApp.controllers').controller('EventModalCtrl', ['$scope', '$ro
$scope.onPlaybackUpdate = function (rate) {
-
+
var ld = NVR.getLogin();
if (ld.videoPlaybackSpeed != rate) {
NVR.debug ("Update video rate to:"+rate);
@@ -271,8 +271,34 @@ angular.module('zmApp.controllers').controller('EventModalCtrl', ['$scope', '$ro
};
+ $scope.videoSeek = function (val) {
+
+ if (!handle) {
+ NVR.debug ("Can't seek. Video not playing");
+ return;
+ }
+ isSeeking = true;
+ //console.log ("You asked:"+val);
+ //console.log (handle.totalTime);
+ //console.log(handle.timeLeft);
+ var newTime = handle.currentTime + val;
+ if (newTime > handle.totalTime) newTime =handle.totalTime;
+ if (newTime < 0) newTime =0;
+ NVR.debug ("Skipping from " + handle.currentTime + " to "+ newTime);
+ handle.seekTime(newTime/1000,false);
+
+
+
+ };
+
$scope.onCanPlay = function () {
+ if (isSeeking) {
+ NVR.debug ("onCanPlay: triggered due to seek, skipping");
+ isSkipping = false;
+ return;
+ }
+
$ionicLoading.hide();
$scope.isVideoLoading = false;
NVR.debug("This video can be played");
@@ -1270,6 +1296,8 @@ angular.module('zmApp.controllers').controller('EventModalCtrl', ['$scope', '$ro
$scope.videoTime = function (s, c) {
// console.log ("VIDEO TIME WITH "+s+ " and "+c);
+ //console.log ("$currentTime="+c);
+ //console.log ("handle currentTime="+handle.currentTime);
var a, o;
if (NVR.getLogin().useLocalTimeZone) {
a = moment.tz(s, NVR.getTimeZoneNow()).tz(moment.tz.guess());