Adds config options to the conference iq sent to the focus.

This commit is contained in:
paweldomas 2014-11-28 16:31:01 +01:00
parent f06f4cd1ba
commit 6b968b1d14
1 changed files with 35 additions and 7 deletions

View File

@ -1,5 +1,5 @@
/* global $, $iq, config, connection, Etherpad, hangUp, Strophe, Toolbar, /* global $, $iq, config, connection, Etherpad, hangUp, roomName, Strophe,
Util, VideoLayout */ Toolbar, Util, VideoLayout */
/** /**
* Contains logic responsible for enabling/disabling functionality available * Contains logic responsible for enabling/disabling functionality available
* only to moderator users. * only to moderator users.
@ -66,16 +66,43 @@ var Moderator = (function (my) {
); );
}; };
// FIXME: we need to show the fact that we're waiting for the focus my.createConferenceIq = function () {
// to the user(or that focus is not available)
my.allocateConferenceFocus = function (roomName, callback) {
var elem = $iq({to: config.hosts.focus, type: 'set'}); var elem = $iq({to: config.hosts.focus, type: 'set'});
elem.c('conference', { elem.c('conference', {
xmlns: 'http://jitsi.org/protocol/focus', xmlns: 'http://jitsi.org/protocol/focus',
room: roomName room: roomName
}); });
if (config.channelLastN !== undefined)
{
elem.c(
'property',
{ name: 'channelLastN', value: config.channelLastN})
.up();
}
if (config.adaptiveLastN !== undefined)
{
elem.c(
'property',
{ name: 'adaptiveLastN', value: config.adaptiveLastN})
.up();
}
if (config.adaptiveSimulcast !== undefined)
{
elem.c(
'property',
{ name: 'adaptiveSimulcast', value: config.adaptiveSimulcast})
.up();
}
elem.up(); elem.up();
connection.sendIQ(elem, return elem;
};
// FIXME: we need to show the fact that we're waiting for the focus
// to the user(or that focus is not available)
my.allocateConferenceFocus = function (roomName, callback) {
var iq = Moderator.createConferenceIq();
connection.sendIQ(
iq,
function (result) { function (result) {
if ('true' === $(result).find('conference').attr('ready')) { if ('true' === $(result).find('conference').attr('ready')) {
// Reset both timers // Reset both timers
@ -89,7 +116,8 @@ var Moderator = (function (my) {
getNextErrorTimeout(true); getNextErrorTimeout(true);
window.setTimeout( window.setTimeout(
function () { function () {
Moderator.allocateConferenceFocus(roomName, callback); Moderator.allocateConferenceFocus(
roomName, callback);
}, waitMs); }, waitMs);
} }
}, },