mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-26 12:37:26 +00:00
FS-7977 - [Verto Communicator] Fixing default resolution and cleaning code
This commit is contained in:
parent
3e78565441
commit
880fb810d0
@ -1040,7 +1040,11 @@ var iceTimer;
|
|||||||
var checkRes = function (cam, func) {
|
var checkRes = function (cam, func) {
|
||||||
|
|
||||||
if (resI >= resList.length) {
|
if (resI >= resList.length) {
|
||||||
if (func) return func();
|
var res = {
|
||||||
|
'validRes': $.FSRTC.validRes,
|
||||||
|
'bestResSupported': $.FSRTC.bestResSupported()
|
||||||
|
};
|
||||||
|
if (func) return func(res);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,8 @@ vertoApp.config(['$routeProvider',
|
|||||||
otherwise({
|
otherwise({
|
||||||
redirectTo: '/login'
|
redirectTo: '/login'
|
||||||
});
|
});
|
||||||
}]);
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
vertoApp.run(['$rootScope', '$location', 'toastr', 'prompt',
|
vertoApp.run(['$rootScope', '$location', 'toastr', 'prompt',
|
||||||
function($rootScope, $location, toastr, prompt) {
|
function($rootScope, $location, toastr, prompt) {
|
||||||
@ -89,4 +90,5 @@ vertoApp.run(['$rootScope', '$location', 'toastr', 'prompt',
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}]);
|
}
|
||||||
|
]);
|
||||||
|
@ -2,7 +2,9 @@
|
|||||||
|
|
||||||
/* Controllers */
|
/* Controllers */
|
||||||
|
|
||||||
var vertoControllers = angular.module('vertoControllers', ['ui.bootstrap', 'vertoService', 'storageService']);
|
var vertoControllers = angular.module('vertoControllers', ['ui.bootstrap',
|
||||||
|
'vertoService', 'storageService'
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
vertoControllers.filter('gravatar',
|
vertoControllers.filter('gravatar',
|
||||||
@ -17,8 +19,11 @@ vertoControllers.filter('gravatar',
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
vertoControllers.controller('MainController', ['$scope', '$rootScope', '$location', '$modal', '$timeout', 'verto', 'storage', 'toastr', 'Fullscreen', 'prompt',
|
vertoControllers.controller('MainController', ['$scope', '$rootScope',
|
||||||
function($scope, $rootScope, $location, $modal, $timeout, verto, storage, toastr, Fullscreen, prompt) {
|
'$location', '$modal', '$timeout', 'verto', 'storage', 'toastr',
|
||||||
|
'Fullscreen', 'prompt',
|
||||||
|
function($scope, $rootScope, $location, $modal,
|
||||||
|
$timeout, verto, storage, toastr, Fullscreen, prompt) {
|
||||||
console.debug('Executing MainController.');
|
console.debug('Executing MainController.');
|
||||||
|
|
||||||
var myVideo = document.getElementById("webcam");
|
var myVideo = document.getElementById("webcam");
|
||||||
@ -84,7 +89,8 @@ vertoControllers.controller('MainController', ['$scope', '$rootScope', '$locatio
|
|||||||
toastr.success('Login successful.', 'Welcome');
|
toastr.success('Login successful.', 'Welcome');
|
||||||
$location.path('/dialpad');
|
$location.path('/dialpad');
|
||||||
} else {
|
} else {
|
||||||
toastr.error('There was an error while trying to login. Please try again.', 'Error');
|
toastr.error('There was an error while trying to login. \
|
||||||
|
Please try again.', 'Error');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -280,7 +286,7 @@ vertoControllers.controller('MainController', ['$scope', '$rootScope', '$locatio
|
|||||||
title: 'Oops, Active Call in Course.',
|
title: 'Oops, Active Call in Course.',
|
||||||
message: 'It seems you were in a call before leaving the last time. Wanna go back to that?'
|
message: 'It seems you were in a call before leaving the last time. Wanna go back to that?'
|
||||||
}).then(function() {
|
}).then(function() {
|
||||||
verto.changeData(storage.data.verto);
|
verto.changeData(angular.fromJson(storage.data.verto));
|
||||||
console.log('redirect to incall page');
|
console.log('redirect to incall page');
|
||||||
$location.path('/incall');
|
$location.path('/incall');
|
||||||
}, function() {
|
}, function() {
|
||||||
@ -337,11 +343,21 @@ vertoControllers.controller('MainController', ['$scope', '$rootScope', '$locatio
|
|||||||
$scope.answerCall();
|
$scope.answerCall();
|
||||||
storage.data.called_number = data;
|
storage.data.called_number = data;
|
||||||
|
|
||||||
storage.data.call_history.unshift({'number': data, 'direction': 'inbound', 'status': true, 'call_start': Date()});
|
storage.data.call_history.unshift({
|
||||||
|
'number': data,
|
||||||
|
'direction': 'inbound',
|
||||||
|
'status': true,
|
||||||
|
'call_start': Date()
|
||||||
|
});
|
||||||
$location.path('/incall');
|
$location.path('/incall');
|
||||||
}, function() {
|
}, function() {
|
||||||
$scope.declineCall();
|
$scope.declineCall();
|
||||||
storage.data.call_history.unshift({'number': data, 'direction': 'inbound', 'status': false, 'call_start': Date()});
|
storage.data.call_history.unshift({
|
||||||
|
'number': data,
|
||||||
|
'direction': 'inbound',
|
||||||
|
'status': false,
|
||||||
|
'call_start': Date()
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -401,7 +417,8 @@ vertoControllers.controller('MainController', ['$scope', '$rootScope', '$locatio
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.play = function() {
|
$scope.play = function() {
|
||||||
var file = $scope.promptInput('Please, enter filename', '', 'File', function(file) {
|
var file = $scope.promptInput('Please, enter filename', '', 'File',
|
||||||
|
function(file) {
|
||||||
verto.data.conf.play(file);
|
verto.data.conf.play(file);
|
||||||
console.log('play file :', file);
|
console.log('play file :', file);
|
||||||
});
|
});
|
||||||
@ -413,7 +430,8 @@ vertoControllers.controller('MainController', ['$scope', '$rootScope', '$locatio
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.record = function() {
|
$scope.record = function() {
|
||||||
var file = $scope.promptInput('Please, enter filename', '', 'File', function(file) {
|
var file = $scope.promptInput('Please, enter filename', '', 'File',
|
||||||
|
function(file) {
|
||||||
verto.data.conf.record(file);
|
verto.data.conf.record(file);
|
||||||
console.log('recording file :', file);
|
console.log('recording file :', file);
|
||||||
});
|
});
|
||||||
@ -424,18 +442,22 @@ vertoControllers.controller('MainController', ['$scope', '$rootScope', '$locatio
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.snapshot = function() {
|
$scope.snapshot = function() {
|
||||||
var file = $scope.promptInput('Please, enter filename', '', 'File', function(file) {
|
var file = $scope.promptInput('Please, enter filename', '', 'File',
|
||||||
|
function(file) {
|
||||||
verto.data.conf.snapshot(file);
|
verto.data.conf.snapshot(file);
|
||||||
console.log('snapshot file :', file);
|
console.log('snapshot file :', file);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
}]);
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
vertoControllers.controller('ChatController', ['$scope', '$rootScope', '$http', '$location', '$anchorScroll', '$timeout', 'verto',
|
vertoControllers.controller('ChatController', ['$scope', '$rootScope', '$http',
|
||||||
function($scope, $rootScope, $http, $location, $anchorScroll, $timeout, verto) {
|
'$location', '$anchorScroll', '$timeout', 'verto',
|
||||||
|
function($scope, $rootScope, $http, $location, $anchorScroll, $timeout,
|
||||||
|
verto) {
|
||||||
console.debug('Executing ChatController.');
|
console.debug('Executing ChatController.');
|
||||||
|
|
||||||
function scrollToChatBottom() {
|
function scrollToChatBottom() {
|
||||||
@ -468,7 +490,8 @@ vertoControllers.controller('ChatController', ['$scope', '$rootScope', '$http',
|
|||||||
console.log('chat.newMessage', data);
|
console.log('chat.newMessage', data);
|
||||||
$scope.$apply(function() {
|
$scope.$apply(function() {
|
||||||
$scope.messages.push(data);
|
$scope.messages.push(data);
|
||||||
if(data.from != verto.data.name && (!$scope.chatStatus || $scope.activePane != 'chat')) {
|
if (data.from != verto.data.name && (!$scope.chatStatus ||
|
||||||
|
$scope.activePane != 'chat')) {
|
||||||
++$rootScope.chat_counter;
|
++$rootScope.chat_counter;
|
||||||
}
|
}
|
||||||
$timeout(function() {
|
$timeout(function() {
|
||||||
@ -543,7 +566,8 @@ vertoControllers.controller('ChatController', ['$scope', '$rootScope', '$http',
|
|||||||
console.log('Didn\'t find the member uuid ' + member.uuid);
|
console.log('Didn\'t find the member uuid ' + member.uuid);
|
||||||
} else {
|
} else {
|
||||||
$scope.$apply(function() {
|
$scope.$apply(function() {
|
||||||
console.log('Updating', memberIdx, ' <', $scope.members[memberIdx], '> with <', member, '>');
|
console.log('Updating', memberIdx, ' <', $scope.members[memberIdx],
|
||||||
|
'> with <', member, '>');
|
||||||
angular.extend($scope.members[memberIdx], member);
|
angular.extend($scope.members[memberIdx], member);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -612,24 +636,32 @@ vertoControllers.controller('ChatController', ['$scope', '$rootScope', '$http',
|
|||||||
var exten = '1800';
|
var exten = '1800';
|
||||||
verto.data.conf.transfer(memberID, exten);
|
verto.data.conf.transfer(memberID, exten);
|
||||||
};
|
};
|
||||||
}]);
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
vertoControllers.controller('MenuController', ['$scope', '$http', '$location', 'verto', 'storage',
|
vertoControllers.controller('MenuController', ['$scope', '$http', '$location',
|
||||||
|
'verto', 'storage',
|
||||||
function($scope, $http, $location, verto, storage) {
|
function($scope, $http, $location, verto, storage) {
|
||||||
console.debug('Executing MenuController.');
|
console.debug('Executing MenuController.');
|
||||||
}]);
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
vertoControllers.controller('ModalSettingsController', ['$scope', '$http', '$location', '$modalInstance', 'verto', 'storage',
|
vertoControllers.controller('ModalSettingsController', ['$scope', '$http',
|
||||||
|
'$location', '$modalInstance', 'verto', 'storage',
|
||||||
function($scope, $http, $location, $modalInstance, verto, storage) {
|
function($scope, $http, $location, $modalInstance, verto, storage) {
|
||||||
console.debug('Executing ModalSettingsController.');
|
console.debug('Executing ModalSettingsController.');
|
||||||
$scope.verto = storage.data.verto;
|
|
||||||
|
|
||||||
|
$scope.verto = verto;
|
||||||
|
$scope.verto = angular.fromJson(storage.data.verto);
|
||||||
$scope.storage = storage;
|
$scope.storage = storage;
|
||||||
|
|
||||||
$scope.ok = function() {
|
$scope.ok = function() {
|
||||||
$modalInstance.close('Ok.');
|
$modalInstance.close('Ok.');
|
||||||
verto.changeData(storage.data.verto);
|
storage.data.verto = angular.toJson($scope.verto);
|
||||||
|
verto.changeData($scope.verto);
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.cancel = function() {
|
$scope.cancel = function() {
|
||||||
@ -639,9 +671,11 @@ vertoControllers.controller('ModalSettingsController', ['$scope', '$http', '$loc
|
|||||||
$scope.refreshDeviceList = function() {
|
$scope.refreshDeviceList = function() {
|
||||||
verto.refreshDevices();
|
verto.refreshDevices();
|
||||||
}
|
}
|
||||||
}]);
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
vertoControllers.controller('ModalLoginInformationController', ['$scope', '$http', '$location', '$modalInstance', 'verto', 'storage',
|
vertoControllers.controller('ModalLoginInformationController', ['$scope',
|
||||||
|
'$http', '$location', '$modalInstance', 'verto', 'storage',
|
||||||
function($scope, $http, $location, $modalInstance, verto, storage) {
|
function($scope, $http, $location, $modalInstance, verto, storage) {
|
||||||
console.debug('Executing ModalLoginInformationController.');
|
console.debug('Executing ModalLoginInformationController.');
|
||||||
|
|
||||||
@ -656,9 +690,11 @@ vertoControllers.controller('ModalLoginInformationController', ['$scope', '$http
|
|||||||
$modalInstance.dismiss('cancel');
|
$modalInstance.dismiss('cancel');
|
||||||
};
|
};
|
||||||
|
|
||||||
}]);
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
vertoControllers.controller('LoginController', ['$scope', '$http', '$location', 'verto',
|
vertoControllers.controller('LoginController', ['$scope', '$http', '$location',
|
||||||
|
'verto',
|
||||||
function($scope, $http, $location, verto) {
|
function($scope, $http, $location, verto) {
|
||||||
$scope.checkBrowser();
|
$scope.checkBrowser();
|
||||||
|
|
||||||
@ -673,10 +709,12 @@ vertoControllers.controller('LoginController', ['$scope', '$http', '$location',
|
|||||||
}
|
}
|
||||||
|
|
||||||
console.debug('Executing LoginController.');
|
console.debug('Executing LoginController.');
|
||||||
}]);
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
vertoControllers.controller('DialPadController', ['$rootScope', '$scope', '$http', '$location', 'toastr', 'verto', 'storage',
|
vertoControllers.controller('DialPadController', ['$rootScope', '$scope',
|
||||||
|
'$http', '$location', 'toastr', 'verto', 'storage',
|
||||||
function($rootScope, $scope, $http, $location, toastr, verto, storage) {
|
function($rootScope, $scope, $http, $location, toastr, verto, storage) {
|
||||||
console.debug('Executing DialPadController.');
|
console.debug('Executing DialPadController.');
|
||||||
|
|
||||||
@ -734,14 +772,22 @@ vertoControllers.controller('DialPadController', ['$rootScope', '$scope', '$http
|
|||||||
verto.call($rootScope.dialpadNumber);
|
verto.call($rootScope.dialpadNumber);
|
||||||
|
|
||||||
storage.data.called_number = $rootScope.dialpadNumber;
|
storage.data.called_number = $rootScope.dialpadNumber;
|
||||||
storage.data.call_history.unshift({'number': $rootScope.dialpadNumber, 'direction': 'outbound', 'call_start': Date()});
|
storage.data.call_history.unshift({
|
||||||
|
'number': $rootScope.dialpadNumber,
|
||||||
|
'direction': 'outbound',
|
||||||
|
'call_start': Date()
|
||||||
|
});
|
||||||
$location.path('/incall');
|
$location.path('/incall');
|
||||||
}
|
}
|
||||||
}]);
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
vertoControllers.controller('InCallController', ['$rootScope', '$scope', '$http', '$location', '$modal', '$timeout', 'toastr', 'verto', 'storage', 'prompt', 'Fullscreen',
|
vertoControllers.controller('InCallController', ['$rootScope', '$scope',
|
||||||
function($rootScope, $scope, $http, $location, $modal, $timeout, toatr, verto, storage, prompt, Fullscreen) {
|
'$http', '$location', '$modal', '$timeout', 'toastr', 'verto', 'storage', 'prompt', 'Fullscreen',
|
||||||
|
function($rootScope, $scope, $http, $location, $modal, $timeout, toatr,
|
||||||
|
verto, storage, prompt, Fullscreen) {
|
||||||
|
|
||||||
console.debug('Executing InCallController.');
|
console.debug('Executing InCallController.');
|
||||||
$scope.layout = null;
|
$scope.layout = null;
|
||||||
$scope.checkBrowser();
|
$scope.checkBrowser();
|
||||||
@ -765,7 +811,8 @@ vertoControllers.controller('InCallController', ['$rootScope', '$scope', '$http'
|
|||||||
* toggle dialpad in incall page
|
* toggle dialpad in incall page
|
||||||
*/
|
*/
|
||||||
$scope.toggleDialpad = function() {
|
$scope.toggleDialpad = function() {
|
||||||
$scope.openModal('partials/dialpad_widget.html', 'ModalDialpadController');
|
$scope.openModal('partials/dialpad_widget.html',
|
||||||
|
'ModalDialpadController');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if(!$scope.dialpadTemplate) {
|
if(!$scope.dialpadTemplate) {
|
||||||
@ -809,9 +856,12 @@ vertoControllers.controller('InCallController', ['$rootScope', '$scope', '$http'
|
|||||||
$scope.$broadcast('timer-start');
|
$scope.$broadcast('timer-start');
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
||||||
}]);
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
vertoControllers.controller('ModalDialpadController', ['$scope', '$modalInstance', function($scope, $modalInstance) {
|
vertoControllers.controller('ModalDialpadController', ['$scope',
|
||||||
|
'$modalInstance',
|
||||||
|
function($scope, $modalInstance) {
|
||||||
|
|
||||||
$scope.ok = function() {
|
$scope.ok = function() {
|
||||||
$modalInstance.close('Ok.');
|
$modalInstance.close('Ok.');
|
||||||
@ -821,15 +871,20 @@ vertoControllers.controller('ModalDialpadController', ['$scope', '$modalInstance
|
|||||||
$modalInstance.dismiss('cancel');
|
$modalInstance.dismiss('cancel');
|
||||||
};
|
};
|
||||||
|
|
||||||
}]);
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
vertoControllers.controller('BrowserUpgradeController', ['$scope', '$http', '$location', 'verto', 'storage', 'Fullscreen',
|
vertoControllers.controller('BrowserUpgradeController', ['$scope', '$http',
|
||||||
|
'$location', 'verto', 'storage', 'Fullscreen',
|
||||||
function($scope, $http, $location, verto, storage, Fullscreen) {
|
function($scope, $http, $location, verto, storage, Fullscreen) {
|
||||||
console.debug('Executing BrowserUpgradeController.');
|
console.debug('Executing BrowserUpgradeController.');
|
||||||
|
|
||||||
}]);
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
vertoControllers.controller('ContributorsController', ['$scope', '$http', 'toastr', function($scope, $http, toastr) {
|
vertoControllers.controller('ContributorsController', ['$scope', '$http',
|
||||||
|
'toastr',
|
||||||
|
function($scope, $http, toastr) {
|
||||||
$http.get(window.location.pathname + '/contributors.txt')
|
$http.get(window.location.pathname + '/contributors.txt')
|
||||||
.success(function(data) {
|
.success(function(data) {
|
||||||
|
|
||||||
@ -851,4 +906,5 @@ vertoControllers.controller('ContributorsController', ['$scope', '$http', 'toast
|
|||||||
.error(function() {
|
.error(function() {
|
||||||
toastr.error('contributors not found.');
|
toastr.error('contributors not found.');
|
||||||
});
|
});
|
||||||
}]);
|
}
|
||||||
|
]);
|
||||||
|
@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
var storageService = angular.module('storageService', ['ngStorage']);
|
var storageService = angular.module('storageService', ['ngStorage']);
|
||||||
|
|
||||||
storageService.service('storage', ['$rootScope', '$localStorage', 'verto', function($rootScope, $localStorage, verto) {
|
storageService.service('storage', ['$rootScope', '$localStorage', 'verto',
|
||||||
|
function($rootScope, $localStorage, verto) {
|
||||||
var data = $localStorage;
|
var data = $localStorage;
|
||||||
|
|
||||||
data.$default({
|
data.$default({
|
||||||
@ -20,7 +21,7 @@ storageService.service('storage', ['$rootScope', '$localStorage', 'verto', funct
|
|||||||
userStatus: 'disconnected',
|
userStatus: 'disconnected',
|
||||||
mutedVideo: false,
|
mutedVideo: false,
|
||||||
mutedMic: false,
|
mutedMic: false,
|
||||||
verto: verto
|
verto: angular.toJson(verto)
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@ -32,4 +33,5 @@ storageService.service('storage', ['$rootScope', '$localStorage', 'verto', funct
|
|||||||
data.userStatus = 'disconnected';
|
data.userStatus = 'disconnected';
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}]);
|
}
|
||||||
|
]);
|
||||||
|
@ -2,38 +2,95 @@
|
|||||||
|
|
||||||
/* Controllers */
|
/* Controllers */
|
||||||
|
|
||||||
var videoQuality = [
|
var videoQuality = [{
|
||||||
{id: 'qvga', label: 'QVGA 320x240'},
|
id: 'qvga',
|
||||||
{id: 'vga', label: 'VGA 640x480'},
|
label: 'QVGA 320x240',
|
||||||
{id: 'qvga_wide', label: 'QVGA WIDE 320x180'},
|
width: 320,
|
||||||
{id: 'vga_wide', label: 'VGA WIDE 640x360'},
|
height: 240
|
||||||
{id: 'hd', label: 'HD 1280x720'},
|
}, {
|
||||||
{id: 'hhd', label: 'HHD 1920x1080'},
|
id: 'vga',
|
||||||
];
|
label: 'VGA 640x480',
|
||||||
|
width: 640,
|
||||||
|
height: 480
|
||||||
|
}, {
|
||||||
|
id: 'qvga_wide',
|
||||||
|
label: 'QVGA WIDE 320x180',
|
||||||
|
width: 320,
|
||||||
|
height: 180
|
||||||
|
}, {
|
||||||
|
id: 'vga_wide',
|
||||||
|
label: 'VGA WIDE 640x360',
|
||||||
|
width: 640,
|
||||||
|
height: 360
|
||||||
|
}, {
|
||||||
|
id: 'hd',
|
||||||
|
label: 'HD 1280x720',
|
||||||
|
width: 1280,
|
||||||
|
height: 720
|
||||||
|
}, {
|
||||||
|
id: 'hhd',
|
||||||
|
label: 'HHD 1920x1080',
|
||||||
|
width: 1920,
|
||||||
|
height: 1080
|
||||||
|
}, ];
|
||||||
|
|
||||||
var videoResolution = {
|
var videoResolution = {
|
||||||
qvga: {width: 320, height: 240},
|
qvga: {
|
||||||
vga: {width: 640, height: 480},
|
width: 320,
|
||||||
qvga_wide: {width: 320, height: 180},
|
height: 240
|
||||||
vga_wide: {width: 640, height: 360},
|
},
|
||||||
hd: {width: 1280, height: 720},
|
vga: {
|
||||||
hhd: {width: 1920, height: 1080},
|
width: 640,
|
||||||
|
height: 480
|
||||||
|
},
|
||||||
|
qvga_wide: {
|
||||||
|
width: 320,
|
||||||
|
height: 180
|
||||||
|
},
|
||||||
|
vga_wide: {
|
||||||
|
width: 640,
|
||||||
|
height: 360
|
||||||
|
},
|
||||||
|
hd: {
|
||||||
|
width: 1280,
|
||||||
|
height: 720
|
||||||
|
},
|
||||||
|
hhd: {
|
||||||
|
width: 1920,
|
||||||
|
height: 1080
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
var bandwidth = [
|
var bandwidth = [{
|
||||||
{id: '250', label: '250kb'},
|
id: '250',
|
||||||
{id: '500', label: '500kb'},
|
label: '250kb'
|
||||||
{id: '1024', label: '1mb'},
|
}, {
|
||||||
{id: '1536', label: '1.5mb'},
|
id: '500',
|
||||||
{id: '2048', label: '2mb'},
|
label: '500kb'
|
||||||
{id: '5120', label: '5mb'},
|
}, {
|
||||||
{id: '0', label: 'No Limit'},
|
id: '1024',
|
||||||
{id: 'default', label: 'Server Default'},
|
label: '1mb'
|
||||||
];
|
}, {
|
||||||
|
id: '1536',
|
||||||
|
label: '1.5mb'
|
||||||
|
}, {
|
||||||
|
id: '2048',
|
||||||
|
label: '2mb'
|
||||||
|
}, {
|
||||||
|
id: '5120',
|
||||||
|
label: '5mb'
|
||||||
|
}, {
|
||||||
|
id: '0',
|
||||||
|
label: 'No Limit'
|
||||||
|
}, {
|
||||||
|
id: 'default',
|
||||||
|
label: 'Server Default'
|
||||||
|
}, ];
|
||||||
|
|
||||||
var vertoService = angular.module('vertoService', ['ngCookies']);
|
var vertoService = angular.module('vertoService', ['ngCookies']);
|
||||||
|
|
||||||
vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', function($rootScope, $cookieStore, $location) {
|
vertoService.service('verto', ['$rootScope', '$cookieStore', '$location',
|
||||||
|
function($rootScope, $cookieStore, $location) {
|
||||||
var data = {
|
var data = {
|
||||||
// Connection data.
|
// Connection data.
|
||||||
instance: null,
|
instance: null,
|
||||||
@ -72,6 +129,8 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', functi
|
|||||||
incomingBandwidth: $cookieStore.get('verto_demo_incomingBandwidth') || 'default',
|
incomingBandwidth: $cookieStore.get('verto_demo_incomingBandwidth') || 'default',
|
||||||
vidQual: $cookieStore.get('verto_demo_vqual') || 'qvga',
|
vidQual: $cookieStore.get('verto_demo_vqual') || 'qvga',
|
||||||
localVideo: $cookieStore.get('verto_demo_local_video_checked') || false,
|
localVideo: $cookieStore.get('verto_demo_local_video_checked') || false,
|
||||||
|
bestWidth: '',
|
||||||
|
bestHeight: '',
|
||||||
selectedVideo: null,
|
selectedVideo: null,
|
||||||
selectedAudio: null,
|
selectedAudio: null,
|
||||||
selectedShare: null
|
selectedShare: null
|
||||||
@ -112,11 +171,24 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', functi
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getVideoParams() {
|
function getVideoParams() {
|
||||||
|
var maxWidth, maxHeight;
|
||||||
|
|
||||||
|
maxWidth = data.bestWidth;
|
||||||
|
maxHeight = data.bestHeight;
|
||||||
|
|
||||||
|
if(!data.bestWidth) {
|
||||||
|
maxWidth = videoResolution[data.vidQual].width;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!data.bestHeight) {
|
||||||
|
maxHeight = videoResolution[data.vidQual].height;
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
minWidth: videoResolution[data.vidQual].width,
|
minWidth: videoResolution[data.vidQual].width,
|
||||||
minHeight: videoResolution[data.vidQual].height,
|
minHeight: videoResolution[data.vidQual].height,
|
||||||
maxWidth: videoResolution[data.vidQual].width,
|
maxWidth: maxWidth,
|
||||||
maxHeight: videoResolution[data.vidQual].height
|
maxHeight: maxHeight
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,8 +233,14 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', functi
|
|||||||
console.debug('Attempting to refresh the devices.');
|
console.debug('Attempting to refresh the devices.');
|
||||||
|
|
||||||
|
|
||||||
data.videoDevices = [{id: 'none', label: 'No camera'}];
|
data.videoDevices = [{
|
||||||
data.shareDevices = [{id: 'screen', label: 'Screen'}];
|
id: 'none',
|
||||||
|
label: 'No camera'
|
||||||
|
}];
|
||||||
|
data.shareDevices = [{
|
||||||
|
id: 'screen',
|
||||||
|
label: 'Screen'
|
||||||
|
}];
|
||||||
data.audioDevices = [];
|
data.audioDevices = [];
|
||||||
|
|
||||||
data.selectedVideo = 'none';
|
data.selectedVideo = 'none';
|
||||||
@ -172,9 +250,15 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', functi
|
|||||||
for (var i in jQuery.verto.videoDevices) {
|
for (var i in jQuery.verto.videoDevices) {
|
||||||
var device = jQuery.verto.videoDevices[i];
|
var device = jQuery.verto.videoDevices[i];
|
||||||
if (!device.label) {
|
if (!device.label) {
|
||||||
data.videoDevices.push({id: 'Camera ' + i, label: 'Camera ' + i});
|
data.videoDevices.push({
|
||||||
|
id: 'Camera ' + i,
|
||||||
|
label: 'Camera ' + i
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
data.videoDevices.push({id: device.id, label: device.label || device.id});
|
data.videoDevices.push({
|
||||||
|
id: device.id,
|
||||||
|
label: device.label || device.id
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Selecting the first source.
|
// Selecting the first source.
|
||||||
@ -183,11 +267,17 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', functi
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!device.label) {
|
if (!device.label) {
|
||||||
data.shareDevices.push({id: 'Share Device ' + i, label: 'Share Device ' + i});
|
data.shareDevices.push({
|
||||||
|
id: 'Share Device ' + i,
|
||||||
|
label: 'Share Device ' + i
|
||||||
|
});
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
data.shareDevices.push({id: device.id, label: device.label || device.id});
|
data.shareDevices.push({
|
||||||
|
id: device.id,
|
||||||
|
label: device.label || device.id
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
data.audioDevices = [];
|
data.audioDevices = [];
|
||||||
@ -199,10 +289,16 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', functi
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!device.label) {
|
if (!device.label) {
|
||||||
data.audioDevices.push({id: 'Microphone ' + i, label: 'Microphone ' + i});
|
data.audioDevices.push({
|
||||||
|
id: 'Microphone ' + i,
|
||||||
|
label: 'Microphone ' + i
|
||||||
|
});
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
data.audioDevices.push({id: device.id, label: device.label || device.id});
|
data.audioDevices.push({
|
||||||
|
id: device.id,
|
||||||
|
label: device.label || device.id
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
console.debug('Devices were refreshed.');
|
console.debug('Devices were refreshed.');
|
||||||
@ -230,6 +326,35 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', functi
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
updateResolutions: function(supportedResolutions) {
|
||||||
|
console.debug('Attempting to sync supported and available resolutions');
|
||||||
|
|
||||||
|
var removed = 0;
|
||||||
|
|
||||||
|
angular.forEach(videoQuality, function(resolution, id) {
|
||||||
|
var supported = false;
|
||||||
|
angular.forEach(supportedResolutions, function(res) {
|
||||||
|
var width = res[0];
|
||||||
|
var height = res[1];
|
||||||
|
|
||||||
|
if(resolution.width == width && resolution.height == height) {
|
||||||
|
supported = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if(!supported) {
|
||||||
|
delete videoQuality[id];
|
||||||
|
++removed;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
videoQuality.length = videoQuality.length - removed;
|
||||||
|
this.videoQuality = videoQuality;
|
||||||
|
this.data.vidQual = videoQuality[videoQuality.length - 1].id;
|
||||||
|
|
||||||
|
return videoQuality;
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Connects to the verto server. Automatically calls `onWSLogin`
|
* Connects to the verto server. Automatically calls `onWSLogin`
|
||||||
* callback set in the verto object.
|
* callback set in the verto object.
|
||||||
@ -268,8 +393,11 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', functi
|
|||||||
|
|
||||||
data.liveArray = new $.verto.liveArray(
|
data.liveArray = new $.verto.liveArray(
|
||||||
data.instance, pvtData.laChannel,
|
data.instance, pvtData.laChannel,
|
||||||
pvtData.laName,
|
pvtData.laName, {
|
||||||
{subParams: {callID: dialog ? dialog.callID : null}});
|
subParams: {
|
||||||
|
callID: dialog ? dialog.callID : null
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
data.liveArray.onErr = function(obj, args) {
|
data.liveArray.onErr = function(obj, args) {
|
||||||
console.log('liveArray.onErr', obj, args);
|
console.log('liveArray.onErr', obj, args);
|
||||||
@ -346,7 +474,10 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', functi
|
|||||||
case $.verto.enum.message.info:
|
case $.verto.enum.message.info:
|
||||||
var body = params.body;
|
var body = params.body;
|
||||||
var from = params.from_msg_name || params.from;
|
var from = params.from_msg_name || params.from;
|
||||||
$rootScope.$emit('chat.newMessage', {from: from, body: body});
|
$rootScope.$emit('chat.newMessage', {
|
||||||
|
from: from,
|
||||||
|
body: body
|
||||||
|
});
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -404,7 +535,11 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', functi
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var init = function() {
|
var init = function(resolutions) {
|
||||||
|
data.bestWidth = resolutions['bestResSupported'][0];
|
||||||
|
data.bestHeight = resolutions['bestResSupported'][1];
|
||||||
|
|
||||||
|
that.updateResolutions(resolutions['validRes']);
|
||||||
|
|
||||||
that.refreshVideoResolution();
|
that.refreshVideoResolution();
|
||||||
|
|
||||||
@ -648,4 +783,5 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', functi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}]);
|
}
|
||||||
|
]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user