FS-8401 [verto_communicator] - Added Speaker selection in settings modal and video page.

This commit is contained in:
Jaon EarlWolf 2015-11-17 15:07:00 -03:00
parent c918ec8c4f
commit c2073cb05d
10 changed files with 79 additions and 5 deletions

View File

@ -0,0 +1,18 @@
function attachSinkId(element, sinkId) {
if (typeof element.sinkId !== 'undefined') {
element.setSinkId(sinkId)
.then(function() {
console.log('Success, audio output device attached:', sinkId);
})
.catch(function(error) {
var errorMessage = error;
if (error.name === 'SecurityError') {
errorMessage = 'You need to use HTTPS for selecting audio output ' +
'device: ' + error;
}
console.error(errorMessage);
});
} else {
console.warn('Browser does not support output device selection.');
}
}

View File

@ -605,7 +605,7 @@ body .modal-body .btn-group .btn.active {
}
#incall .video-hover-buttons .btn-group .dropdown-menu {
height: 200px;
max-height: 200px;
overflow: auto;
}

View File

@ -96,6 +96,7 @@
<script type="text/javascript" src="js/3rd-party/getScreenId.js"></script>
<script type="text/javascript" src="js/3rd-party/md5.min.js"></script>
<script type="text/javascript" src="js/3rd-party/volume-meter.js"></script>
<script type="text/javascript" src="js/3rd-party/attachSinkId.js"></script>
<script type="text/javascript" src="src/vertoApp/vertoApp.module.js"></script>

View File

@ -22,10 +22,17 @@
<select name="microphone" id="settings-microphone" class="form-control"
ng-model="mydata.selectedAudio" ng-options="item.id as item.label for item in verto.data.audioDevices">
</select>
<a class="btn btn-primary" href="" ng-click="refreshDeviceList()">Refresh device list</a>
</div>
<div class="form-group">
<label for="settings-microphone">Speaker:</label>
<select name="microphone" id="settings-microphone" class="form-control"
ng-model="mydata.selectedSpeaker" ng-options="item.id as item.label for item in verto.data.speakerDevices">
</select>
</div>
<a class="btn btn-primary" href="" ng-click="refreshDeviceList()">Refresh device list</a>
<div class="form-group">
<label for="settings-microphone">General settings:</label>
<div class="checkbox">

View File

@ -57,6 +57,17 @@
class="btn btn-material-blue-900" ng-click="toggleChat()" ng-show="fullscreenEnabled">
<i class="mdi-communication-chat"></i>
</button>
<div class="btn-group">
<button tooltip-placement="bottom" tooltip-title="Speaker" uib-tooltips="Speaker" type="button" class="btn btn-material-blue-900 dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="mdi-hardware-headset"></i>
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li ng-repeat="speaker in verto.data.speakerDevices">
<a ng-click="confChangeSpeaker(speaker.id)">{{ speaker.label }}</a>
</li>
</ul>
</div>
</div>
</div>
<div class="video-tag-wrapper" id="video-tag-wrapper" ng-dblclick="goFullscreen()" show-controls>

View File

@ -25,6 +25,7 @@
selectedVideo: null,
selectedAudio: null,
selectedShare: null,
selectedSpeaker: null,
useStereo: true,
useSTUN: true,
useDedenc: false,

View File

@ -75,6 +75,10 @@
verto.data.conf.setVideoLayout(layout);
};
$scope.confChangeSpeaker = function(speakerId) {
storage.data.selectedSpeaker = speakerId;
$rootScope.$emit('changedSpeaker', speakerId);
};
$scope.screenshare = function() {
if(verto.data.shareCall) {

View File

@ -34,6 +34,11 @@
$rootScope.$on('config.http.success', function(ev) {
$scope.login(false);
});
$rootScope.$on('changedSpeaker', function(event, speakerId) {
attachSinkId(myVideo, speakerId);
});
/**
* Login the user to verto server and
* redirects him to dialpad page.

View File

@ -4,8 +4,8 @@
angular
.module('vertoControllers')
.controller('ModalSettingsController', ['$scope', '$http',
'$location', '$modalInstance', 'storage', 'verto',
function($scope, $http, $location, $modalInstance, storage, verto) {
'$location', '$modalInstance', '$rootScope', 'storage', 'verto',
function($scope, $http, $location, $modalInstance, $rootScope, storage, verto) {
console.debug('Executing ModalSettingsController.');
$scope.storage = storage;
@ -13,8 +13,12 @@
$scope.mydata = angular.copy(storage.data);
$scope.ok = function() {
if ($scope.mydata.selectedSpeaker != storage.data.selectedSpeaker) {
$rootScope.$emit('changedSpeaker', $scope.mydata.selectedSpeaker);
}
storage.changeData($scope.mydata);
verto.data.instance.iceServers(storage.data.useSTUN);
if (storage.data.autoBand) {
$scope.testSpeed();
}

View File

@ -214,6 +214,7 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora
label: 'Screen'
}];
data.audioDevices = [];
data.speakerDevices = [];
if(!storage.data.selectedShare) {
storage.data.selectedShare = data.shareDevices[0]['id'];
@ -271,6 +272,26 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora
label: device.label || device.id
});
}
for (var i in jQuery.verto.audioOutDevices) {
var device = jQuery.verto.audioOutDevices[i];
// Selecting the first source.
if (i == 0 && !storage.data.selectedSpeaker) {
storage.data.selectedSpeaker = device.id;
}
if (!device.label) {
data.speakerDevices.push({
id: 'Speaker ' + i,
label: 'Speaker ' + i
});
continue;
}
data.speakerDevices.push({
id: device.id,
label: device.label || device.id
});
}
console.debug('Devices were refreshed, checking that we have cameras.');
// This means that we cannot use video!
@ -595,6 +616,7 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora
});
data.instance.deviceParams({
useCamera: storage.data.selectedVideo,
useSpeak: storage.data.selectedSpeaker,
useMic: storage.data.selectedAudio,
onResCheck: that.refreshVideoResolution
});
@ -664,6 +686,7 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora
useVideo: storage.data.useVideo,
useStereo: storage.data.useStereo,
useCamera: storage.data.selectedVideo,
useSpeak: storage.data.selectedSpeaker,
useMic: storage.data.selectedAudio,
dedEnc: storage.data.useDedenc,
mirrorInput: storage.data.mirrorInput,