summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPliable Pixels <pliablepixels@gmail.com>2019-11-01 14:38:50 -0400
committerPliable Pixels <pliablepixels@gmail.com>2019-11-01 14:38:50 -0400
commit1793deb9977976ef8f390f3458b7e82380d5b445 (patch)
tree3d386cf24d417bb223b3739b8e80768c98f74be3
parent8367c166622310f931b047c24178fe205cab3207 (diff)
start with low quality snapshot first for faster load
-rw-r--r--config.xml6
-rw-r--r--package.json8
-rw-r--r--www/js/MontageCtrl.js89
3 files changed, 55 insertions, 48 deletions
diff --git a/config.xml b/config.xml
index 1b6c7f38..fbfb8133 100644
--- a/config.xml
+++ b/config.xml
@@ -176,10 +176,10 @@
<plugin name="cordova-plugin-photo-library" spec="https://github.com/pliablepixels/cordova-plugin-photo-library">
<variable name="PHOTO_LIBRARY_USAGE_DESCRIPTION" value=" " />
</plugin>
- <plugin name="cordova-plugin-media-pp-fork" spec="^1.0.2-dev" />
- <engine name="ios" spec="4.5.5" />
- <engine name="android" spec="8.0.0" />
<plugin name="cordova-plugin-ionic-webview" spec="https://github.com/pliablepixels/cordova-plugin-ionic-webview.git">
<variable name="ANDROID_SUPPORT_ANNOTATIONS_VERSION" value="27.+" />
</plugin>
+ <plugin name="cordova-plugin-media-pp-fork" spec="^1.0.2-dev" />
+ <engine name="ios" spec="4.5.5" />
+ <engine name="android" spec="8.0.0" />
</widget>
diff --git a/package.json b/package.json
index 90e9bcf2..424b8bfd 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "zmninjapro",
"description": "Home security mobile app for ZoneMinder",
- "version":"1.3.080",
+ "version": "1.3.080",
"displayName": "zmNinja",
"author": "Pliable Pixels",
"license": "custom see LICENSE.md",
@@ -58,10 +58,10 @@
"cordova-plugin-photo-library": {
"PHOTO_LIBRARY_USAGE_DESCRIPTION": "Save monitor photos to albums"
},
- "cordova-plugin-media-pp-fork": {},
"cordova-plugin-ionic-webview": {
"ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"
- }
+ },
+ "cordova-plugin-media-pp-fork": {}
}
},
"dependencies": {
@@ -191,4 +191,4 @@
]
}
}
-}
+} \ No newline at end of file
diff --git a/www/js/MontageCtrl.js b/www/js/MontageCtrl.js
index d917c49e..cc815e49 100644
--- a/www/js/MontageCtrl.js
+++ b/www/js/MontageCtrl.js
@@ -36,12 +36,13 @@ angular.module('zmApp.controllers')
var streamState = {
SNAPSHOT: 1,
- ACTIVE: 2,
- STOPPED: 3,
- PAUSED: 4
+ SNAPSHOT_LOWQUALITY:2,
+ ACTIVE: 3,
+ STOPPED: 4,
+ PAUSED: 5
};
- var currentStreamState = streamState.SNAPSHOT; // first load snapshot
+ var currentStreamState = streamState.SNAPSHOT_LOWQUALITY; // first load snapshot
$scope.isModalStreamPaused = false; // used in Monitor Modal
//var reloadPage = 30;
@@ -212,7 +213,7 @@ angular.module('zmApp.controllers')
duration: zm.loadingTimeout
});*/
- currentStreamState = streamState.SNAPSHOT;
+ currentStreamState = streamState.SNAPSHOT_LOWQUALITY;
$scope.areImagesLoading = true;
var progressCalled = false;
@@ -330,38 +331,31 @@ angular.module('zmApp.controllers')
NVR.debug("All images loaded, but some broke, switching to snapshot...");
//console.log ("******** ALL IMAGES LOADED");
// $scope.$digest();
- allImagesLoadedOrFailed();
+ $timeout (function () {
+ allImagesLoadedOrFailed();
+ },100);
+
});
function allImagesLoadedOrFailed() {
-
- $timeout(function () {
- $scope.areImagesLoading = false;
- });
-
+ $scope.areImagesLoading = false;
currentStreamState = streamState.SNAPSHOT;
-
if (simulStreaming) {
-
- $timeout(function () {
- NVR.debug("Switching mode to active...");
+ $timeout (function () {
+ NVR.debug("Switching mode to streaming as multi-port on...");
+ //NVR.regenConnKeys();
+ //randEachTime();
currentStreamState = streamState.ACTIVE;
- }, 100);
- }
-
- $ionicLoading.hide();
-
- if (!progressCalled) {
- NVR.log("*** PROGRESS WAS NOT CALLED");
- // pckry.reloadItems();
- }
+ },300);
+
+ }
+
- $timeout(function () {
+ $ionicLoading.hide();
pckry.getItemElements().forEach(function (itemElem) {
-
draggie = new Draggabilly(itemElem);
pckry.bindDraggabillyEvents(draggie);
draggies.push(draggie);
@@ -409,7 +403,6 @@ angular.module('zmApp.controllers')
//pckry.onresize();
- }, 20);
}
@@ -808,7 +801,7 @@ angular.module('zmApp.controllers')
} // before reorder array
} // montage monitors
- // console.log ("AFTER REORDER="+JSON.stringify(beforeReorderPositions));
+ console.log ("AFTER REORDER="+JSON.stringify(beforeReorderPositions));
for (var n = 0; i < $scope.MontageMonitors.length; i++) {
$scope.MontageMonitors[n].Monitor.connKey = NVR.regenConnKeys($scope.MontageMonitors[i]);
@@ -1671,7 +1664,7 @@ angular.module('zmApp.controllers')
// in timeout for iOS as we call stopNetwork
$timeout(function () {
-
+ console.log ("SIMUL SWITCH MONTAGE CALLING REGEN");
NVR.regenConnKeys();
$scope.monitors = NVR.getMonitorsNow();
$scope.MontageMonitors = angular.copy($scope.monitors);
@@ -1683,7 +1676,9 @@ angular.module('zmApp.controllers')
} else {
+ console.log ("NOT SIMUL SWITCH MONTAGE CALLING REGEN");
NVR.regenConnKeys();
+
$scope.monitors = NVR.getMonitorsNow();
$scope.MontageMonitors = angular.copy($scope.monitors);
$timeout(function () {
@@ -1883,16 +1878,23 @@ angular.module('zmApp.controllers')
$scope.processImageError = function(monitor) {
+ // if (1) return;
+
+ if (currentStreamState != streamState.ACTIVE) return;
var mintimesec = 10;
var nowt = moment();
var thent = monitor.Monitor.regenTime || moment();
if (nowt.diff(thent, 'seconds') >=mintimesec) {
+ console.log ('IMAGE ERROR CALLING REGEN');
NVR.regenConnKeys(monitor);
NVR.debug ("Image load error for: "+monitor.Monitor.Id+" regenerated connKey is:"+monitor.Monitor.connKey);
} else {
dur = mintimesec - nowt.diff(thent, 'seconds');
NVR.debug ("Image load error for Monitor: "+monitor.Monitor.Id+" scheduling for connkey regen in "+dur+"s");
- monitor.Monitor.regenHandle = $timeout ( function() {NVR.regenConnKeys(monitor);}, dur*1000 );
+ monitor.Monitor.regenHandle = $timeout ( function() {
+ NVR.debug ('deferred image error, calling regen');
+ //console.log ('DEFERRED IMAGE ERROR CALLING REGEN');
+ NVR.regenConnKeys(monitor);}, dur*1000 );
}
@@ -2039,23 +2041,31 @@ angular.module('zmApp.controllers')
var fps = NVR.getLogin().montageliveFPS;
if (currentStreamState == streamState.STOPPED || monitor.Monitor.listDisplay == 'noshow' ) {
//console.log ("STREAM=empty and auth="+$rootScope.authSession);
+ //sconsole.log ('EMPTY STREAM');
return "";
}
- //console.log ("STREAMING="+monitor.Monitor.streamingURL);
- stream = monitor.Monitor.streamingURL +
+ if (currentStreamState == streamState.SNAPSHOT_LOWQUALITY) {
+ stream = monitor.Monitor.streamingURL +
+ "/nph-zms?mode=single&scale=10&monitor="+ monitor.Monitor.Id ;
+ // console.log(stream);
+
+ } else {
+ stream = monitor.Monitor.streamingURL +
"/nph-zms?mode=" + getMode() +
"&monitor=" + monitor.Monitor.Id +
"&scale=" + $scope.LoginData.montageQuality +
- "&rand=" + randToAvoidCacheMem + monitor.Monitor.Id +
- "&buffer=1000";
+ "&buffer=1000"+
+ "&rand=" + randToAvoidCacheMem + monitor.Monitor.Id;
if (fps) {
stream +='&maxfps='+fps;
}
-
- stream += $rootScope.authSession +
- appendConnKey(monitor.Monitor.connKey);
+
+ }
+
+ stream += $rootScope.authSession;
+ stream += appendConnKey(monitor.Monitor.connKey);
if (stream) stream += NVR.insertBasicAuthToken();
@@ -2072,10 +2082,7 @@ angular.module('zmApp.controllers')
};
function appendConnKey(ck) {
- if (simulStreaming && currentStreamState != streamState.SNAPSHOT)
return "&connkey=" + ck;
- else
- return "";
}
@@ -2123,7 +2130,7 @@ angular.module('zmApp.controllers')
timeInMontage = new Date();
broadcastHandles = [];
randToAvoidCacheMem = new Date().getTime();
- currentStreamState = streamState.SNAPSHOT;
+
$scope.monitors = NVR.getMonitorsNow();
//console.log ("MONITORS:"+JSON.stringify($scope.monitors));