diff --git a/html5/verto/js/src/jquery.jsonrpcclient.js b/html5/verto/js/src/jquery.jsonrpcclient.js index a02885e802..6f4f07c72b 100644 --- a/html5/verto/js/src/jquery.jsonrpcclient.js +++ b/html5/verto/js/src/jquery.jsonrpcclient.js @@ -91,6 +91,32 @@ /// The next JSON-RPC request id. $.JsonRpcClient.prototype._current_id = 1; + + $.JsonRpcClient.prototype.speedTest = function (bytes, cb) { + var socket = this.options.getSocket(this.wsOnMessage); + if (socket !== null) { + this.speedCB = cb; + this.speedBytes = bytes; + socket.send("#SPU " + bytes); + + var loops = bytes / 1024; + var rem = bytes % 1024; + var i; + var data = new Array(1024).join("."); + for (i = 0; i < loops; i++) { + socket.send("#SPB " + data); + } + + if (rem) { + socket.send("#SPB " + data); + } + + socket.send("#SPE"); + } + }; + + + /** * @fn call * @memberof $.JsonRpcClient @@ -382,6 +408,26 @@ $.JsonRpcClient.prototype._wsOnMessage = function(event) { // Check if this could be a JSON RPC message. var response; + + // Special sub proto + if (event.data[0] == "#" && event.data[1] == "S" && event.data[2] == "P") { + if (event.data[3] == "U") { + this.up_dur = parseInt(event.data.substring(4)); + } else if (this.speedCB && event.data[3] == "D") { + this.down_dur = parseInt(event.data.substring(4)); + + var up_kps = (((this.speedBytes * 8) / (this.up_dur / 1000)) / 1024).toFixed(0); + var down_kps = (((this.speedBytes * 8) / (this.down_dur / 1000)) / 1024).toFixed(0); + + console.info("Speed Test: Up: " + up_kps + " Down: " + down_kps); + this.speedCB(event, { upDur: this.up_dur, downDur: this.down_dur, upKPS: up_kps, downKPS: down_kps }); + this.speedCB = null; + } + + return; + } + + try { response = $.parseJSON(event.data); diff --git a/html5/verto/verto_communicator/package.json b/html5/verto/verto_communicator/package.json index b2b0502a55..de23baa785 100644 --- a/html5/verto/verto_communicator/package.json +++ b/html5/verto/verto_communicator/package.json @@ -15,7 +15,7 @@ "grunt-contrib-copy": "^0.7.0", "grunt-contrib-cssmin": "^0.12.0", "grunt-contrib-htmlmin": "^0.4.0", - "grunt-contrib-imagemin": "^0.9.2", + "grunt-contrib-imagemin": "^1.0.0", "grunt-contrib-jshint": "^0.11.0", "grunt-contrib-uglify": "^0.7.0", "grunt-contrib-watch": "latest", diff --git a/html5/verto/verto_communicator/src/css/verto.css b/html5/verto/verto_communicator/src/css/verto.css index 84ca62e730..a03cac2e09 100644 --- a/html5/verto/verto_communicator/src/css/verto.css +++ b/html5/verto/verto_communicator/src/css/verto.css @@ -1481,6 +1481,43 @@ body:-webkit-full-screen #incall .video-footer { .preview-wrapper video { transform: scaleX(-1); } + +.drop-net-info { + padding-top: 0px; + cursor: default; +} + +.drop-net-info .title { + text-align: center; + font-size: 16px; + font-weight: bold; + padding: 8px 14px; + margin: 0; + font-size: 14px; + background-color: #f7f7f7; + border-bottom: 1px solid #ebebeb; +} + +.drop-net-info .title:hover { + background-color: #f7f7f7; +} + +.drop-net-info a:hover { + color: #333 !important; +} + +.net-info .yellow { + color: #e3d95b; +} + +.net-info .green { + color: #00ae00; +} + +.net-info .red { + color: #ae0000; +} + #mic-meter { position: absolute; bottom: 5px; diff --git a/html5/verto/verto_communicator/src/partials/dialpad.html b/html5/verto/verto_communicator/src/partials/dialpad.html index f24e28331d..e5711d1ef2 100644 --- a/html5/verto/verto_communicator/src/partials/dialpad.html +++ b/html5/verto/verto_communicator/src/partials/dialpad.html @@ -1,4 +1,10 @@ -
+
+

Calling to {{ dialpadNumber }}...

+ + + +
+
diff --git a/html5/verto/verto_communicator/src/partials/menu.html b/html5/verto/verto_communicator/src/partials/menu.html index b14aad0061..55e0cee35b 100644 --- a/html5/verto/verto_communicator/src/partials/menu.html +++ b/html5/verto/verto_communicator/src/partials/menu.html @@ -19,9 +19,21 @@
- - -
+

+
Check Speed + - + -

Dedicated Remote Encoder

-
Select a non default bandwidth to use a dedicated remote encoder.
-
-

Dedicated Remote Encoder enabled. -

+
+

Dedicated Remote Encoder enabled. +

-
- - -
+
+ +
-
- - +
+ +
+ +
+ + +
+ +
+ + +
+ +
+ + +
diff --git a/html5/verto/verto_communicator/src/storageService/services/splash_screen.js b/html5/verto/verto_communicator/src/storageService/services/splash_screen.js index da7a156f63..40c2b6951b 100644 --- a/html5/verto/verto_communicator/src/storageService/services/splash_screen.js +++ b/html5/verto/verto_communicator/src/storageService/services/splash_screen.js @@ -4,7 +4,7 @@ .module('storageService') .service('splashscreen', ['$rootScope', '$q', 'storage', 'config', 'verto', function($rootScope, $q, storage, config, verto) { - + var checkBrowser = function() { return $q(function(resolve, reject) { var activity = 'browser-upgrade'; @@ -22,10 +22,10 @@ if (!navigator.getUserMedia) { result['status'] = 'error'; result['message'] = 'Error: browser doesn\'t support WebRTC.'; - reject(result); + reject(result); } - resolve(result); + resolve(result); }); }; @@ -48,7 +48,7 @@ reject(result); } verto.data.mediaPerm = true; - resolve(result); + resolve(result); }); }); }; @@ -62,7 +62,7 @@ 'activity': activity, 'message': 'Refresh Media Devices.' }; - + verto.refreshDevices(function(status) { verto.refreshDevicesCallback(function() { resolve(result); @@ -72,6 +72,28 @@ }); }; + var checkConnectionSpeed = function() { + return $q(function(resolve, reject) { + var activity = 'check-connection-speed'; + var result = { + 'status': 'success', + 'soft': true, + 'activity': activity, + 'message': 'Check Connection Speed.' + }; + + if (storage.data.autoBand && verto.data.instance) { + verto.testSpeed(cb); + } else { + resolve(result); + } + + function cb(data) { + resolve(result); + } + }); + }; + var provisionConfig = function() { return $q(function(resolve, reject) { var activity = 'provision-config'; @@ -100,7 +122,7 @@ }); result['promise'] = configPromise; - + resolve(result); }); }; @@ -136,13 +158,13 @@ verto.data.connecting = false; resolve(result); }); - }; + }; }; if(storage.data.ui_connected && storage.data.ws_connected) { - checkUserStored(); + checkUserStored(); } else { - resolve(result); + resolve(result); }; }); }; @@ -152,7 +174,8 @@ checkMediaPerm, refreshMediaDevices, provisionConfig, - checkLogin + checkLogin, + checkConnectionSpeed ]; var progress_message = [ @@ -160,12 +183,13 @@ 'Checking media permissions', 'Refresh Media Devices.', 'Provisioning configuration.', - 'Checking login.' + 'Checking login.', + 'Check Connection Speed.' ]; - + var getProgressMessage = function(current_progress) { if(progress_message[current_progress] != undefined) { - return progress_message[current_progress]; + return progress_message[current_progress]; } else { return 'Please wait...'; } @@ -176,7 +200,7 @@ var calculateProgress = function(index) { var _progress; - + _progress = index + 1; progress_percentage = (_progress / progress.length) * 100; return progress_percentage; @@ -186,12 +210,12 @@ var fn, fn_return, status, interrupt, activity, soft, message, promise; interrupt = false; current_progress++; - + if(current_progress >= progress.length) { $rootScope.$emit('progress.complete', current_progress); return; } - + fn = progress[current_progress]; fn_return = fn(); @@ -221,7 +245,7 @@ emitNextProgress(fn_return); } ); - + }; return { @@ -232,4 +256,3 @@ }; }]); - diff --git a/html5/verto/verto_communicator/src/storageService/services/storage.js b/html5/verto/verto_communicator/src/storageService/services/storage.js index 2ac76532f6..b344ea2324 100644 --- a/html5/verto/verto_communicator/src/storageService/services/storage.js +++ b/html5/verto/verto_communicator/src/storageService/services/storage.js @@ -35,7 +35,9 @@ askRecoverCall: false, googNoiseSuppression: true, googHighpassFilter: true, - googEchoCancellation: true + googEchoCancellation: true, + autoBand: true, + testSpeedJoin: true }; data.$default(defaultSettings); diff --git a/html5/verto/verto_communicator/src/vertoControllers/controllers/DialPadController.js b/html5/verto/verto_communicator/src/vertoControllers/controllers/DialPadController.js index 14a8846f45..305befeea1 100644 --- a/html5/verto/verto_communicator/src/vertoControllers/controllers/DialPadController.js +++ b/html5/verto/verto_communicator/src/vertoControllers/controllers/DialPadController.js @@ -97,8 +97,17 @@ /** * Call to the number in the $rootScope.dialpadNumber. */ + $scope.loading = false; $rootScope.call = function(extension) { - return call(extension); + if (!storage.data.testSpeedJoin || !$rootScope.dialpadNumber) { + return call(extension); + } + $scope.loading = true; + + verto.testSpeed(function() { + $scope.loading = false; + call(extension); + }); } } ]); diff --git a/html5/verto/verto_communicator/src/vertoControllers/controllers/MainController.js b/html5/verto/verto_communicator/src/vertoControllers/controllers/MainController.js index 7bd5cb6819..4a4a3accfe 100644 --- a/html5/verto/verto_communicator/src/vertoControllers/controllers/MainController.js +++ b/html5/verto/verto_communicator/src/vertoControllers/controllers/MainController.js @@ -52,10 +52,13 @@ storage.data.email = verto.data.email; storage.data.login = verto.data.login; storage.data.password = verto.data.password; + if (storage.data.autoBand) { + verto.testSpeed(); + } + if (redirect && storage.data.preview) { $location.path('/preview'); - } - else if (redirect) { + } else if (redirect) { $location.path('/dialpad'); } } @@ -180,6 +183,9 @@ }; function onWSLogin(ev, data) { + if(storage.data.autoBand) { + verto.testSpeed(); + } if(!ws_modalInstance) { return; }; diff --git a/html5/verto/verto_communicator/src/vertoControllers/controllers/MenuController.js b/html5/verto/verto_communicator/src/vertoControllers/controllers/MenuController.js index 6d77567714..104b5c2b50 100644 --- a/html5/verto/verto_communicator/src/vertoControllers/controllers/MenuController.js +++ b/html5/verto/verto_communicator/src/vertoControllers/controllers/MenuController.js @@ -4,10 +4,43 @@ angular .module('vertoControllers') .controller('MenuController', ['$scope', '$http', '$location', - 'verto', 'storage', - function($scope, $http, $location, verto, storage) { + 'verto', 'storage', '$rootScope', + function($scope, $http, $location, verto, storage, $rootScope) { console.debug('Executing MenuController.'); - } + $scope.storage = storage; + + $rootScope.$on('testSpeed', function(e, data) { + var vidQual = storage.data.vidQual; + var bwp = 4; + + $scope.bandDown = data.downKPS; + $scope.bandUp = data.upKPS; + + if (data.downKPS < 2000) { + bwp--; + } + + if (data.upKPS < 2000) { + bwp--; + } + + $scope.iconClass = 'mdi-device-signal-wifi-4-bar green'; + + if (bwp < 4) { + $scope.iconClass = 'mdi-device-signal-wifi-3-bar yellow'; + } else if (bwp < 2) { + $scope.iconClass = 'mdi-device-signal-wifi-1-bar red'; + } + + verto.videoQuality.forEach(function(vid) { + if (vid.id == vidQual){ + $scope.vidRes = vid.label; + } + }); + + $scope.$apply(); + }); + } ]); -})(); \ No newline at end of file +})(); diff --git a/html5/verto/verto_communicator/src/vertoControllers/controllers/ModalSettingsController.js b/html5/verto/verto_communicator/src/vertoControllers/controllers/ModalSettingsController.js index 2b70948bbe..7bc9aa7452 100644 --- a/html5/verto/verto_communicator/src/vertoControllers/controllers/ModalSettingsController.js +++ b/html5/verto/verto_communicator/src/vertoControllers/controllers/ModalSettingsController.js @@ -15,6 +15,9 @@ $scope.ok = function() { storage.changeData($scope.mydata); verto.data.instance.iceServers(storage.data.useSTUN); + if (storage.data.autoBand) { + $scope.testSpeed(); + } $modalInstance.close('Ok.'); }; @@ -26,6 +29,16 @@ return verto.refreshDevices(); }; + $scope.testSpeed = function() { + return verto.testSpeed(cb); + + function cb(data) { + $scope.mydata.vidQual = storage.data.vidQual; + $scope.speedMsg = 'Up: ' + data.upKPS + ' Down: ' + data.downKPS; + $scope.$apply(); + } + }; + $scope.resetSettings = function() { if (confirm('Factory Reset Settings?')) { storage.factoryReset(); @@ -35,11 +48,22 @@ }; }; - $scope.checkUseDedRemoteEncoder = function(option) { - if ($scope.mydata.incomingBandwidth != 'default' || $scope.mydata.outgoingBandwidth != 'default') { - $scope.mydata.useDedenc = true; + $scope.checkAutoBand = function(option) { + $scope.mydata.useDedenc = false; + if (!option) { + $scope.mydata.outgoingBandwidth = 'default'; + $scope.mydata.incomingBandwidth = 'default'; + $scope.mydata.vidQual = 'hd'; } else { + $scope.mydata.testSpeedJoin = true; + } + }; + + $scope.checkUseDedRemoteEncoder = function(option) { + if (['0', 'default', '5120'].indexOf(option) != -1) { $scope.mydata.useDedenc = false; + } else { + $scope.mydata.useDedenc = true; } }; } diff --git a/html5/verto/verto_communicator/src/vertoService/services/configService.js b/html5/verto/verto_communicator/src/vertoService/services/configService.js index 105a20b324..9fd789e81f 100644 --- a/html5/verto/verto_communicator/src/vertoService/services/configService.js +++ b/html5/verto/verto_communicator/src/vertoService/services/configService.js @@ -40,7 +40,7 @@ vertoService.service('config', ['$rootScope', '$http', '$location', 'storage', ' verto.data.googlelogin = data.googlelogin; verto.data.googleclientid = data.googleclientid; } - + angular.extend(verto.data, data); /** @@ -62,13 +62,13 @@ vertoService.service('config', ['$rootScope', '$http', '$location', 'storage', ' console.debug("auto login per config.json"); verto.data.autologin_done = true; } - + if(verto.data.autologin && storage.data.name.length && storage.data.email.length && storage.data.login.length && storage.data.password.length) { - $rootScope.$emit('config.http.success', data); + $rootScope.$emit('config.http.success', data); }; return response; }, function(response) { - $rootScope.$emit('config.http.error', response); + $rootScope.$emit('config.http.error', response); return response; }); @@ -79,4 +79,3 @@ vertoService.service('config', ['$rootScope', '$http', '$location', 'storage', ' 'configure': configure }; }]); - diff --git a/html5/verto/verto_communicator/src/vertoService/services/vertoService.js b/html5/verto/verto_communicator/src/vertoService/services/vertoService.js index 6f0366740b..7128f1239a 100644 --- a/html5/verto/verto_communicator/src/vertoService/services/vertoService.js +++ b/html5/verto/verto_communicator/src/vertoService/services/vertoService.js @@ -76,6 +76,12 @@ var bandwidth = [{ }, { id: '2048', label: '2mb' +}, { + id: '3196', + label: '3mb' +}, { + id: '4192', + label: '4mb' }, { id: '5120', label: '5mb' @@ -797,6 +803,39 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora } }, + /** + * Do speed test. + * + * @param callback + */ + testSpeed: function(cb) { + + data.instance.rpcClient.speedTest(1024 * 256, function(e, data) { + var upBand = Math.ceil(data.upKPS * .75), + downBand = Math.ceil(data.downKPS * .75); + + + if (storage.data.autoBand) { + storage.data.incomingBandwidth = downBand; + storage.data.outgoingBandwidth = upBand; + storage.data.useDedenc = false; + storage.data.vidQual = 'hd'; + + if (upBand < 512) { + storage.data.vidQual = 'qvga'; + } + else if (upBand < 1024) { + storage.data.vidQual = 'vga'; + } + } + + if(cb) { + cb(data); + } + + $rootScope.$emit('testSpeed', data); + }); + }, /** * Mute the microphone for the current call. * diff --git a/html5/verto/video_demo/index.html b/html5/verto/video_demo/index.html index bd3d98fe4a..276b75b36b 100644 --- a/html5/verto/video_demo/index.html +++ b/html5/verto/video_demo/index.html @@ -91,7 +91,7 @@ div#preload { display: none; }
@@ -108,6 +108,18 @@ div#preload { display: none; }
+
+ + +

Testing Network Connection

+ + + +
+ +