diff options
| author | Pliable Pixels <pliablepixels@gmail.com> | 2016-11-26 14:39:41 -0500 |
|---|---|---|
| committer | Pliable Pixels <pliablepixels@gmail.com> | 2016-11-26 14:39:41 -0500 |
| commit | e3bbbf419adae4f391c786d94db4acd7b88a0355 (patch) | |
| tree | 40b70c3805e8c098cfb4e6103301cfb0e5f3b7b4 | |
| parent | 1009cd07dd8beae0eee2a7b7f677da7c03b88b43 (diff) | |
various updates to video downloads, including device compatibility (android) #383
| -rw-r--r-- | config.xml | 2 | ||||
| -rw-r--r-- | package.json | 13 | ||||
| -rw-r--r-- | www/js/EventCtrl.js | 71 | ||||
| -rw-r--r-- | www/js/app.js | 4 | ||||
| -rw-r--r-- | www/lang/locale-en.json | 1 | ||||
| -rw-r--r-- | www/templates/events.html | 6 |
6 files changed, 63 insertions, 34 deletions
@@ -12,6 +12,8 @@ <access launch-external="yes" origin="mailto:*" /> <allow-navigation href="*" /> <allow-intent href="*" /> + <preference name="AndroidPersistentFileLocation" value="Compatibility" /> + <preference name="iosPersistentFileLocation" value="Library" /> <preference name="AllowInlineMediaPlayback" value="true" /> <preference name="CrosswalkAnimatable" value="true" /> <preference name="webviewbounce" value="false" /> diff --git a/package.json b/package.json index 0b5ed5c2..7896aebc 100644 --- a/package.json +++ b/package.json @@ -90,14 +90,17 @@ "locator": "https://github.com/pliablepixels/cordova-plugin-media", "id": "cordova-plugin-media" }, - { - "locator": "https://github.com/hypery2k/cordova-certificate-plugin", - "id": "cordova-plugin-certificates" - }, "cordova-plugin-photo-library", "cordova-plugin-add-swift-support", "cordova-plugin-file-transfer", - "cordova-library-helper" + { + "locator": "https://github.com/FlyingDonkeyDev/cordova-library-helper", + "id": "cordova-library-helper" + }, + { + "locator": "https://github.com/hypery2k/cordova-certificate-plugin", + "id": "cordova-plugin-certificates" + } ], "cordovaPlatforms": [ { diff --git a/www/js/EventCtrl.js b/www/js/EventCtrl.js index ad1c1da0..22076b54 100644 --- a/www/js/EventCtrl.js +++ b/www/js/EventCtrl.js @@ -536,59 +536,72 @@ angular.module('zmApp.controllers') { NVRDataModel.setAwake(true); - var tp = cordova.file.documentsDirectory + "temp-video.mp4"; + var tp; + if ($rootScope.platformOS == 'ios') + tp = cordova.file.documentsDirectory + "temp-video.mp4"; + else + tp = cordova.file.dataDirectory + "temp-video.mp4"; + var th = true; var opt = {}; - //path = "http://techslides.com/demos/sample-videos/small.mp4"; + //path = "http://techslides.com/demos/sample-videos/small.mp4"; NVRDataModel.debug ("Saving temporary video to: "+tp); $cordovaFileTransfer.download(path, tp, opt, th) .then(function(result) { NVRDataModel.debug ("Moving to gallery..."); - var ntp = tp.indexOf('file://') === 0 ? tp.slice(7) : tp; + var ntp; + ntp = tp.indexOf('file://') === 0 ? tp.slice(7) : tp; - $ionicLoading.hide(); - moveToGallery(ntp); + $timeout (function(){$ionicLoading.hide();}); + moveToGallery(ntp,eid+"-video"); NVRDataModel.setAwake(false); // Success! }, function(err) { NVRDataModel.setAwake(false); NVRDataModel.log ("Error="+JSON.stringify(err)); - $ionicLoading.hide(); - $ionicLoading.show( - { + + $timeout (function() { + $ionicLoading.show( + { - template: $translate.instant('kError'), - noBackdrop: true, - duration:3000 - }); + template: $translate.instant('kError'), + noBackdrop: true, + duration:3000 + }); + }); // Error }, function(progress) { var p = Math.round((progress.loaded / progress.total) * 100); - $ionicLoading.show( - { + + $ionicLoading.show( + { - template: $translate.instant('kPleaseWait') + "...(" + p + "%)", - noBackdrop: true - }); - + template: $translate.instant('kPleaseWait') + "...(" + p + "%)", + noBackdrop: true + }); + }); - function moveToGallery(path) + function moveToGallery(path,fname) { NVRDataModel.debug ("moveToGallery called with "+path); - LibraryHelper.saveVideoToLibrary(onSuccess, onError, path, "zmNinja"); + LibraryHelper.saveVideoToLibrary(onSuccess, onError, path, fname); function onSuccess(results) { NVRDataModel.debug ("Removing temp file"); - $cordovaFile.removeFile(cordova.file.documentsDirectory, "temp-video.mp4"); + + if ($rootScope.platformOS == 'ios') + $cordovaFile.removeFile(cordova.file.documentsDirectory, "temp-video.mp4"); + else + $cordovaFile.removeFile(cordova.file.dataDirectory, "temp-video.mp4"); } @@ -978,7 +991,7 @@ angular.module('zmApp.controllers') { if ($rootScope.platformOS == 'desktop') { - downloadAsGif(e); + gifAlert(e); } else { @@ -987,7 +1000,7 @@ angular.module('zmApp.controllers') cordova.plugins.photoLibrary.getLibrary( function(library) { - downloadAsGif(e); + gifAlert(e); }, function(err) { @@ -998,7 +1011,7 @@ angular.module('zmApp.controllers') function() { // User gave us permission to his library, retry reading it! - downloadAsGif(e); + gifAlert(e); }, function(err) { @@ -1018,6 +1031,16 @@ angular.module('zmApp.controllers') } }; + function gifAlert(e) + { + $ionicPopup.alert( + { + title: $translate.instant('kNote'), + template: "{{'kGifWarning' | translate }}" + }).then(function(){downloadAsGif(e);}); + + } + function downloadAsGif(e) { $ionicLoading.show( diff --git a/www/js/app.js b/www/js/app.js index 53a229c0..1b30dea7 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -72,8 +72,8 @@ angular.module('zmApp', [ monitorRunningColor: '#4CAF50', monitorErrorColor: '#795548', montageScaleFrequency: 300, - eventsListDetailsHeight: 200.0, - eventsListScrubHeight: 300, + eventsListDetailsHeight: 230.0, + eventsListScrubHeight: 330, loginScreenString: "var currentView = 'login'", // Isn't there a better way? desktopUrl: "/zm", desktopApiUrl: "/api/zm", diff --git a/www/lang/locale-en.json b/www/lang/locale-en.json index cb302ed6..646a153d 100644 --- a/www/lang/locale-en.json +++ b/www/lang/locale-en.json @@ -129,6 +129,7 @@ "kFrom" :"From", "kFromDate" :"From Date", "kFromTime" :"From Time", + "kGifWarning" :"The GIF animation will only be of alarmed frames and limited to 70 frames, due to memory constraints", "kGlobalConfiguration" :"Global Configuration", "kGraphAlarmed" :"alarmed", "kGraphAll" :"all", diff --git a/www/templates/events.html b/www/templates/events.html index 340fdab2..8fe8c737 100644 --- a/www/templates/events.html +++ b/www/templates/events.html @@ -62,8 +62,8 @@ <!-- col col left--> <div class="col col-80"> <div class="item-text-wrap"> - <i class="ion-ios-videocam-outline"></i> - <b>{{event.Event.MonitorName}}</b> ({{event.Event.Id}}) + + <b>{{event.Event.MonitorName}}</b> ({{event.Event.Id}}) <button ng-if="gifshotSupported" class="button button-small button-clear icon gif-icon" ng-click="permissionsDownload(event)"> </button> @@ -71,7 +71,7 @@ <a ng-if="(event.Event.DefaultVideo!='' && event.Event.DefaultVideo!==undefined) && $root.platformOS=='desktop' " class="button button-clear button-small icon mp4-icon" href="{{event.Event.videoPath}}" download="{{event.Event.Id}}-video.mp4" ng-click="mp4warning()"></a> - <button ng-if="event.Event.DefaultVideo!='' && $root.platformOS!='desktop'" class="button button-small button-clear icon mp4-icon" ng-click="downloadFileToDevice(event.Event.videoPath, event.Event.Id)"> + <button ng-if="event.Event.DefaultVideo!='' && event.Event.DefaultVideo!=undefined && $root.platformOS!='desktop'" class="button button-small button-clear icon mp4-icon" ng-click="downloadFileToDevice(event.Event.videoPath, event.Event.Id)"> </button> |
