summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpliablepixels <pliablepixels@gmail.com>2016-02-19 14:00:12 -0500
committerpliablepixels <pliablepixels@gmail.com>2016-02-19 14:00:12 -0500
commite5562ce9175ee05e55f1881f243cdc0f463a8f39 (patch)
tree09e83ffbb3c82b2098cd860b3a67ecc90227a19d
parent4758a3f7ec300136703e1111c1e4fa083501e057 (diff)
#164 - seems to work well now
Former-commit-id: 861e95fb8e5b9ffa0c7b16507053e5a61f0286f6
-rw-r--r--www/js/EventModalCtrl.js164
-rw-r--r--www/templates/events-modal.html21
2 files changed, 123 insertions, 62 deletions
diff --git a/www/js/EventModalCtrl.js b/www/js/EventModalCtrl.js
index 30d8df0a..4b51dba6 100644
--- a/www/js/EventModalCtrl.js
+++ b/www/js/EventModalCtrl.js
@@ -4,13 +4,7 @@
/* global saveAs, cordova,StatusBar,angular,console,ionic, moment */
-/* FIXME for nph events
-a) timers
-b) sliders
-c) photo save
-d) gapless
-*/
angular.module('zmApp.controllers').controller('EventModalCtrl', ['$scope', '$rootScope', 'zm', 'ZMDataModel', '$ionicSideMenuDelegate', '$timeout', '$interval', '$ionicModal', '$ionicLoading', '$http', '$state', '$stateParams', '$ionicHistory', '$ionicScrollDelegate', '$q', '$sce', 'carouselUtils', '$ionicPopup', function ($scope, $rootScope, zm, ZMDataModel, $ionicSideMenuDelegate, $timeout, $interval, $ionicModal, $ionicLoading, $http, $state, $stateParams, $ionicHistory, $ionicScrollDelegate, $q, $sce, carouselUtils, $ionicPopup) {
@@ -22,13 +16,6 @@ angular.module('zmApp.controllers').controller('EventModalCtrl', ['$scope', '$ro
$scope.loginData = ZMDataModel.getLogin();
- // $scope.currentEventLength = parseFloat($scope.currentEvent.Event.Length);
- //console.log ("Current event duration is " + $scope.currentEventLength);
-
-
- //$scope.currentEventLength = $scope.event.Event.Length;
-
-
var eventImageDigits = 5; // failsafe
$scope.currentProgress = 0;
ZMDataModel.getKeyConfigParams(0)
@@ -66,8 +53,8 @@ angular.module('zmApp.controllers').controller('EventModalCtrl', ['$scope', '$ro
});
var ld = ZMDataModel.getLogin();
- $scope.streamMode = ld.useNphZms ? "jpeg" : "single";
- $scope.currentStreamMode = 'single';
+
+ $scope.currentStreamMode = ld.gapless ? 'gapless':'single';
ZMDataModel.zmLog("Using stream mode " + $scope.currentStreamMode);
ZMDataModel.zmDebug ("EventModalCtrl called from " + $ionicHistory.currentStateName());
@@ -252,11 +239,14 @@ angular.module('zmApp.controllers').controller('EventModalCtrl', ['$scope', '$ro
if ($scope.currentProgress > $scope.currentEventDuration) $scope.currentProgress = $scope.currentEventDuration;
$scope.progressText = "At " + $scope.currentProgress + "s of " + $scope.currentEventDuration+"s";
- if (Math.floor(resp.status.progress) >=$scope.currentEventDuration)
+ // lets not do this and use zms to move forward or back
+ // as this code conflicts with fast rev etc
+ //if (Math.floor(resp.status.progress) >=$scope.currentEventDuration)
+ if (0)
{
ZMDataModel.zmLog ("Reached end of event " + $scope.eventId);
-
+ // lets use zms here as this conflicts with fast rev etc
if (loginData.gapless)
{
@@ -310,14 +300,14 @@ angular.module('zmApp.controllers').controller('EventModalCtrl', ['$scope', '$ro
}
- else // not gapless
+ else
{
// keep timer on if its switched to gapless
eventQueryHandle = $timeout (function(){checkEvent();}, zm.eventPlaybackQuery);
}
}
- else // not at end of playback
+ else // if (0)
{
console.log ("all good, scheduling next iteration after " + zm.eventPlaybackQuery);
//$timeout (checkEvent(), zm.eventPlaybackQuery);
@@ -339,8 +329,7 @@ angular.module('zmApp.controllers').controller('EventModalCtrl', ['$scope', '$ro
else
{
- ZMDataModel.zmDebug("Hmm I found an error " + JSON.stringify(resp) +
-"so I can't tell if the playback ended");
+ ZMDataModel.zmDebug("Hmm I found an error " + JSON.stringify(resp));
$scope.connKey = (Math.floor((Math.random() * 999999) + 1)).toString();
$timeout( function () { sendCommand('14',$scope.connKey, '&offset='+$scope.currentProgress);},500);
ZMDataModel.zmDebug ("so I'm regenerating Connkey to " + $scope.connKey);
@@ -768,43 +757,86 @@ angular.module('zmApp.controllers').controller('EventModalCtrl', ['$scope', '$ro
// Playback speed adjuster
$scope.adjustSpeed = function (val) {
- switch (val) {
-
- case "super":
- $scope.eventSpeed = 20 / $scope.event.Event.Frames;
- carouselUtils.setDuration($scope.eventSpeed);
- break;
- case "normal":
- $scope.eventSpeed = $scope.event.Event.Length / $scope.event.Event.Frames;
- //$scope.eventSpeed = 5;
- carouselUtils.setDuration($scope.eventSpeed);
-
- break;
- case "faster":
- $scope.eventSpeed = $scope.eventSpeed / 2;
- if ($scope.eventSpeed < 20 / $scope.event.Event.Frames)
- $scope.eventSpeed = 10 / $scope.event.Event.Frames;
- carouselUtils.setDuration($scope.eventSpeed);
- break;
- case "slower":
- $scope.eventSpeed = $scope.eventSpeed * 2;
- carouselUtils.setDuration($scope.eventSpeed);
-
- break;
- default:
-
+
+ var ld = ZMDataModel.getLogin();
+
+ if (ld.useNphZmsForEvents)
+ {
+
+ var cmd;
+ $scope.isPaused = false;
+ switch (val)
+ {
+ case 'ff': cmd= 4; break;
+ case 'fr': cmd= 7; break;
+ case 'np': cmd= 2; break;
+ case 'p' : cmd= 1; $scope.isPaused = true; break;
+ default : cmd=0;
+ }
+
+ $ionicLoading.show({
+ template: "please wait...",
+ noBackdrop: true,
+ duration: zm.httpTimeout
+ });
+
+ sendCommand(cmd, $scope.connKey)
+ .then (function (success)
+ {
+ $ionicLoading.hide();
+ },
+ function (err)
+ {
+ $ionicLoading.hide();
+ ZMDataModel.zmDebug ("Error in adjust speed: " + JSON.stringify(err));
+ }
+ );
+
+
}
- ZMDataModel.zmDebug("Set playback speed to " + $scope.eventSpeed);
+
+ else // not using nph
+ {
+
+ switch (val) {
+
+ case "super":
+ $scope.eventSpeed = 20 / $scope.event.Event.Frames;
+ carouselUtils.setDuration($scope.eventSpeed);
+ break;
+ case "normal":
+ $scope.eventSpeed = $scope.event.Event.Length / $scope.event.Event.Frames;
+ //$scope.eventSpeed = 5;
+ carouselUtils.setDuration($scope.eventSpeed);
+
+ break;
+ case "faster":
+ $scope.eventSpeed = $scope.eventSpeed / 2;
+ if ($scope.eventSpeed < 20 / $scope.event.Event.Frames)
+ $scope.eventSpeed = 10 / $scope.event.Event.Frames;
+ carouselUtils.setDuration($scope.eventSpeed);
+ break;
+ case "slower":
+ $scope.eventSpeed = $scope.eventSpeed * 2;
+ carouselUtils.setDuration($scope.eventSpeed);
+
+ break;
+ default:
- $ionicLoading.show({
- template: 'playback interval: ' + $scope.eventSpeed.toFixed(3) + "ms",
- animation: 'fade-in',
- showBackdrop: false,
- duration: 1500,
- maxWidth: 300,
- showDelay: 0
- });
+ }
+ ZMDataModel.zmDebug("Set playback speed to " + $scope.eventSpeed);
+
+ $ionicLoading.show({
+ template: 'playback interval: ' + $scope.eventSpeed.toFixed(3) + "ms",
+ animation: 'fade-in',
+ showBackdrop: false,
+ duration: 1500,
+ maxWidth: 300,
+ showDelay: 0
+ });
+ }
+
};
@@ -814,6 +846,14 @@ angular.module('zmApp.controllers').controller('EventModalCtrl', ['$scope', '$ro
// console.log(">>>>>>>>>>>>>>GAPLESS TOGGLE INSIDE MODAL");
$scope.loginData.gapless = !$scope.loginData.gapless;
ZMDataModel.setLogin($scope.loginData);
+
+ ZMDataModel.zmDebug("EventModalCtrl: gapless has changed resetting everything & re-generating connkey");
+ window.stop();
+ $scope.connKey = (Math.floor((Math.random() * 999999) + 1)).toString();
+ $timeout( function () { sendCommand('14',$scope.connKey, '&offset='+$scope.currentProgress);},500);
+ $timeout.cancel(eventQueryHandle);
+ eventQueryHandle = $timeout (function(){checkEvent();}, zm.eventPlaybackQuery);
+
};
@@ -909,8 +949,18 @@ angular.module('zmApp.controllers').controller('EventModalCtrl', ['$scope', '$ro
$scope.jumpToEvent = function (eid, dirn) {
// console.log("jumptoevent");
-
- jumpToEvent(eid, dirn);
+ var ld = ZMDataModel.getLogin();
+ if (ld.useNphZmsForEvents)
+ {
+ ZMDataModel.zmLog("using zms to move ");
+ jumpToEventZms($scope.connKey, dirn);
+ // sendCommand ( dirn==1?'13':'12',$scope.connKey);
+
+ }
+ else
+ {
+ jumpToEvent(eid, dirn);
+ }
};
diff --git a/www/templates/events-modal.html b/www/templates/events-modal.html
index 11ef21dc..e3a3e495 100644
--- a/www/templates/events-modal.html
+++ b/www/templates/events-modal.html
@@ -43,7 +43,7 @@
<div style="color:white">connkey:{{connKey}}</div>
<div style="width:100vw; height:100vh" >
- <img ng-click="togglePause()" image-spinner-src="{{loginData.streamingurl}}/nph-zms?source=event&mode=jpeg&event={{eventId}}&frame=1&replay=single&rate=100&connkey={{connKey}}&scale={{loginData.singleImageQuality}}{{$root.authSession}}" ng-class="{'object-fit_cover':imageFit==false, 'object-fit_contain':imageFit==true}"/>
+ <img ng-click="togglePause()" image-spinner-src="{{loginData.streamingurl}}/nph-zms?source=event&mode=jpeg&event={{eventId}}&frame=1&replay={{currentStreamMode}}&rate=100&connkey={{connKey}}&scale={{loginData.singleImageQuality}}{{$root.authSession}}" ng-class="{'object-fit_cover':imageFit==false, 'object-fit_contain':imageFit==true}"/>
<div ng-if="isPaused" style="position:absolute; top:50%; left:50%;white-space:nowrap;overflow:hidden;z-index:999"
class="header-paused">
@@ -97,7 +97,7 @@
</ion-modal-view>
-<nav mfb-menu position="tr" effect="zoomin" label="collapse" active-icon="ion-chevron-up" resting-icon="ion-chevron-down" toggling-method="click">
+<nav mfb-menu position="tr" effect="zoomin" label="collapse" active-icon="ion-chevron-up" resting-icon="ion-chevron-down" toggling-method="click">
<a mfb-button icon="ion-arrow-right-c" label="next event" ng-click="jumpToEvent(nextId,1);"></a>
<a mfb-button icon="ion-arrow-left-c" label="prev. event" ng-click="jumpToEvent(prevId,-1);"></a>
@@ -108,15 +108,26 @@
</nav>
-<nav mfb-menu position="br" effect="zoomin" label="collapse" active-icon="ion-chevron-down" resting-icon="ion-chevron-up" toggling-method="click">
+<nav ng-if="!loginData.useNphZmsForEvents" mfb-menu position="br" effect="zoomin" label="collapse" active-icon="ion-chevron-down" resting-icon="ion-chevron-up" toggling-method="click">
- <a mfb-button icon="icon-super-speed" label="super speed" ng-click="adjustSpeed('super');"></a>
- <a mfb-button icon="icon-normal-speed" label="normal speed" ng-click="adjustSpeed('normal');"></a>
+ <a mfb-button icon="icon-super-speed" label="super speed" ng-click="adjustSpeed('super');"></a>
+ <a mfb-button icon="icon-normal-speed" label="normal speed" ng-click="adjustSpeed('normal');"></a>
<a mfb-button icon="icon-faster" label="faster" ng-click="adjustSpeed('faster');"></a>
<a mfb-button icon="icon-slower" label="slower" ng-click="adjustSpeed('slower');"> </a>
</nav>
+
+
+<nav ng-if="loginData.useNphZmsForEvents" mfb-menu position="br" effect="zoomin" label="collapse" active-icon="ion-chevron-down" resting-icon="ion-chevron-up" toggling-method="click">
+
+ <a mfb-button icon="ion-skip-forward" label="fast forward" ng-click="adjustSpeed('ff');"></a>
+ <a mfb-button icon="ion-skip-backward" label="fast rewind" ng-click="adjustSpeed('fr');"></a>
+ <a mfb-button icon="ion-play" label="normal play" ng-click="adjustSpeed('np');"></a>
+
+ <a mfb-button icon="ion-pause" label="pause" ng-click="adjustSpeed('p');"> </a>
+
+</nav>
<div class="events-range-modal" ng-if="(defaultVideo=='' )&& (!loginData.useNphZmsForEvents)">