Skip to content

Commit

Permalink
#1024 approximate save position for mp4
Browse files Browse the repository at this point in the history
  • Loading branch information
pliablepixels committed Dec 25, 2020
1 parent 7caf61e commit 472485c
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions www/js/EventModalCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,18 @@ angular.module('zmApp.controllers').controller('EventModalCtrl', ['$scope', '$ro
// Saves a snapshot of the monitor image to phone storage
//-----------------------------------------------------------------------

$scope.pauseAndPresentModal = function (onlyAlarms,eid) {
if (handle) {
handle.pause();
$scope.currentProgress.progress = handle.currentTime/1000;
//console.log ('CURREN PROGRESS='+$scope.currentProgress.progress);


}
$scope.saveEventImageWithPerms(false, currentEvent.Event.Id);

}

$scope.saveEventImageWithPerms = function (onlyAlarms,eid) {

if ($rootScope.platformOS != 'android') {
Expand Down Expand Up @@ -636,7 +648,7 @@ angular.module('zmApp.controllers').controller('EventModalCtrl', ['$scope', '$ro
if (resp && resp.data && resp.data.status)
$scope.currentProgress.progress = resp.data.status.progress;
else
$scope.currentProgress.progress = 100;
if (!handle) $scope.currentProgress.progress = 100;

// console.log ("STEP 0 progress is " + $scope.currentProgress.progress);
$scope.slides = [];
Expand All @@ -656,12 +668,21 @@ angular.module('zmApp.controllers').controller('EventModalCtrl', ['$scope', '$ro

// now lets get approx frame #

var totalTime = event.Event.Length;
var totalTime
if (handle) {
totalTime = handle.totalTime/1000
} else {
totalTime = event.Event.length;
}

var totalFrames = event.Event.Frames;


var myFrame = Math.round(totalFrames / totalTime * $scope.currentProgress.progress);

// console.log ("STEP 0: playback " + $scope.playbackURL + " total time " + totalTime + " frames " + totalFrames);
//console.log ('CURREN PROGRESS='+$scope.currentProgress.progress);
//console.log ('MYFRAME = '+myFrame);
//console.log ("STEP 0: playback " + $scope.playbackURL + " total time " + totalTime + " frames " + totalFrames);

if (myFrame > totalFrames) myFrame = totalFrames;

Expand Down Expand Up @@ -762,7 +783,7 @@ angular.module('zmApp.controllers').controller('EventModalCtrl', ['$scope', '$ro
var loginData = NVR.getLogin();

// for alarms only
if (onlyAlarms || ($scope.defaultVideo !== undefined && $scope.defaultVideo != ''))
if (onlyAlarms)
$scope.mycarousel.index = 1;

url = $scope.playbackURL + '/index.php?view=image&rand=' + $rootScope.rand +
Expand Down

0 comments on commit 472485c

Please sign in to comment.