diff options
| author | Pliable Pixels <pliablepixels@gmail.com> | 2018-12-07 14:24:18 -0500 |
|---|---|---|
| committer | Pliable Pixels <pliablepixels@gmail.com> | 2018-12-07 14:24:18 -0500 |
| commit | f78c8d5484a7e03b2b6587e9547ccaea6e0fe490 (patch) | |
| tree | 6d82a70dfa8312cfbd330fcffea26b97f5382ece /www/js | |
| parent | d36f0a793cef63c5ce239729fd31f83956407193 (diff) | |
#757 trap image load and re-generate connkey
Diffstat (limited to 'www/js')
| -rw-r--r-- | www/js/MontageCtrl.js | 7 | ||||
| -rwxr-xr-x | www/js/app.js | 19 |
2 files changed, 20 insertions, 6 deletions
diff --git a/www/js/MontageCtrl.js b/www/js/MontageCtrl.js index 2e70b127..90d9ee82 100644 --- a/www/js/MontageCtrl.js +++ b/www/js/MontageCtrl.js @@ -1762,12 +1762,15 @@ angular.module('zmApp.controllers') function getMode() { var mode = (simulStreaming && currentStreamState != streamState.SNAPSHOT && currentStreamState != streamState.STOPPED) ? 'jpeg' : 'single'; - //console.log ("mode="+mode); + //console.log ("mode="+mode); return mode; } - + $scope.processImageError = function(monitor) { + monitor.Monitor.connKey = (Math.floor((Math.random() * 999999) + 1)).toString(); + NVRDataModel.debug ("Image load error for: "+monitor.Monitor.Id+" regenerated connKey is:"+monitor.Monitor.connKey); + }; $scope.constructStream = function (monitor) { diff --git a/www/js/app.js b/www/js/app.js index 604912a0..9ca20c8e 100755 --- a/www/js/app.js +++ b/www/js/app.js @@ -488,12 +488,13 @@ angular.module('zmApp', [ // This directive is adapted from https://github.com/paveisistemas/ionic-image-lazy-load // I've removed lazyLoad and only made it show a spinner when an image is loading //-------------------------------------------------------------------------------------------- - .directive('imageSpinnerSrc', ['$document', '$compile', 'imageLoadingDataShare', '$timeout', - function ($document, $compile, imageLoadingDataShare, $timeout) { + .directive('imageSpinnerSrc', ['$document', '$compile', 'imageLoadingDataShare', '$timeout', '$parse', + function ($document, $compile, imageLoadingDataShare, $timeout, $parse) { return { restrict: 'A', scope: { - imageSpinnerBackgroundImage: "@imageSpinnerBackgroundImage" + imageSpinnerBackgroundImage: "@imageSpinnerBackgroundImage", + imageOnError: '&' }, link: function ($scope, $element, $attributes) { @@ -519,7 +520,7 @@ angular.module('zmApp', [ // show an image-missing image $element.bind('error', function () { - // console.log ("DIRECTIVE: IMAGE ERROR"); + loader.remove(); @@ -556,6 +557,16 @@ angular.module('zmApp', [ // $element.prop('data-src', hurl); imageLoadingDataShare.set(0); + + if ($attributes.imageOnError) { + //console.log (">>>> ERROR CBK"); + $scope.imageOnError(); + // fn($scope, {}); + } + else { + //console.log (">>>>>>>>>> NO ERROR CBK"); + } + }); function waitForFrame1() { |
