summaryrefslogtreecommitdiff
path: root/www/js
diff options
context:
space:
mode:
Diffstat (limited to 'www/js')
-rw-r--r--www/js/DataModel.js18
-rw-r--r--www/js/LoginCtrl.js4
-rw-r--r--www/js/MontageCtrl.js63
3 files changed, 54 insertions, 31 deletions
diff --git a/www/js/DataModel.js b/www/js/DataModel.js
index 90cf13e9..d4249b31 100644
--- a/www/js/DataModel.js
+++ b/www/js/DataModel.js
@@ -20,7 +20,7 @@ angular.module('zmApp.controllers')
DO NOT TOUCH zmAppVersion
It is changed by sync_version.sh
*/
- var zmAppVersion = "1.3.018";
+ var zmAppVersion = "1.3.020";
var isBackground = false;
var justResumed = false;
var timeSinceResumed = -1;
@@ -829,9 +829,9 @@ angular.module('zmApp.controllers')
return d.promise;
}
- window.cordova.plugin.cloudsettings.enableDebug(function(){
+ /* window.cordova.plugin.cloudsettings.enableDebug(function(){
console.log("Debug mode enabled");
- });
+ });*/
log("CloudSync: Syncing with cloud if enabled...");
@@ -883,8 +883,8 @@ angular.module('zmApp.controllers')
d.resolve(true);
return d.promise;
},
- function () {
- log("error syncing cloud data...");
+ function (err) {
+ log("error syncing cloud data..."+err);
d.resolve(true);
return d.promise;
}, true);
@@ -1893,7 +1893,7 @@ angular.module('zmApp.controllers')
return monitors;
},
- pauseLiveStream: function (ck, url) {
+ pauseLiveStream: function (ck, url, name) {
if (!url) url = loginData.url;
var myauthtoken = $rootScope.authSession.replace("&auth=", "");
@@ -1903,7 +1903,7 @@ angular.module('zmApp.controllers')
req = req + "&auth=" + myauthtoken;
// req = req + "&command=17";
- debug("DataModel: Pausing live stream ck:" + ck);
+ debug("DataModel: Pausing live stream ck:" + ck+" for "+name);
return $http.get(req + "&command=1")
.then(
function (s) {
@@ -1917,7 +1917,7 @@ angular.module('zmApp.controllers')
},
- resumeLiveStream: function (ck, url) {
+ resumeLiveStream: function (ck, url, name) {
if (!url) url = loginData.url;
var myauthtoken = $rootScope.authSession.replace("&auth=", "");
@@ -1927,7 +1927,7 @@ angular.module('zmApp.controllers')
req = req + "&auth=" + myauthtoken;
// req = req + "&command=17";
- debug("DataModel: Resuming live stream ck:" + ck);
+ debug("DataModel: Resuming live stream ck:" + ck+ " for "+name);
return $http.get(req + "&command=2")
.then(
function (s) {
diff --git a/www/js/LoginCtrl.js b/www/js/LoginCtrl.js
index 99f215a8..155b648d 100644
--- a/www/js/LoginCtrl.js
+++ b/www/js/LoginCtrl.js
@@ -598,8 +598,8 @@ angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$r
NVRDataModel.debug("local data synced with cloud...");
},
- function () {
- NVRDataModel.debug("error syncing cloud data...");
+ function (err) {
+ NVRDataModel.debug("error syncing cloud data..."+JSON.stringify(err));
}, true);
diff --git a/www/js/MontageCtrl.js b/www/js/MontageCtrl.js
index 3a0a1726..fefe2ddc 100644
--- a/www/js/MontageCtrl.js
+++ b/www/js/MontageCtrl.js
@@ -34,7 +34,8 @@ angular.module('zmApp.controllers')
var streamState = {
SNAPSHOT: 1,
ACTIVE: 2,
- STOPPED: 3
+ STOPPED: 3,
+ PAUSED:4
};
var currentStreamState = streamState.SNAPSHOT; // first load snapshot
@@ -304,6 +305,7 @@ angular.module('zmApp.controllers')
var elem = angular.element(document.getElementById("mygrid"));
+ var loadCount = 0;
//console.log ("**** mygrid is " + JSON.stringify(elem));
if (pckry) pckry.destroy();
@@ -327,18 +329,43 @@ angular.module('zmApp.controllers')
// lay out every image if a pre-arranged position has not been found
$timeout(function () {
- if (layouttype) pckry.layout();
+ if (layouttype || 1) pckry.layout();
}, 100);
progressCalled = true;
+ loadCount++;
+ console.log ("loaded "+loadCount+" of "+positions.length);
// if (layouttype) $timeout (function(){layout(pckry);},100);
});
+ $timeout (function() {
+
+ if ($scope.areImagesLoading) {
+ NVRDataModel.debug ("Images still loading after 15secs?");
+ allImagesLoadedOrFailed();
+ }
+
+ }, 15000);
+
imagesLoaded(elem).on('always', function () {
//console.log ("******** ALL IMAGES LOADED");
// $scope.$digest();
NVRDataModel.debug("All images loaded, switching to snapshot...");
+ allImagesLoadedOrFailed();
+ });
+
+
+
+ imagesLoaded(elem).on('fail', function () {
+ NVRDataModel.debug("All images loaded, but some broke, switching to snapshot...");
+ //console.log ("******** ALL IMAGES LOADED");
+ // $scope.$digest();
+ allImagesLoadedOrFailed();
+ });
+
+ function allImagesLoadedOrFailed() {
+
$timeout (function() {$scope.areImagesLoading = false;});
@@ -411,7 +438,7 @@ angular.module('zmApp.controllers')
}, 20);
- });
+ }
function itemDragged(item) {
NVRDataModel.debug("drag complete");
@@ -1152,21 +1179,19 @@ angular.module('zmApp.controllers')
$scope.openModal = function (mid, controllable, controlid, connKey, monitor) {
- currentStreamState = streamState.STOPPED;
+ currentStreamState = streamState.PAUSED;
$scope.isModalStreamPaused = true; // we stop montage and start modal stream in snapshot first
$timeout(function () { // after render
if (simulStreaming) {
- NVRDataModel.debug("Killing all streams in montage to save memory/nw...");
-
- if ($rootScope.platformOS == 'ios') {
+ NVRDataModel.debug("Pausing all streams in montage to save memory/nw...");
- } else {
+
for (var i = 0; i < $scope.MontageMonitors.length; i++) {
- if ($scope.MontageMonitors[i].Monitor.listDisplay == 'show') NVRDataModel.killLiveStream($scope.MontageMonitors[i].Monitor.connKey, $scope.MontageMonitors[i].Monitor.controlURL, $scope.MontageMonitors[i].Monitor.Name);
+ if ($scope.MontageMonitors[i].Monitor.listDisplay == 'show') NVRDataModel.pauseLiveStream($scope.MontageMonitors[i].Monitor.connKey, $scope.MontageMonitors[i].Monitor.controlURL, $scope.MontageMonitors[i].Monitor.Name);
}
- }
+
}
});
@@ -1295,19 +1320,17 @@ angular.module('zmApp.controllers')
// once regenerated
if (simulStreaming) {
- NVRDataModel.debug("Re-creating all stream connkeys in montage ...");
- NVRDataModel.regenConnKeys();
+ NVRDataModel.debug("Resuming all stream connkeys in montage ...");
+
+ for (var i = 0; i < $scope.MontageMonitors.length; i++) {
+ if ($scope.MontageMonitors[i].Monitor.listDisplay == 'show') NVRDataModel.resumeLiveStream($scope.MontageMonitors[i].Monitor.connKey, $scope.MontageMonitors[i].Monitor.controlURL, $scope.MontageMonitors[i].Monitor.Name);
+ }
+ /* NVRDataModel.regenConnKeys();
$scope.monitors = NVRDataModel.getMonitorsNow();
- $scope.MontageMonitors = angular.copy($scope.monitors);
+ $scope.MontageMonitors = angular.copy($scope.monitors);*/
}
- // we need to do this as we hide the view for snapshot as well
- //streamState = false;
- $timeout(function () // after render
- {
- initPackery();
- }, zm.packeryTimer);
-
+
}