2013-12-16 11:22:23 +00:00
|
|
|
/* jshint -W117 */
|
|
|
|
/* application specific logic */
|
|
|
|
var connection = null;
|
2014-08-08 16:20:50 +00:00
|
|
|
var authenticatedUser = false;
|
2013-12-16 11:22:23 +00:00
|
|
|
var focus = null;
|
2014-02-27 07:19:06 +00:00
|
|
|
var activecall = null;
|
|
|
|
var RTC = null;
|
2013-12-16 11:22:23 +00:00
|
|
|
var nickname = null;
|
|
|
|
var sharedKey = '';
|
2014-07-01 14:02:34 +00:00
|
|
|
var recordingToken ='';
|
2013-12-16 11:22:23 +00:00
|
|
|
var roomUrl = null;
|
2014-08-08 13:25:24 +00:00
|
|
|
var roomName = null;
|
2014-01-09 20:44:37 +00:00
|
|
|
var ssrc2jid = {};
|
2014-08-22 15:37:11 +00:00
|
|
|
var mediaStreams = [];
|
2014-08-14 15:29:28 +00:00
|
|
|
var bridgeIsDown = false;
|
2014-08-22 15:37:11 +00:00
|
|
|
|
2014-06-05 11:09:31 +00:00
|
|
|
/**
|
|
|
|
* The stats collector that process stats data and triggers updates to app.js.
|
|
|
|
* @type {StatsCollector}
|
|
|
|
*/
|
|
|
|
var statsCollector = null;
|
2014-03-26 18:06:34 +00:00
|
|
|
|
2014-06-26 14:58:43 +00:00
|
|
|
/**
|
|
|
|
* The stats collector for the local stream.
|
|
|
|
* @type {LocalStatsCollector}
|
|
|
|
*/
|
|
|
|
var localStatsCollector = null;
|
|
|
|
|
2014-03-26 18:06:34 +00:00
|
|
|
/**
|
|
|
|
* Indicates whether ssrc is camera video or desktop stream.
|
|
|
|
* FIXME: remove those maps
|
|
|
|
*/
|
|
|
|
var ssrc2videoType = {};
|
|
|
|
var videoSrcToSsrc = {};
|
2014-05-19 13:53:45 +00:00
|
|
|
/**
|
|
|
|
* Currently focused video "src"(displayed in large video).
|
|
|
|
* @type {String}
|
|
|
|
*/
|
|
|
|
var focusedVideoSrc = null;
|
2014-05-11 22:41:58 +00:00
|
|
|
var mutedAudios = {};
|
2014-03-26 18:06:34 +00:00
|
|
|
|
2014-01-15 09:29:27 +00:00
|
|
|
var localVideoSrc = null;
|
2014-03-17 09:02:40 +00:00
|
|
|
var flipXLocalVideo = true;
|
2014-03-26 10:33:46 +00:00
|
|
|
var isFullScreen = false;
|
|
|
|
var currentVideoWidth = null;
|
|
|
|
var currentVideoHeight = null;
|
2014-03-26 18:06:34 +00:00
|
|
|
/**
|
|
|
|
* Method used to calculate large video size.
|
2014-04-13 12:30:47 +00:00
|
|
|
* @type {function ()}
|
2014-03-26 18:06:34 +00:00
|
|
|
*/
|
|
|
|
var getVideoSize;
|
2014-03-28 09:37:14 +00:00
|
|
|
/**
|
|
|
|
* Method used to get large video position.
|
2014-04-13 12:30:47 +00:00
|
|
|
* @type {function ()}
|
2014-03-28 09:37:14 +00:00
|
|
|
*/
|
|
|
|
var getVideoPosition;
|
2013-12-16 11:22:23 +00:00
|
|
|
|
2014-01-11 16:16:46 +00:00
|
|
|
/* window.onbeforeunload = closePageWarning; */
|
2013-12-20 14:19:17 +00:00
|
|
|
|
2014-05-12 09:56:33 +00:00
|
|
|
var sessionTerminated = false;
|
|
|
|
|
2013-12-16 11:22:23 +00:00
|
|
|
function init() {
|
2014-09-23 12:27:12 +00:00
|
|
|
Toolbar.setupButtonsFromConfig();
|
2013-12-16 11:22:23 +00:00
|
|
|
RTC = setupRTC();
|
|
|
|
if (RTC === null) {
|
2013-12-30 08:23:23 +00:00
|
|
|
window.location.href = 'webrtcrequired.html';
|
2013-12-16 11:22:23 +00:00
|
|
|
return;
|
2014-03-01 07:39:39 +00:00
|
|
|
} else if (RTC.browser !== 'chrome') {
|
2013-12-30 08:23:23 +00:00
|
|
|
window.location.href = 'chromeonly.html';
|
2013-12-16 11:22:23 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-08-25 13:29:54 +00:00
|
|
|
obtainAudioAndVideoPermissions(function (stream) {
|
2014-08-21 09:58:33 +00:00
|
|
|
var audioStream = new webkitMediaStream();
|
|
|
|
var videoStream = new webkitMediaStream();
|
2014-08-25 13:29:54 +00:00
|
|
|
var audioTracks = stream.getAudioTracks();
|
2014-08-21 09:58:33 +00:00
|
|
|
var videoTracks = stream.getVideoTracks();
|
|
|
|
for (var i = 0; i < audioTracks.length; i++) {
|
|
|
|
audioStream.addTrack(audioTracks[i]);
|
2014-08-25 13:29:54 +00:00
|
|
|
}
|
|
|
|
VideoLayout.changeLocalAudio(audioStream);
|
|
|
|
startLocalRtpStatsCollector(audioStream);
|
|
|
|
|
2014-08-21 09:58:33 +00:00
|
|
|
for (i = 0; i < videoTracks.length; i++) {
|
|
|
|
videoStream.addTrack(videoTracks[i]);
|
2014-08-25 13:29:54 +00:00
|
|
|
}
|
|
|
|
VideoLayout.changeLocalVideo(videoStream, true);
|
|
|
|
maybeDoJoin();
|
|
|
|
});
|
|
|
|
|
2014-08-05 09:13:21 +00:00
|
|
|
var jid = document.getElementById('jid').value || config.hosts.anonymousdomain || config.hosts.domain || window.location.hostname;
|
2014-08-05 07:39:04 +00:00
|
|
|
connect(jid);
|
|
|
|
}
|
|
|
|
|
|
|
|
function connect(jid, password) {
|
2014-09-02 19:11:54 +00:00
|
|
|
var localAudio, localVideo;
|
|
|
|
if (connection && connection.jingle) {
|
|
|
|
localAudio = connection.jingle.localAudio;
|
|
|
|
localVideo = connection.jingle.localVideo;
|
|
|
|
}
|
2013-12-16 11:22:23 +00:00
|
|
|
connection = new Strophe.Connection(document.getElementById('boshURL').value || config.bosh || '/http-bind');
|
2014-02-11 14:05:17 +00:00
|
|
|
|
|
|
|
if (nickname) {
|
|
|
|
connection.emuc.addDisplayNameToPresence(nickname);
|
|
|
|
}
|
|
|
|
|
2013-12-30 08:23:23 +00:00
|
|
|
if (connection.disco) {
|
|
|
|
// for chrome, add multistream cap
|
|
|
|
}
|
2013-12-16 11:22:23 +00:00
|
|
|
connection.jingle.pc_constraints = RTC.pc_constraints;
|
2014-01-26 14:43:43 +00:00
|
|
|
if (config.useIPv6) {
|
|
|
|
// https://code.google.com/p/webrtc/issues/detail?id=2828
|
|
|
|
if (!connection.jingle.pc_constraints.optional) connection.jingle.pc_constraints.optional = [];
|
|
|
|
connection.jingle.pc_constraints.optional.push({googIPv6: true});
|
|
|
|
}
|
2014-09-02 19:11:54 +00:00
|
|
|
if (localAudio) connection.jingle.localAudio = localAudio;
|
|
|
|
if (localVideo) connection.jingle.localVideo = localVideo;
|
2013-12-16 11:22:23 +00:00
|
|
|
|
2014-08-05 07:39:04 +00:00
|
|
|
if(!password)
|
|
|
|
password = document.getElementById('password').value;
|
2013-12-16 11:22:23 +00:00
|
|
|
|
2014-08-05 07:39:04 +00:00
|
|
|
var anonymousConnectionFailed = false;
|
|
|
|
connection.connect(jid, password, function (status, msg) {
|
2014-10-13 17:34:23 +00:00
|
|
|
console.log('Strophe status changed to', Strophe.getStatusString(status));
|
2014-03-01 07:39:39 +00:00
|
|
|
if (status === Strophe.Status.CONNECTED) {
|
2014-01-26 12:18:12 +00:00
|
|
|
if (config.useStunTurn) {
|
|
|
|
connection.jingle.getStunAndTurnCredentials();
|
|
|
|
}
|
2013-12-16 11:22:23 +00:00
|
|
|
document.getElementById('connect').disabled = true;
|
2014-08-08 16:20:50 +00:00
|
|
|
|
|
|
|
if(password)
|
|
|
|
authenticatedUser = true;
|
2014-08-25 13:29:54 +00:00
|
|
|
maybeDoJoin();
|
2014-08-05 07:39:04 +00:00
|
|
|
} else if (status === Strophe.Status.CONNFAIL) {
|
|
|
|
if(msg === 'x-strophe-bad-non-anon-jid') {
|
|
|
|
anonymousConnectionFailed = true;
|
|
|
|
}
|
|
|
|
} else if (status === Strophe.Status.DISCONNECTED) {
|
|
|
|
if(anonymousConnectionFailed) {
|
|
|
|
// prompt user for username and password
|
|
|
|
$(document).trigger('passwordrequired.main');
|
|
|
|
}
|
|
|
|
} else if (status === Strophe.Status.AUTHFAIL) {
|
|
|
|
// wrong password or username, prompt user
|
|
|
|
$(document).trigger('passwordrequired.main');
|
|
|
|
|
2013-12-16 11:22:23 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2014-03-24 17:31:59 +00:00
|
|
|
/**
|
2014-08-26 11:02:17 +00:00
|
|
|
* We ask for audio and video combined stream in order to get permissions and
|
|
|
|
* not to ask twice.
|
2014-03-24 17:31:59 +00:00
|
|
|
*/
|
2014-04-13 12:30:47 +00:00
|
|
|
function obtainAudioAndVideoPermissions(callback) {
|
2014-03-24 17:31:59 +00:00
|
|
|
// Get AV
|
|
|
|
getUserMediaWithConstraints(
|
|
|
|
['audio', 'video'],
|
2014-04-13 12:30:47 +00:00
|
|
|
function (avStream) {
|
2014-08-25 13:04:59 +00:00
|
|
|
callback(avStream);
|
2014-08-25 14:15:52 +00:00
|
|
|
trackUsage('localMedia', {
|
|
|
|
audio: avStream.getAudioTracks().length,
|
|
|
|
video: avStream.getVideoTracks().length
|
|
|
|
});
|
2014-03-24 17:31:59 +00:00
|
|
|
},
|
2014-04-13 12:30:47 +00:00
|
|
|
function (error) {
|
2014-03-24 17:31:59 +00:00
|
|
|
console.error('failed to obtain audio/video stream - stop', error);
|
2014-08-25 14:15:52 +00:00
|
|
|
trackUsage('localMediaError', {
|
|
|
|
media: error.media || 'video',
|
|
|
|
name : error.name
|
|
|
|
});
|
2014-08-14 15:29:28 +00:00
|
|
|
messageHandler.showError("Error",
|
|
|
|
"Failed to obtain permissions to use the local microphone" +
|
|
|
|
"and/or camera.");
|
2014-08-25 14:02:18 +00:00
|
|
|
},
|
|
|
|
config.resolution || '360');
|
2014-03-24 17:31:59 +00:00
|
|
|
}
|
|
|
|
|
2014-08-25 13:29:54 +00:00
|
|
|
function maybeDoJoin() {
|
|
|
|
if (connection && connection.connected && Strophe.getResourceFromJid(connection.jid) // .connected is true while connecting?
|
|
|
|
&& (connection.jingle.localAudio || connection.jingle.localVideo)) {
|
2014-03-12 15:08:24 +00:00
|
|
|
doJoin();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-12-16 11:22:23 +00:00
|
|
|
function doJoin() {
|
|
|
|
var roomnode = null;
|
|
|
|
var path = window.location.pathname;
|
|
|
|
var roomjid;
|
2014-01-10 21:06:20 +00:00
|
|
|
|
|
|
|
// determinde the room node from the url
|
|
|
|
// TODO: just the roomnode or the whole bare jid?
|
|
|
|
if (config.getroomnode && typeof config.getroomnode === 'function') {
|
|
|
|
// custom function might be responsible for doing the pushstate
|
|
|
|
roomnode = config.getroomnode(path);
|
2013-12-16 11:22:23 +00:00
|
|
|
} else {
|
2014-01-10 21:06:20 +00:00
|
|
|
/* fall back to default strategy
|
|
|
|
* this is making assumptions about how the URL->room mapping happens.
|
|
|
|
* It currently assumes deployment at root, with a rewrite like the
|
|
|
|
* following one (for nginx):
|
|
|
|
location ~ ^/([a-zA-Z0-9]+)$ {
|
|
|
|
rewrite ^/(.*)$ / break;
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
if (path.length > 1) {
|
|
|
|
roomnode = path.substr(1).toLowerCase();
|
|
|
|
} else {
|
2014-10-01 19:21:57 +00:00
|
|
|
var word = RoomNameGenerator.generateRoomWithoutSeparator();
|
2014-08-28 09:17:00 +00:00
|
|
|
roomnode = word.toLowerCase();
|
2014-08-27 09:25:50 +00:00
|
|
|
|
2014-02-26 15:19:39 +00:00
|
|
|
window.history.pushState('VideoChat',
|
2014-08-28 09:17:00 +00:00
|
|
|
'Room: ' + word, window.location.pathname + word);
|
2014-01-10 21:06:20 +00:00
|
|
|
}
|
2013-12-16 11:22:23 +00:00
|
|
|
}
|
2014-02-12 22:24:26 +00:00
|
|
|
|
2014-08-08 13:25:24 +00:00
|
|
|
roomName = roomnode + '@' + config.hosts.muc;
|
|
|
|
|
|
|
|
roomjid = roomName;
|
2013-12-16 11:22:23 +00:00
|
|
|
|
|
|
|
if (config.useNicks) {
|
|
|
|
var nick = window.prompt('Your nickname (optional)');
|
|
|
|
if (nick) {
|
|
|
|
roomjid += '/' + nick;
|
|
|
|
} else {
|
|
|
|
roomjid += '/' + Strophe.getNodeFromJid(connection.jid);
|
|
|
|
}
|
|
|
|
} else {
|
2014-08-08 16:20:50 +00:00
|
|
|
|
|
|
|
var tmpJid = Strophe.getNodeFromJid(connection.jid);
|
|
|
|
|
|
|
|
if(!authenticatedUser)
|
|
|
|
tmpJid = tmpJid.substr(0, 8);
|
|
|
|
|
|
|
|
roomjid += '/' + tmpJid;
|
2013-12-16 11:22:23 +00:00
|
|
|
}
|
|
|
|
connection.emuc.doJoin(roomjid);
|
|
|
|
}
|
|
|
|
|
2014-08-22 15:37:11 +00:00
|
|
|
function waitForRemoteVideo(selector, ssrc, stream) {
|
|
|
|
if (selector.removed || !selector.parent().is(":visible")) {
|
|
|
|
console.warn("Media removed before had started", selector);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (stream.id === 'mixedmslabel') return;
|
2014-03-26 18:06:34 +00:00
|
|
|
|
2014-08-22 15:37:11 +00:00
|
|
|
if (selector[0].currentTime > 0) {
|
2014-08-21 09:58:33 +00:00
|
|
|
var videoStream = simulcast.getReceivingVideoStream(stream);
|
|
|
|
RTC.attachMediaStream(selector, videoStream); // FIXME: why do i have to do this for FF?
|
2014-08-22 15:37:11 +00:00
|
|
|
|
|
|
|
// FIXME: add a class that will associate peer Jid, video.src, it's ssrc and video type
|
|
|
|
// in order to get rid of too many maps
|
|
|
|
if (ssrc && selector.attr('src')) {
|
|
|
|
videoSrcToSsrc[selector.attr('src')] = ssrc;
|
2013-12-16 11:22:23 +00:00
|
|
|
} else {
|
2014-08-22 15:37:11 +00:00
|
|
|
console.warn("No ssrc given for video", selector);
|
2014-08-14 15:29:28 +00:00
|
|
|
messageHandler.showError('Warning', 'No ssrc was given for the video.');
|
2013-12-16 11:22:23 +00:00
|
|
|
}
|
2014-08-22 15:37:11 +00:00
|
|
|
|
|
|
|
$(document).trigger('videoactive.jingle', [selector]);
|
|
|
|
} else {
|
|
|
|
setTimeout(function () {
|
|
|
|
waitForRemoteVideo(selector, ssrc, stream);
|
|
|
|
}, 250);
|
2013-12-16 11:22:23 +00:00
|
|
|
}
|
2014-08-22 15:37:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$(document).bind('remotestreamadded.jingle', function (event, data, sid) {
|
2014-08-21 09:58:33 +00:00
|
|
|
waitForPresence(data, sid);
|
|
|
|
});
|
|
|
|
|
|
|
|
function waitForPresence(data, sid) {
|
2013-12-16 11:22:23 +00:00
|
|
|
var sess = connection.jingle.sessions[sid];
|
2014-01-09 20:44:37 +00:00
|
|
|
|
2014-03-26 18:06:34 +00:00
|
|
|
var thessrc;
|
2014-01-09 20:44:37 +00:00
|
|
|
// look up an associated JID for a stream id
|
2014-03-01 07:39:39 +00:00
|
|
|
if (data.stream.id.indexOf('mixedmslabel') === -1) {
|
2014-08-21 09:58:33 +00:00
|
|
|
// look only at a=ssrc: and _not_ at a=ssrc-group: lines
|
2014-08-22 15:37:11 +00:00
|
|
|
var ssrclines
|
2014-08-21 09:58:33 +00:00
|
|
|
= SDPUtil.find_lines(sess.peerconnection.remoteDescription.sdp, 'a=ssrc:');
|
2014-01-09 20:44:37 +00:00
|
|
|
ssrclines = ssrclines.filter(function (line) {
|
2014-09-12 17:54:40 +00:00
|
|
|
// NOTE(gp) previously we filtered on the mslabel, but that property
|
|
|
|
// is not always present.
|
|
|
|
// return line.indexOf('mslabel:' + data.stream.label) !== -1;
|
|
|
|
return line.indexOf('msid:' + data.stream.id) !== -1;
|
2014-04-13 12:30:47 +00:00
|
|
|
});
|
2014-01-09 20:44:37 +00:00
|
|
|
if (ssrclines.length) {
|
|
|
|
thessrc = ssrclines[0].substring(7).split(' ')[0];
|
2014-08-21 09:58:33 +00:00
|
|
|
|
|
|
|
// We signal our streams (through Jingle to the focus) before we set
|
|
|
|
// our presence (through which peers associate remote streams to
|
|
|
|
// jids). So, it might arrive that a remote stream is added but
|
|
|
|
// ssrc2jid is not yet updated and thus data.peerjid cannot be
|
|
|
|
// successfully set. Here we wait for up to a second for the
|
|
|
|
// presence to arrive.
|
|
|
|
|
|
|
|
if (!ssrc2jid[thessrc]) {
|
2014-09-12 17:54:40 +00:00
|
|
|
// TODO(gp) limit wait duration to 1 sec.
|
2014-08-21 09:58:33 +00:00
|
|
|
setTimeout(function(d, s) {
|
|
|
|
return function() {
|
|
|
|
waitForPresence(d, s);
|
|
|
|
}
|
|
|
|
}(data, sid), 250);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-01-09 20:44:37 +00:00
|
|
|
// ok to overwrite the one from focus? might save work in colibri.js
|
|
|
|
console.log('associated jid', ssrc2jid[thessrc], data.peerjid);
|
|
|
|
if (ssrc2jid[thessrc]) {
|
|
|
|
data.peerjid = ssrc2jid[thessrc];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-08-21 09:58:33 +00:00
|
|
|
// NOTE(gp) now that we have simulcast, a media stream can have more than 1
|
|
|
|
// ssrc. We should probably take that into account in our MediaStream
|
|
|
|
// wrapper.
|
2014-08-22 15:37:11 +00:00
|
|
|
mediaStreams.push(new MediaStream(data, sid, thessrc));
|
|
|
|
|
2014-01-11 18:57:41 +00:00
|
|
|
var container;
|
|
|
|
var remotes = document.getElementById('remoteVideos');
|
2014-01-24 10:24:18 +00:00
|
|
|
|
2013-12-30 08:23:23 +00:00
|
|
|
if (data.peerjid) {
|
2014-06-12 18:35:42 +00:00
|
|
|
VideoLayout.ensurePeerContainerExists(data.peerjid);
|
2014-08-22 15:37:11 +00:00
|
|
|
|
2014-02-26 15:19:39 +00:00
|
|
|
container = document.getElementById(
|
|
|
|
'participant_' + Strophe.getResourceFromJid(data.peerjid));
|
2014-01-11 18:57:41 +00:00
|
|
|
} else {
|
2014-03-01 07:39:39 +00:00
|
|
|
if (data.stream.id !== 'mixedmslabel') {
|
2014-08-14 15:29:28 +00:00
|
|
|
console.error('can not associate stream',
|
|
|
|
data.stream.id,
|
|
|
|
'with a participant');
|
2014-03-17 15:43:06 +00:00
|
|
|
// We don't want to add it here since it will cause troubles
|
|
|
|
return;
|
2014-01-11 18:57:41 +00:00
|
|
|
}
|
|
|
|
// FIXME: for the mixed ms we dont need a video -- currently
|
|
|
|
container = document.createElement('span');
|
2014-08-22 15:37:11 +00:00
|
|
|
container.id = 'mixedstream';
|
2014-01-11 18:57:41 +00:00
|
|
|
container.className = 'videocontainer';
|
|
|
|
remotes.appendChild(container);
|
2014-02-18 19:11:27 +00:00
|
|
|
Util.playSoundNotification('userJoined');
|
2013-12-30 08:23:23 +00:00
|
|
|
}
|
2014-03-12 15:08:24 +00:00
|
|
|
|
|
|
|
var isVideo = data.stream.getVideoTracks().length > 0;
|
2014-03-26 10:33:46 +00:00
|
|
|
|
2014-08-22 15:37:11 +00:00
|
|
|
if (container) {
|
|
|
|
VideoLayout.addRemoteStreamElement( container,
|
|
|
|
sid,
|
|
|
|
data.stream,
|
|
|
|
data.peerjid,
|
|
|
|
thessrc);
|
2013-12-23 16:49:29 +00:00
|
|
|
}
|
2014-01-24 10:24:18 +00:00
|
|
|
|
2014-02-13 06:07:24 +00:00
|
|
|
// an attempt to work around https://github.com/jitsi/jitmeet/issues/32
|
2014-04-13 12:30:47 +00:00
|
|
|
if (isVideo &&
|
|
|
|
data.peerjid && sess.peerjid === data.peerjid &&
|
|
|
|
data.stream.getVideoTracks().length === 0 &&
|
|
|
|
connection.jingle.localVideo.getVideoTracks().length > 0) {
|
|
|
|
//
|
|
|
|
window.setTimeout(function () {
|
2014-02-13 06:07:24 +00:00
|
|
|
sendKeyframe(sess.peerconnection);
|
|
|
|
}, 3000);
|
|
|
|
}
|
2014-08-21 09:58:33 +00:00
|
|
|
}
|
2013-12-16 11:22:23 +00:00
|
|
|
|
2014-05-19 13:53:45 +00:00
|
|
|
/**
|
|
|
|
* Returns the JID of the user to whom given <tt>videoSrc</tt> belongs.
|
|
|
|
* @param videoSrc the video "src" identifier.
|
|
|
|
* @returns {null | String} the JID of the user to whom given <tt>videoSrc</tt>
|
|
|
|
* belongs.
|
|
|
|
*/
|
|
|
|
function getJidFromVideoSrc(videoSrc)
|
|
|
|
{
|
|
|
|
if (videoSrc === localVideoSrc)
|
|
|
|
return connection.emuc.myroomjid;
|
|
|
|
|
|
|
|
var ssrc = videoSrcToSsrc[videoSrc];
|
|
|
|
if (!ssrc)
|
|
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
return ssrc2jid[ssrc];
|
|
|
|
}
|
|
|
|
|
2014-02-13 06:07:24 +00:00
|
|
|
// an attempt to work around https://github.com/jitsi/jitmeet/issues/32
|
|
|
|
function sendKeyframe(pc) {
|
|
|
|
console.log('sendkeyframe', pc.iceConnectionState);
|
2014-03-01 07:39:39 +00:00
|
|
|
if (pc.iceConnectionState !== 'connected') return; // safe...
|
2014-02-13 06:07:24 +00:00
|
|
|
pc.setRemoteDescription(
|
|
|
|
pc.remoteDescription,
|
|
|
|
function () {
|
|
|
|
pc.createAnswer(
|
|
|
|
function (modifiedAnswer) {
|
2014-04-13 12:30:47 +00:00
|
|
|
pc.setLocalDescription(
|
|
|
|
modifiedAnswer,
|
2014-02-13 06:07:24 +00:00
|
|
|
function () {
|
2014-04-13 12:30:47 +00:00
|
|
|
// noop
|
2014-02-13 06:07:24 +00:00
|
|
|
},
|
|
|
|
function (error) {
|
|
|
|
console.log('triggerKeyframe setLocalDescription failed', error);
|
2014-08-14 15:29:28 +00:00
|
|
|
messageHandler.showError();
|
2014-02-13 06:07:24 +00:00
|
|
|
}
|
|
|
|
);
|
|
|
|
},
|
|
|
|
function (error) {
|
|
|
|
console.log('triggerKeyframe createAnswer failed', error);
|
2014-08-14 15:29:28 +00:00
|
|
|
messageHandler.showError();
|
2014-02-13 06:07:24 +00:00
|
|
|
}
|
|
|
|
);
|
|
|
|
},
|
|
|
|
function (error) {
|
|
|
|
console.log('triggerKeyframe setRemoteDescription failed', error);
|
2014-08-14 15:29:28 +00:00
|
|
|
messageHandler.showError();
|
2014-02-13 06:07:24 +00:00
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2014-06-12 18:35:42 +00:00
|
|
|
// Really mute video, i.e. dont even send black frames
|
2014-02-22 13:28:28 +00:00
|
|
|
function muteVideo(pc, unmute) {
|
|
|
|
// FIXME: this probably needs another of those lovely state safeguards...
|
|
|
|
// which checks for iceconn == connected and sigstate == stable
|
|
|
|
pc.setRemoteDescription(pc.remoteDescription,
|
|
|
|
function () {
|
|
|
|
pc.createAnswer(
|
|
|
|
function (answer) {
|
|
|
|
var sdp = new SDP(answer.sdp);
|
|
|
|
if (sdp.media.length > 1) {
|
|
|
|
if (unmute)
|
|
|
|
sdp.media[1] = sdp.media[1].replace('a=recvonly', 'a=sendrecv');
|
|
|
|
else
|
|
|
|
sdp.media[1] = sdp.media[1].replace('a=sendrecv', 'a=recvonly');
|
|
|
|
sdp.raw = sdp.session + sdp.media.join('');
|
|
|
|
answer.sdp = sdp.raw;
|
|
|
|
}
|
|
|
|
pc.setLocalDescription(answer,
|
|
|
|
function () {
|
|
|
|
console.log('mute SLD ok');
|
|
|
|
},
|
2014-04-13 12:30:47 +00:00
|
|
|
function (error) {
|
2014-02-22 13:28:28 +00:00
|
|
|
console.log('mute SLD error');
|
2014-08-14 15:29:28 +00:00
|
|
|
messageHandler.showError('Error',
|
|
|
|
'Oops! Something went wrong and we failed to ' +
|
|
|
|
'mute! (SLD Failure)');
|
2014-02-22 13:28:28 +00:00
|
|
|
}
|
|
|
|
);
|
|
|
|
},
|
|
|
|
function (error) {
|
|
|
|
console.log(error);
|
2014-08-14 15:29:28 +00:00
|
|
|
messageHandler.showError();
|
2014-02-22 13:28:28 +00:00
|
|
|
}
|
|
|
|
);
|
|
|
|
},
|
|
|
|
function (error) {
|
|
|
|
console.log('muteVideo SRD error');
|
2014-08-14 15:29:28 +00:00
|
|
|
messageHandler.showError('Error',
|
|
|
|
'Oops! Something went wrong and we failed to stop video!' +
|
|
|
|
'(SRD Failure)');
|
|
|
|
|
2014-02-22 13:28:28 +00:00
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2014-06-05 11:09:31 +00:00
|
|
|
/**
|
2014-07-27 12:24:27 +00:00
|
|
|
* Callback for audio levels changed.
|
|
|
|
* @param jid JID of the user
|
|
|
|
* @param audioLevel the audio level value
|
2014-06-05 11:09:31 +00:00
|
|
|
*/
|
2014-07-27 12:24:27 +00:00
|
|
|
function audioLevelUpdated(jid, audioLevel)
|
2014-06-05 11:09:31 +00:00
|
|
|
{
|
2014-07-27 12:24:27 +00:00
|
|
|
var resourceJid;
|
|
|
|
if(jid === LocalStatsCollector.LOCAL_JID)
|
2014-06-05 11:09:31 +00:00
|
|
|
{
|
2014-07-27 12:24:27 +00:00
|
|
|
resourceJid = AudioLevels.LOCAL_LEVEL;
|
2014-07-28 11:31:32 +00:00
|
|
|
if(isAudioMuted())
|
2014-09-23 10:06:11 +00:00
|
|
|
{
|
|
|
|
audioLevel = 0;
|
|
|
|
}
|
2014-07-27 12:24:27 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
resourceJid = Strophe.getResourceFromJid(jid);
|
|
|
|
}
|
2014-06-05 11:09:31 +00:00
|
|
|
|
2014-07-27 12:24:27 +00:00
|
|
|
AudioLevels.updateAudioLevel(resourceJid, audioLevel);
|
2014-06-26 14:58:43 +00:00
|
|
|
}
|
|
|
|
|
2014-06-05 11:09:31 +00:00
|
|
|
/**
|
|
|
|
* Starts the {@link StatsCollector} if the feature is enabled in config.js.
|
|
|
|
*/
|
|
|
|
function startRtpStatsCollector()
|
|
|
|
{
|
2014-07-03 12:30:07 +00:00
|
|
|
stopRTPStatsCollector();
|
|
|
|
if (config.enableRtpStats)
|
2014-06-05 11:09:31 +00:00
|
|
|
{
|
|
|
|
statsCollector = new StatsCollector(
|
2014-10-16 15:11:26 +00:00
|
|
|
getConferenceHandler().peerconnection, 200, audioLevelUpdated, 2000,
|
|
|
|
ConnectionQuality.updateLocalStats);
|
2014-06-05 11:09:31 +00:00
|
|
|
statsCollector.start();
|
|
|
|
}
|
|
|
|
}
|
2014-07-03 12:30:07 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Stops the {@link StatsCollector}.
|
|
|
|
*/
|
|
|
|
function stopRTPStatsCollector()
|
|
|
|
{
|
|
|
|
if (statsCollector)
|
|
|
|
{
|
|
|
|
statsCollector.stop();
|
|
|
|
statsCollector = null;
|
2014-10-16 15:11:26 +00:00
|
|
|
ConnectionQuality.stopSendingStats();
|
2014-07-03 12:30:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-06-26 14:58:43 +00:00
|
|
|
/**
|
|
|
|
* Starts the {@link LocalStatsCollector} if the feature is enabled in config.js
|
|
|
|
* @param stream the stream that will be used for collecting statistics.
|
|
|
|
*/
|
|
|
|
function startLocalRtpStatsCollector(stream)
|
|
|
|
{
|
|
|
|
if(config.enableRtpStats)
|
|
|
|
{
|
2014-07-27 12:24:27 +00:00
|
|
|
localStatsCollector = new LocalStatsCollector(stream, 100, audioLevelUpdated);
|
2014-06-26 14:58:43 +00:00
|
|
|
localStatsCollector.start();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Stops the {@link LocalStatsCollector}.
|
|
|
|
*/
|
|
|
|
function stopLocalRtpStatsCollector()
|
|
|
|
{
|
|
|
|
if(localStatsCollector)
|
|
|
|
{
|
|
|
|
localStatsCollector.stop();
|
|
|
|
localStatsCollector = null;
|
|
|
|
}
|
|
|
|
}
|
2014-06-05 11:09:31 +00:00
|
|
|
|
2013-12-16 11:22:23 +00:00
|
|
|
$(document).bind('callincoming.jingle', function (event, sid) {
|
|
|
|
var sess = connection.jingle.sessions[sid];
|
2014-02-27 07:19:06 +00:00
|
|
|
|
|
|
|
// TODO: do we check activecall == null?
|
|
|
|
activecall = sess;
|
|
|
|
|
2014-06-05 11:09:31 +00:00
|
|
|
startRtpStatsCollector();
|
|
|
|
|
2014-05-08 09:26:15 +00:00
|
|
|
// Bind data channel listener in case we're a regular participant
|
|
|
|
if (config.openSctp)
|
|
|
|
{
|
|
|
|
bindDataChannelListener(sess.peerconnection);
|
|
|
|
}
|
|
|
|
|
2013-12-16 11:22:23 +00:00
|
|
|
// TODO: check affiliation and/or role
|
|
|
|
console.log('emuc data for', sess.peerjid, connection.emuc.members[sess.peerjid]);
|
2014-01-26 12:04:53 +00:00
|
|
|
sess.usedrip = true; // not-so-naive trickle ice
|
2013-12-16 11:22:23 +00:00
|
|
|
sess.sendAnswer();
|
|
|
|
sess.accept();
|
2014-02-27 07:19:06 +00:00
|
|
|
|
2013-12-16 11:22:23 +00:00
|
|
|
});
|
|
|
|
|
2014-06-05 11:09:31 +00:00
|
|
|
$(document).bind('conferenceCreated.jingle', function (event, focus)
|
|
|
|
{
|
|
|
|
startRtpStatsCollector();
|
2014-06-12 18:35:42 +00:00
|
|
|
});
|
2014-06-12 17:59:47 +00:00
|
|
|
|
2014-06-12 18:35:42 +00:00
|
|
|
$(document).bind('conferenceCreated.jingle', function (event, focus)
|
|
|
|
{
|
2014-05-08 09:26:15 +00:00
|
|
|
// Bind data channel listener in case we're the focus
|
|
|
|
if (config.openSctp)
|
|
|
|
{
|
|
|
|
bindDataChannelListener(focus.peerconnection);
|
|
|
|
}
|
2014-06-05 11:09:31 +00:00
|
|
|
});
|
|
|
|
|
2014-05-11 22:41:58 +00:00
|
|
|
$(document).bind('callterminated.jingle', function (event, sid, jid, reason) {
|
|
|
|
// Leave the room if my call has been remotely terminated.
|
|
|
|
if (connection.emuc.joined && focus == null && reason === 'kick') {
|
2014-05-12 09:56:33 +00:00
|
|
|
sessionTerminated = true;
|
2014-05-11 22:41:58 +00:00
|
|
|
connection.emuc.doLeave();
|
2014-08-14 15:29:28 +00:00
|
|
|
messageHandler.openMessageDialog("Session Terminated",
|
2014-05-11 22:41:58 +00:00
|
|
|
"Ouch! You have been kicked out of the meet!");
|
|
|
|
}
|
2013-12-16 11:22:23 +00:00
|
|
|
});
|
|
|
|
|
2014-01-09 20:44:37 +00:00
|
|
|
$(document).bind('setLocalDescription.jingle', function (event, sid) {
|
|
|
|
// put our ssrcs into presence so other clients can identify our stream
|
|
|
|
var sess = connection.jingle.sessions[sid];
|
2014-08-21 09:58:33 +00:00
|
|
|
var newssrcs = [];
|
|
|
|
var media = simulcast.parseMedia(sess.peerconnection.localDescription);
|
|
|
|
media.forEach(function (media) {
|
|
|
|
|
|
|
|
// TODO(gp) maybe exclude FID streams?
|
|
|
|
Object.keys(media.sources).forEach(function(ssrc) {
|
|
|
|
newssrcs.push({
|
|
|
|
'ssrc': ssrc,
|
|
|
|
'type': media.type,
|
|
|
|
'direction': media.direction
|
|
|
|
});
|
|
|
|
});
|
2014-01-09 20:44:37 +00:00
|
|
|
});
|
|
|
|
console.log('new ssrcs', newssrcs);
|
|
|
|
|
2014-03-13 12:22:54 +00:00
|
|
|
// Have to clear presence map to get rid of removed streams
|
|
|
|
connection.emuc.clearPresenceMedia();
|
2014-08-21 09:58:33 +00:00
|
|
|
|
|
|
|
if (newssrcs.length > 0) {
|
|
|
|
for (var i = 1; i <= newssrcs.length; i ++) {
|
|
|
|
// Change video type to screen
|
|
|
|
if (newssrcs[i-1].type === 'video' && isUsingScreenStream) {
|
|
|
|
newssrcs[i-1].type = 'screen';
|
|
|
|
}
|
|
|
|
connection.emuc.addMediaToPresence(i,
|
|
|
|
newssrcs[i-1].type, newssrcs[i-1].ssrc, newssrcs[i-1].direction);
|
2014-03-18 09:16:39 +00:00
|
|
|
}
|
2014-08-21 09:58:33 +00:00
|
|
|
|
2014-02-10 20:59:39 +00:00
|
|
|
connection.emuc.sendPresence();
|
|
|
|
}
|
2014-01-09 20:44:37 +00:00
|
|
|
});
|
2013-12-16 11:22:23 +00:00
|
|
|
|
2014-08-25 10:30:31 +00:00
|
|
|
$(document).bind('iceconnectionstatechange.jingle', function (event, sid, session) {
|
|
|
|
switch (session.peerconnection.iceConnectionState) {
|
|
|
|
case 'checking':
|
|
|
|
session.timeChecking = (new Date()).getTime();
|
|
|
|
session.firstconnect = true;
|
|
|
|
break;
|
|
|
|
case 'completed': // on caller side
|
|
|
|
case 'connected':
|
|
|
|
if (session.firstconnect) {
|
|
|
|
session.firstconnect = false;
|
|
|
|
var metadata = {};
|
|
|
|
metadata.setupTime = (new Date()).getTime() - session.timeChecking;
|
|
|
|
session.peerconnection.getStats(function (res) {
|
|
|
|
res.result().forEach(function (report) {
|
|
|
|
if (report.type == 'googCandidatePair' && report.stat('googActiveConnection') == 'true') {
|
|
|
|
metadata.localCandidateType = report.stat('googLocalCandidateType');
|
|
|
|
metadata.remoteCandidateType = report.stat('googRemoteCandidateType');
|
|
|
|
|
|
|
|
// log pair as well so we can get nice pie charts
|
|
|
|
metadata.candidatePair = report.stat('googLocalCandidateType') + ';' + report.stat('googRemoteCandidateType');
|
|
|
|
|
|
|
|
if (report.stat('googRemoteAddress').indexOf('[') === 0) {
|
|
|
|
metadata.ipv6 = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
trackUsage('iceConnected', metadata);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2013-12-16 11:22:23 +00:00
|
|
|
$(document).bind('joined.muc', function (event, jid, info) {
|
|
|
|
updateRoomUrl(window.location.href);
|
2014-01-14 18:34:36 +00:00
|
|
|
document.getElementById('localNick').appendChild(
|
2014-02-11 14:05:17 +00:00
|
|
|
document.createTextNode(Strophe.getResourceFromJid(jid) + ' (me)')
|
2014-01-14 18:34:36 +00:00
|
|
|
);
|
2013-12-18 14:33:51 +00:00
|
|
|
|
2013-12-16 11:22:23 +00:00
|
|
|
if (Object.keys(connection.emuc.members).length < 1) {
|
|
|
|
focus = new ColibriFocus(connection, config.hosts.bridge);
|
2014-07-23 07:12:36 +00:00
|
|
|
if (nickname !== null) {
|
|
|
|
focus.setEndpointDisplayName(connection.emuc.myroomjid,
|
|
|
|
nickname);
|
|
|
|
}
|
2014-08-08 13:25:24 +00:00
|
|
|
Toolbar.showSipCallButton(true);
|
2014-07-23 07:47:00 +00:00
|
|
|
Toolbar.showRecordingButton(false);
|
2013-12-16 11:22:23 +00:00
|
|
|
}
|
2014-02-11 14:05:17 +00:00
|
|
|
|
2014-08-08 13:25:24 +00:00
|
|
|
if (!focus)
|
|
|
|
{
|
|
|
|
Toolbar.showSipCallButton(false);
|
|
|
|
}
|
|
|
|
|
2014-02-12 22:24:26 +00:00
|
|
|
if (focus && config.etherpad_base) {
|
|
|
|
Etherpad.init();
|
|
|
|
}
|
|
|
|
|
2014-06-12 18:35:42 +00:00
|
|
|
VideoLayout.showFocusIndicator();
|
2014-02-11 14:05:17 +00:00
|
|
|
|
2014-08-22 15:37:11 +00:00
|
|
|
// Add myself to the contact list.
|
|
|
|
ContactList.addContact(jid);
|
|
|
|
|
2014-01-24 10:24:18 +00:00
|
|
|
// Once we've joined the muc show the toolbar
|
2014-09-04 13:18:28 +00:00
|
|
|
ToolbarToggler.showToolbar();
|
2014-02-11 14:05:17 +00:00
|
|
|
|
|
|
|
if (info.displayName)
|
2014-08-27 07:20:05 +00:00
|
|
|
$(document).trigger('displaynamechanged',
|
|
|
|
['localVideoContainer', info.displayName + ' (me)']);
|
2013-12-16 11:22:23 +00:00
|
|
|
});
|
|
|
|
|
2014-01-09 20:44:37 +00:00
|
|
|
$(document).bind('entered.muc', function (event, jid, info, pres) {
|
2013-12-16 11:22:23 +00:00
|
|
|
console.log('entered', jid, info);
|
2014-07-01 14:02:34 +00:00
|
|
|
|
2014-09-11 08:48:55 +00:00
|
|
|
console.log('is focus? ' + (focus ? 'true' : 'false'));
|
2014-02-11 14:05:17 +00:00
|
|
|
|
2014-03-27 09:30:53 +00:00
|
|
|
// Add Peer's container
|
2014-06-12 18:35:42 +00:00
|
|
|
VideoLayout.ensurePeerContainerExists(jid);
|
2014-01-14 18:34:36 +00:00
|
|
|
|
2013-12-16 11:22:23 +00:00
|
|
|
if (focus !== null) {
|
|
|
|
// FIXME: this should prepare the video
|
|
|
|
if (focus.confid === null) {
|
|
|
|
console.log('make new conference with', jid);
|
2014-08-14 15:29:28 +00:00
|
|
|
focus.makeConference(Object.keys(connection.emuc.members),
|
|
|
|
function(error) {
|
|
|
|
connection.emuc.addBridgeIsDownToPresence();
|
|
|
|
connection.emuc.sendPresence();
|
|
|
|
}
|
|
|
|
);
|
2014-07-23 07:47:00 +00:00
|
|
|
Toolbar.showRecordingButton(true);
|
2013-12-16 11:22:23 +00:00
|
|
|
} else {
|
|
|
|
console.log('invite', jid, 'into conference');
|
|
|
|
focus.addNewParticipant(jid);
|
|
|
|
}
|
|
|
|
}
|
2013-12-23 16:10:07 +00:00
|
|
|
else if (sharedKey) {
|
2014-06-12 18:35:42 +00:00
|
|
|
Toolbar.updateLockButton();
|
2013-12-23 16:10:07 +00:00
|
|
|
}
|
2013-12-16 11:22:23 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
$(document).bind('left.muc', function (event, jid) {
|
2014-05-11 22:41:58 +00:00
|
|
|
console.log('left.muc', jid);
|
|
|
|
// Need to call this with a slight delay, otherwise the element couldn't be
|
|
|
|
// found for some reason.
|
|
|
|
window.setTimeout(function () {
|
|
|
|
var container = document.getElementById(
|
|
|
|
'participant_' + Strophe.getResourceFromJid(jid));
|
|
|
|
if (container) {
|
2014-10-16 15:11:26 +00:00
|
|
|
VideoLayout.removeConnectionIndicator(jid);
|
2014-05-11 22:41:58 +00:00
|
|
|
// hide here, wait for video to close before removing
|
|
|
|
$(container).hide();
|
2014-06-12 18:35:42 +00:00
|
|
|
VideoLayout.resizeThumbnails();
|
2014-05-11 22:41:58 +00:00
|
|
|
}
|
|
|
|
}, 10);
|
|
|
|
|
2014-05-19 13:53:45 +00:00
|
|
|
// Unlock large video
|
|
|
|
if (focusedVideoSrc)
|
|
|
|
{
|
|
|
|
if (getJidFromVideoSrc(focusedVideoSrc) === jid)
|
|
|
|
{
|
|
|
|
console.info("Focused video owner has left the conference");
|
|
|
|
focusedVideoSrc = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-12-16 11:22:23 +00:00
|
|
|
connection.jingle.terminateByJid(jid);
|
2014-05-11 22:41:58 +00:00
|
|
|
|
|
|
|
if (focus == null
|
2014-05-12 09:56:33 +00:00
|
|
|
// I shouldn't be the one that left to enter here.
|
2014-05-11 22:41:58 +00:00
|
|
|
&& jid !== connection.emuc.myroomjid
|
|
|
|
&& connection.emuc.myroomjid === connection.emuc.list_members[0]
|
2014-05-12 09:56:33 +00:00
|
|
|
// If our session has been terminated for some reason
|
|
|
|
// (kicked, hangup), don't try to become the focus
|
|
|
|
&& !sessionTerminated) {
|
2014-02-10 22:25:57 +00:00
|
|
|
console.log('welcome to our new focus... myself');
|
|
|
|
focus = new ColibriFocus(connection, config.hosts.bridge);
|
2014-07-23 07:12:36 +00:00
|
|
|
if (nickname !== null) {
|
|
|
|
focus.setEndpointDisplayName(connection.emuc.myroomjid,
|
|
|
|
nickname);
|
|
|
|
}
|
2014-07-01 14:02:34 +00:00
|
|
|
|
2014-08-08 13:25:24 +00:00
|
|
|
Toolbar.showSipCallButton(true);
|
|
|
|
|
2014-02-10 22:25:57 +00:00
|
|
|
if (Object.keys(connection.emuc.members).length > 0) {
|
|
|
|
focus.makeConference(Object.keys(connection.emuc.members));
|
2014-07-23 07:47:00 +00:00
|
|
|
Toolbar.showRecordingButton(true);
|
2014-02-10 22:25:57 +00:00
|
|
|
}
|
2014-02-12 22:24:26 +00:00
|
|
|
$(document).trigger('focusechanged.muc', [focus]);
|
2014-03-01 07:39:39 +00:00
|
|
|
}
|
2014-02-10 22:25:57 +00:00
|
|
|
else if (focus && Object.keys(connection.emuc.members).length === 0) {
|
2013-12-16 11:22:23 +00:00
|
|
|
console.log('everyone left');
|
2014-03-24 15:55:33 +00:00
|
|
|
// FIXME: closing the connection is a hack to avoid some
|
2014-07-01 14:02:34 +00:00
|
|
|
// problems with reinit
|
2014-03-24 15:55:33 +00:00
|
|
|
disposeConference();
|
|
|
|
focus = new ColibriFocus(connection, config.hosts.bridge);
|
2014-07-23 07:12:36 +00:00
|
|
|
if (nickname !== null) {
|
|
|
|
focus.setEndpointDisplayName(connection.emuc.myroomjid,
|
|
|
|
nickname);
|
|
|
|
}
|
2014-08-08 13:25:24 +00:00
|
|
|
Toolbar.showSipCallButton(true);
|
2014-07-23 07:47:00 +00:00
|
|
|
Toolbar.showRecordingButton(false);
|
2013-12-16 11:22:23 +00:00
|
|
|
}
|
2014-01-24 10:24:18 +00:00
|
|
|
if (connection.emuc.getPrezi(jid)) {
|
2014-05-11 22:41:58 +00:00
|
|
|
$(document).trigger('presentationremoved.muc',
|
|
|
|
[jid, connection.emuc.getPrezi(jid)]);
|
2014-01-24 10:24:18 +00:00
|
|
|
}
|
2013-12-16 11:22:23 +00:00
|
|
|
});
|
|
|
|
|
2014-01-09 20:44:37 +00:00
|
|
|
$(document).bind('presence.muc', function (event, jid, info, pres) {
|
2014-03-13 12:22:54 +00:00
|
|
|
|
|
|
|
// Remove old ssrcs coming from the jid
|
2014-04-13 12:30:47 +00:00
|
|
|
Object.keys(ssrc2jid).forEach(function (ssrc) {
|
|
|
|
if (ssrc2jid[ssrc] == jid) {
|
|
|
|
delete ssrc2jid[ssrc];
|
|
|
|
}
|
2014-07-21 07:49:50 +00:00
|
|
|
if (ssrc2videoType[ssrc] == jid) {
|
2014-04-13 12:30:47 +00:00
|
|
|
delete ssrc2videoType[ssrc];
|
|
|
|
}
|
2014-03-13 12:22:54 +00:00
|
|
|
});
|
|
|
|
|
2014-01-09 20:44:37 +00:00
|
|
|
$(pres).find('>media[xmlns="http://estos.de/ns/mjs"]>source').each(function (idx, ssrc) {
|
|
|
|
//console.log(jid, 'assoc ssrc', ssrc.getAttribute('type'), ssrc.getAttribute('ssrc'));
|
2014-03-26 18:06:34 +00:00
|
|
|
var ssrcV = ssrc.getAttribute('ssrc');
|
|
|
|
ssrc2jid[ssrcV] = jid;
|
2014-02-26 14:16:00 +00:00
|
|
|
|
2014-03-18 09:16:39 +00:00
|
|
|
var type = ssrc.getAttribute('type');
|
2014-03-26 18:06:34 +00:00
|
|
|
ssrc2videoType[ssrcV] = type;
|
|
|
|
|
2014-02-26 14:16:00 +00:00
|
|
|
// might need to update the direction if participant just went from sendrecv to recvonly
|
2014-03-18 09:16:39 +00:00
|
|
|
if (type === 'video' || type === 'screen') {
|
2014-02-26 17:18:08 +00:00
|
|
|
var el = $('#participant_' + Strophe.getResourceFromJid(jid) + '>video');
|
2014-04-13 12:30:47 +00:00
|
|
|
switch (ssrc.getAttribute('direction')) {
|
2014-02-26 17:18:08 +00:00
|
|
|
case 'sendrecv':
|
2014-03-01 07:39:39 +00:00
|
|
|
el.show();
|
2014-02-26 17:18:08 +00:00
|
|
|
break;
|
|
|
|
case 'recvonly':
|
|
|
|
el.hide();
|
2014-03-17 09:02:40 +00:00
|
|
|
// FIXME: Check if we have to change large video
|
2014-08-22 15:37:11 +00:00
|
|
|
//VideoLayout.updateLargeVideo(el);
|
2014-02-26 17:18:08 +00:00
|
|
|
break;
|
|
|
|
}
|
2014-02-26 14:16:00 +00:00
|
|
|
}
|
2014-01-09 20:44:37 +00:00
|
|
|
});
|
2014-02-11 14:05:17 +00:00
|
|
|
|
2014-08-22 15:37:11 +00:00
|
|
|
if (info.displayName && info.displayName.length > 0)
|
|
|
|
$(document).trigger('displaynamechanged',
|
|
|
|
[jid, info.displayName]);
|
2014-07-23 07:12:36 +00:00
|
|
|
|
|
|
|
if (focus !== null && info.displayName !== null) {
|
|
|
|
focus.setEndpointDisplayName(jid, info.displayName);
|
|
|
|
}
|
2014-08-14 15:29:28 +00:00
|
|
|
|
|
|
|
//check if the video bridge is available
|
|
|
|
if($(pres).find(">bridgeIsDown").length > 0 && !bridgeIsDown) {
|
|
|
|
bridgeIsDown = true;
|
|
|
|
messageHandler.showError("Error",
|
2014-09-24 08:32:30 +00:00
|
|
|
"Jitsi Videobridge is currently unavailable. Please try again later!");
|
2014-08-14 15:29:28 +00:00
|
|
|
}
|
|
|
|
|
2014-01-11 16:16:46 +00:00
|
|
|
});
|
|
|
|
|
2014-08-22 14:20:33 +00:00
|
|
|
$(document).bind('presence.status.muc', function (event, jid, info, pres) {
|
|
|
|
|
|
|
|
VideoLayout.setPresenceStatus(
|
|
|
|
'participant_' + Strophe.getResourceFromJid(jid), info.status);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
2013-12-23 16:10:07 +00:00
|
|
|
$(document).bind('passwordrequired.muc', function (event, jid) {
|
|
|
|
console.log('on password required', jid);
|
|
|
|
|
2014-08-14 15:29:28 +00:00
|
|
|
messageHandler.openTwoButtonDialog(null,
|
|
|
|
'<h2>Password required</h2>' +
|
2014-09-24 09:51:42 +00:00
|
|
|
'<input id="lockKey" type="text" placeholder="password" autofocus>',
|
2014-08-14 15:29:28 +00:00
|
|
|
true,
|
|
|
|
"Ok",
|
|
|
|
function (e, v, m, f) {
|
2014-04-13 12:30:47 +00:00
|
|
|
if (v) {
|
|
|
|
var lockKey = document.getElementById('lockKey');
|
|
|
|
if (lockKey.value !== null) {
|
|
|
|
setSharedKey(lockKey.value);
|
|
|
|
connection.emuc.doJoin(jid, lockKey.value);
|
2013-12-23 16:10:07 +00:00
|
|
|
}
|
2014-04-13 12:30:47 +00:00
|
|
|
}
|
2014-08-14 15:29:28 +00:00
|
|
|
},
|
|
|
|
function (event) {
|
|
|
|
document.getElementById('lockKey').focus();
|
2014-04-13 12:30:47 +00:00
|
|
|
}
|
2014-08-14 15:29:28 +00:00
|
|
|
);
|
2013-12-23 16:10:07 +00:00
|
|
|
});
|
|
|
|
|
2014-08-05 07:39:04 +00:00
|
|
|
$(document).bind('passwordrequired.main', function (event) {
|
|
|
|
console.log('password is required');
|
|
|
|
|
2014-08-14 15:29:28 +00:00
|
|
|
messageHandler.openTwoButtonDialog(null,
|
|
|
|
'<h2>Password required</h2>' +
|
|
|
|
'<input id="passwordrequired.username" type="text" placeholder="user@domain.net" autofocus>' +
|
|
|
|
'<input id="passwordrequired.password" type="password" placeholder="user password">',
|
|
|
|
true,
|
|
|
|
"Ok",
|
|
|
|
function (e, v, m, f) {
|
2014-08-05 07:39:04 +00:00
|
|
|
if (v) {
|
|
|
|
var username = document.getElementById('passwordrequired.username');
|
|
|
|
var password = document.getElementById('passwordrequired.password');
|
|
|
|
|
|
|
|
if (username.value !== null && password.value != null) {
|
|
|
|
connect(username.value, password.value);
|
|
|
|
}
|
|
|
|
}
|
2014-08-14 15:29:28 +00:00
|
|
|
},
|
|
|
|
function (event) {
|
|
|
|
document.getElementById('passwordrequired.username').focus();
|
2014-08-05 07:39:04 +00:00
|
|
|
}
|
2014-08-14 15:29:28 +00:00
|
|
|
);
|
2014-08-05 07:39:04 +00:00
|
|
|
});
|
|
|
|
|
2014-03-26 18:06:34 +00:00
|
|
|
/**
|
|
|
|
* Checks if video identified by given src is desktop stream.
|
2014-06-12 18:35:42 +00:00
|
|
|
* @param videoSrc eg.
|
|
|
|
* blob:https%3A//pawel.jitsi.net/9a46e0bd-131e-4d18-9c14-a9264e8db395
|
2014-03-26 18:06:34 +00:00
|
|
|
* @returns {boolean}
|
|
|
|
*/
|
2014-04-13 12:30:47 +00:00
|
|
|
function isVideoSrcDesktop(videoSrc) {
|
2014-03-26 18:06:34 +00:00
|
|
|
// FIXME: fix this mapping mess...
|
|
|
|
// figure out if large video is desktop stream or just a camera
|
|
|
|
var isDesktop = false;
|
2014-04-13 12:30:47 +00:00
|
|
|
if (localVideoSrc === videoSrc) {
|
2014-03-26 18:06:34 +00:00
|
|
|
// local video
|
|
|
|
isDesktop = isUsingScreenStream;
|
|
|
|
} else {
|
|
|
|
// Do we have associations...
|
|
|
|
var videoSsrc = videoSrcToSsrc[videoSrc];
|
2014-04-13 12:30:47 +00:00
|
|
|
if (videoSsrc) {
|
2014-03-26 18:06:34 +00:00
|
|
|
var videoType = ssrc2videoType[videoSsrc];
|
2014-04-13 12:30:47 +00:00
|
|
|
if (videoType) {
|
2014-03-26 18:06:34 +00:00
|
|
|
// Finally there...
|
|
|
|
isDesktop = videoType === 'screen';
|
|
|
|
} else {
|
|
|
|
console.error("No video type for ssrc: " + videoSsrc);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
console.error("No ssrc for src: " + videoSrc);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return isDesktop;
|
|
|
|
}
|
|
|
|
|
2014-03-12 15:08:24 +00:00
|
|
|
function getConferenceHandler() {
|
|
|
|
return focus ? focus : activecall;
|
|
|
|
}
|
|
|
|
|
2013-12-16 11:22:23 +00:00
|
|
|
function toggleVideo() {
|
2014-09-08 17:01:10 +00:00
|
|
|
buttonClick("#video", "icon-camera icon-camera-disabled");
|
2014-04-07 10:16:49 +00:00
|
|
|
if (!(connection && connection.jingle.localVideo))
|
|
|
|
return;
|
2014-03-13 13:01:54 +00:00
|
|
|
|
2014-03-12 15:08:24 +00:00
|
|
|
var sess = getConferenceHandler();
|
|
|
|
if (sess) {
|
2014-03-13 13:01:54 +00:00
|
|
|
sess.toggleVideoMute(
|
2014-04-13 12:30:47 +00:00
|
|
|
function (isMuted) {
|
|
|
|
if (isMuted) {
|
2014-04-07 10:16:49 +00:00
|
|
|
$('#video').removeClass("icon-camera");
|
|
|
|
$('#video').addClass("icon-camera icon-camera-disabled");
|
2014-03-13 13:01:54 +00:00
|
|
|
} else {
|
2014-04-07 10:16:49 +00:00
|
|
|
$('#video').removeClass("icon-camera icon-camera-disabled");
|
|
|
|
$('#video').addClass("icon-camera");
|
2014-03-13 13:01:54 +00:00
|
|
|
}
|
2014-09-17 13:44:41 +00:00
|
|
|
connection.emuc.addVideoInfoToPresence(isMuted);
|
|
|
|
connection.emuc.sendPresence();
|
2014-03-13 13:01:54 +00:00
|
|
|
}
|
|
|
|
);
|
2014-02-27 07:19:06 +00:00
|
|
|
}
|
2013-12-16 11:22:23 +00:00
|
|
|
}
|
|
|
|
|
2014-04-07 10:16:49 +00:00
|
|
|
/**
|
|
|
|
* Mutes / unmutes audio for the local participant.
|
|
|
|
*/
|
2013-12-16 11:22:23 +00:00
|
|
|
function toggleAudio() {
|
2014-05-11 22:41:58 +00:00
|
|
|
if (!(connection && connection.jingle.localAudio)) {
|
2014-05-30 15:18:32 +00:00
|
|
|
// We still click the button.
|
|
|
|
buttonClick("#mute", "icon-microphone icon-mic-disabled");
|
2014-04-07 10:16:49 +00:00
|
|
|
return;
|
2014-05-11 22:41:58 +00:00
|
|
|
}
|
|
|
|
|
2014-10-13 08:29:07 +00:00
|
|
|
// It is not clear what is the right way to handle multiple tracks.
|
|
|
|
// So at least make sure that they are all muted or all unmuted and
|
|
|
|
// that we send presence just once.
|
|
|
|
var localAudioTracks = connection.jingle.localAudio.getAudioTracks();
|
|
|
|
if (localAudioTracks.length > 0) {
|
|
|
|
var audioEnabled = localAudioTracks[0].enabled;
|
|
|
|
|
|
|
|
for (var idx = 0; idx < localAudioTracks.length; idx++) {
|
|
|
|
localAudioTracks[idx].enabled = !audioEnabled;
|
|
|
|
}
|
2014-04-07 10:16:49 +00:00
|
|
|
|
2014-05-30 15:18:32 +00:00
|
|
|
// isMuted is the opposite of audioEnabled
|
|
|
|
connection.emuc.addAudioInfoToPresence(audioEnabled);
|
2014-04-07 10:16:49 +00:00
|
|
|
connection.emuc.sendPresence();
|
2014-10-13 08:29:07 +00:00
|
|
|
VideoLayout.showLocalAudioIndicator(audioEnabled);
|
2013-12-16 11:22:23 +00:00
|
|
|
}
|
2014-05-11 22:41:58 +00:00
|
|
|
|
|
|
|
buttonClick("#mute", "icon-microphone icon-mic-disabled");
|
2013-12-16 11:22:23 +00:00
|
|
|
}
|
|
|
|
|
2014-07-28 11:31:32 +00:00
|
|
|
/**
|
|
|
|
* Checks whether the audio is muted or not.
|
|
|
|
* @returns {boolean} true if audio is muted and false if not.
|
|
|
|
*/
|
|
|
|
function isAudioMuted()
|
|
|
|
{
|
|
|
|
var localAudio = connection.jingle.localAudio;
|
|
|
|
for (var idx = 0; idx < localAudio.getAudioTracks().length; idx++) {
|
|
|
|
if(localAudio.getAudioTracks()[idx].enabled === true)
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-07-01 14:02:34 +00:00
|
|
|
// Starts or stops the recording for the conference.
|
|
|
|
function toggleRecording() {
|
|
|
|
if (focus === null || focus.confid === null) {
|
|
|
|
console.log('non-focus, or conference not yet organized: not enabling recording');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!recordingToken)
|
|
|
|
{
|
2014-08-14 15:29:28 +00:00
|
|
|
messageHandler.openTwoButtonDialog(null,
|
|
|
|
'<h2>Enter recording token</h2>' +
|
2014-07-01 14:02:34 +00:00
|
|
|
'<input id="recordingToken" type="text" placeholder="token" autofocus>',
|
2014-08-14 15:29:28 +00:00
|
|
|
false,
|
|
|
|
"Save",
|
|
|
|
function (e, v, m, f) {
|
|
|
|
if (v) {
|
|
|
|
var token = document.getElementById('recordingToken');
|
|
|
|
|
|
|
|
if (token.value) {
|
|
|
|
setRecordingToken(Util.escapeHtml(token.value));
|
|
|
|
toggleRecording();
|
2014-07-01 14:02:34 +00:00
|
|
|
}
|
|
|
|
}
|
2014-08-14 15:29:28 +00:00
|
|
|
},
|
|
|
|
function (event) {
|
|
|
|
document.getElementById('recordingToken').focus();
|
2014-07-01 14:02:34 +00:00
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
var oldState = focus.recordingEnabled;
|
2014-07-23 07:47:00 +00:00
|
|
|
Toolbar.toggleRecordingButtonState();
|
2014-07-01 14:02:34 +00:00
|
|
|
focus.setRecording(!oldState,
|
|
|
|
recordingToken,
|
|
|
|
function (state) {
|
|
|
|
console.log("New recording state: ", state);
|
|
|
|
if (state == oldState) //failed to change, reset the token because it might have been wrong
|
|
|
|
{
|
2014-07-23 07:47:00 +00:00
|
|
|
Toolbar.toggleRecordingButtonState();
|
2014-07-01 14:02:34 +00:00
|
|
|
setRecordingToken(null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-03-26 10:33:46 +00:00
|
|
|
/**
|
|
|
|
* Returns an array of the video horizontal and vertical indents,
|
|
|
|
* so that if fits its parent.
|
|
|
|
*
|
|
|
|
* @return an array with 2 elements, the horizontal indent and the vertical
|
|
|
|
* indent
|
|
|
|
*/
|
2014-04-13 12:30:47 +00:00
|
|
|
function getCameraVideoPosition(videoWidth,
|
|
|
|
videoHeight,
|
|
|
|
videoSpaceWidth,
|
|
|
|
videoSpaceHeight) {
|
2014-03-26 10:33:46 +00:00
|
|
|
// Parent height isn't completely calculated when we position the video in
|
|
|
|
// full screen mode and this is why we use the screen height in this case.
|
|
|
|
// Need to think it further at some point and implement it properly.
|
2014-04-13 12:30:47 +00:00
|
|
|
var isFullScreen = document.fullScreen ||
|
|
|
|
document.mozFullScreen ||
|
|
|
|
document.webkitIsFullScreen;
|
2014-03-26 10:33:46 +00:00
|
|
|
if (isFullScreen)
|
|
|
|
videoSpaceHeight = window.innerHeight;
|
|
|
|
|
2014-04-13 12:30:47 +00:00
|
|
|
var horizontalIndent = (videoSpaceWidth - videoWidth) / 2;
|
|
|
|
var verticalIndent = (videoSpaceHeight - videoHeight) / 2;
|
2014-03-26 10:33:46 +00:00
|
|
|
|
|
|
|
return [horizontalIndent, verticalIndent];
|
2014-03-28 09:37:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns an array of the video horizontal and vertical indents.
|
|
|
|
* Centers horizontally and top aligns vertically.
|
|
|
|
*
|
|
|
|
* @return an array with 2 elements, the horizontal indent and the vertical
|
|
|
|
* indent
|
|
|
|
*/
|
2014-04-13 12:30:47 +00:00
|
|
|
function getDesktopVideoPosition(videoWidth,
|
|
|
|
videoHeight,
|
|
|
|
videoSpaceWidth,
|
|
|
|
videoSpaceHeight) {
|
2014-03-28 09:37:14 +00:00
|
|
|
|
2014-04-13 12:30:47 +00:00
|
|
|
var horizontalIndent = (videoSpaceWidth - videoWidth) / 2;
|
2014-03-28 09:37:14 +00:00
|
|
|
|
|
|
|
var verticalIndent = 0;// Top aligned
|
|
|
|
|
|
|
|
return [horizontalIndent, verticalIndent];
|
|
|
|
}
|
2013-12-16 11:22:23 +00:00
|
|
|
|
2014-03-26 10:33:46 +00:00
|
|
|
/**
|
2014-03-26 18:06:34 +00:00
|
|
|
* Returns an array of the video dimensions, so that it covers the screen.
|
|
|
|
* It leaves no empty areas, but some parts of the video might not be visible.
|
2014-03-26 10:33:46 +00:00
|
|
|
*
|
|
|
|
* @return an array with 2 elements, the video width and the video height
|
|
|
|
*/
|
2014-03-28 09:37:14 +00:00
|
|
|
function getCameraVideoSize(videoWidth,
|
2014-03-26 18:06:34 +00:00
|
|
|
videoHeight,
|
|
|
|
videoSpaceWidth,
|
|
|
|
videoSpaceHeight) {
|
2014-03-26 10:33:46 +00:00
|
|
|
if (!videoWidth)
|
|
|
|
videoWidth = currentVideoWidth;
|
|
|
|
if (!videoHeight)
|
|
|
|
videoHeight = currentVideoHeight;
|
|
|
|
|
|
|
|
var aspectRatio = videoWidth / videoHeight;
|
|
|
|
|
|
|
|
var availableWidth = Math.max(videoWidth, videoSpaceWidth);
|
|
|
|
var availableHeight = Math.max(videoHeight, videoSpaceHeight);
|
|
|
|
|
|
|
|
if (availableWidth / aspectRatio < videoSpaceHeight) {
|
|
|
|
availableHeight = videoSpaceHeight;
|
2014-04-13 12:30:47 +00:00
|
|
|
availableWidth = availableHeight * aspectRatio;
|
2013-12-16 11:22:23 +00:00
|
|
|
}
|
2014-01-28 14:11:05 +00:00
|
|
|
|
2014-04-13 12:30:47 +00:00
|
|
|
if (availableHeight * aspectRatio < videoSpaceWidth) {
|
2014-03-26 10:33:46 +00:00
|
|
|
availableWidth = videoSpaceWidth;
|
|
|
|
availableHeight = availableWidth / aspectRatio;
|
2014-01-28 14:11:05 +00:00
|
|
|
}
|
2014-02-12 22:24:26 +00:00
|
|
|
|
2014-03-26 10:33:46 +00:00
|
|
|
return [availableWidth, availableHeight];
|
2014-03-26 18:06:34 +00:00
|
|
|
}
|
|
|
|
|
2013-12-16 11:22:23 +00:00
|
|
|
$(document).ready(function () {
|
2014-09-02 10:42:35 +00:00
|
|
|
document.title = brand.appName;
|
2014-10-22 09:03:07 +00:00
|
|
|
if(APIConnector.isEnabled())
|
|
|
|
APIConnector.init();
|
2014-08-21 16:42:54 +00:00
|
|
|
|
2014-08-25 12:48:16 +00:00
|
|
|
if(config.enableWelcomePage && window.location.pathname == "/" &&
|
2014-09-24 14:44:52 +00:00
|
|
|
(!window.localStorage.welcomePageDisabled
|
|
|
|
|| window.localStorage.welcomePageDisabled == "false"))
|
2014-08-21 16:42:54 +00:00
|
|
|
{
|
|
|
|
$("#videoconference_page").hide();
|
2014-09-24 14:44:52 +00:00
|
|
|
$("#domain_name").text(
|
|
|
|
window.location.protocol + "//" + window.location.host + "/");
|
2014-08-26 10:54:43 +00:00
|
|
|
$("span[name='appName']").text(brand.appName);
|
2014-09-24 14:44:52 +00:00
|
|
|
|
2014-09-25 10:48:37 +00:00
|
|
|
if (interfaceConfig.SHOW_JITSI_WATERMARK) {
|
|
|
|
var leftWatermarkDiv
|
|
|
|
= $("#welcome_page_header div[class='watermark leftwatermark']");
|
2014-09-25 12:01:18 +00:00
|
|
|
if(leftWatermarkDiv && leftWatermarkDiv.length > 0)
|
|
|
|
{
|
|
|
|
leftWatermarkDiv.css({display: 'block'});
|
|
|
|
leftWatermarkDiv.parent().get(0).href
|
|
|
|
= interfaceConfig.JITSI_WATERMARK_LINK;
|
|
|
|
}
|
2014-09-25 10:48:37 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (interfaceConfig.SHOW_BRAND_WATERMARK) {
|
|
|
|
var rightWatermarkDiv
|
|
|
|
= $("#welcome_page_header div[class='watermark rightwatermark']");
|
2014-09-25 12:07:06 +00:00
|
|
|
if(rightWatermarkDiv && rightWatermarkDiv.length > 0) {
|
|
|
|
rightWatermarkDiv.css({display: 'block'});
|
|
|
|
rightWatermarkDiv.parent().get(0).href
|
|
|
|
= interfaceConfig.BRAND_WATERMARK_LINK;
|
|
|
|
rightWatermarkDiv.get(0).style.backgroundImage
|
2014-10-01 13:49:14 +00:00
|
|
|
= "url(images/rightwatermark.png)";
|
2014-09-25 12:07:06 +00:00
|
|
|
}
|
2014-09-25 10:48:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (interfaceConfig.SHOW_POWERED_BY) {
|
|
|
|
$("#welcome_page_header>a[class='poweredby']")
|
|
|
|
.css({display: 'block'});
|
|
|
|
}
|
|
|
|
|
2014-09-02 08:03:53 +00:00
|
|
|
function enter_room()
|
2014-08-21 16:42:54 +00:00
|
|
|
{
|
2014-08-26 10:54:43 +00:00
|
|
|
var val = $("#enter_room_field").val();
|
2014-10-01 19:21:57 +00:00
|
|
|
if(!val) {
|
2014-08-27 08:43:43 +00:00
|
|
|
val = $("#enter_room_field").attr("room_name");
|
2014-10-01 19:21:57 +00:00
|
|
|
}
|
|
|
|
if (val) {
|
|
|
|
window.location.pathname = "/" + val;
|
|
|
|
}
|
2014-09-02 08:03:53 +00:00
|
|
|
}
|
|
|
|
$("#enter_room_button").click(function()
|
|
|
|
{
|
|
|
|
enter_room();
|
2014-08-21 16:42:54 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
$("#enter_room_field").keydown(function (event) {
|
2014-10-01 19:21:57 +00:00
|
|
|
if (event.keyCode === 13 /* enter */) {
|
2014-09-02 08:03:53 +00:00
|
|
|
enter_room();
|
2014-08-21 16:42:54 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2014-10-10 12:43:05 +00:00
|
|
|
if (!(interfaceConfig.GENERATE_ROOMNAMES_ON_WELCOME_PAGE === false)){
|
2014-10-01 19:21:57 +00:00
|
|
|
var updateTimeout;
|
|
|
|
var animateTimeout;
|
|
|
|
$("#reload_roomname").click(function () {
|
|
|
|
clearTimeout(updateTimeout);
|
|
|
|
clearTimeout(animateTimeout);
|
|
|
|
update_roomname();
|
|
|
|
});
|
|
|
|
$("#reload_roomname").show();
|
|
|
|
|
|
|
|
function animate(word) {
|
|
|
|
var currentVal = $("#enter_room_field").attr("placeholder");
|
|
|
|
$("#enter_room_field").attr("placeholder", currentVal + word.substr(0, 1));
|
|
|
|
animateTimeout = setTimeout(function() {
|
2014-08-26 10:54:43 +00:00
|
|
|
animate(word.substring(1, word.length))
|
2014-08-27 10:59:28 +00:00
|
|
|
}, 70);
|
2014-10-01 19:21:57 +00:00
|
|
|
}
|
2014-08-26 10:54:43 +00:00
|
|
|
|
2014-10-01 19:21:57 +00:00
|
|
|
function update_roomname()
|
|
|
|
{
|
|
|
|
var word = RoomNameGenerator.generateRoomWithoutSeparator();
|
|
|
|
$("#enter_room_field").attr("room_name", word);
|
|
|
|
$("#enter_room_field").attr("placeholder", "");
|
|
|
|
clearTimeout(animateTimeout);
|
|
|
|
animate(word);
|
|
|
|
updateTimeout = setTimeout(update_roomname, 10000);
|
|
|
|
}
|
|
|
|
update_roomname();
|
2014-08-26 10:54:43 +00:00
|
|
|
}
|
|
|
|
|
2014-08-25 12:48:16 +00:00
|
|
|
$("#disable_welcome").click(function () {
|
2014-09-25 10:48:37 +00:00
|
|
|
window.localStorage.welcomePageDisabled
|
|
|
|
= $("#disable_welcome").is(":checked");
|
2014-08-25 12:48:16 +00:00
|
|
|
});
|
|
|
|
|
2014-08-21 16:42:54 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-09-25 10:48:37 +00:00
|
|
|
if (interfaceConfig.SHOW_JITSI_WATERMARK) {
|
|
|
|
var leftWatermarkDiv
|
|
|
|
= $("#largeVideoContainer div[class='watermark leftwatermark']");
|
|
|
|
|
|
|
|
leftWatermarkDiv.css({display: 'block'});
|
|
|
|
leftWatermarkDiv.parent().get(0).href
|
|
|
|
= interfaceConfig.JITSI_WATERMARK_LINK;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (interfaceConfig.SHOW_BRAND_WATERMARK) {
|
|
|
|
var rightWatermarkDiv
|
|
|
|
= $("#largeVideoContainer div[class='watermark rightwatermark']");
|
|
|
|
|
|
|
|
rightWatermarkDiv.css({display: 'block'});
|
|
|
|
rightWatermarkDiv.parent().get(0).href
|
|
|
|
= interfaceConfig.BRAND_WATERMARK_LINK;
|
|
|
|
rightWatermarkDiv.get(0).style.backgroundImage
|
2014-10-01 13:49:14 +00:00
|
|
|
= "url(images/rightwatermark.png)";
|
2014-09-25 10:48:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (interfaceConfig.SHOW_POWERED_BY) {
|
|
|
|
$("#largeVideoContainer>a[class='poweredby']").css({display: 'block'});
|
|
|
|
}
|
|
|
|
|
2014-08-21 16:42:54 +00:00
|
|
|
$("#welcome_page").hide();
|
2014-02-18 19:11:27 +00:00
|
|
|
Chat.init();
|
2013-12-16 11:22:23 +00:00
|
|
|
|
2014-06-18 11:42:31 +00:00
|
|
|
$('body').popover({ selector: '[data-toggle=popover]',
|
2014-09-08 17:01:10 +00:00
|
|
|
trigger: 'click hover',
|
|
|
|
content: function() {
|
|
|
|
return this.getAttribute("content") +
|
|
|
|
KeyboardShortcut.getShortcut(this.getAttribute("shortcut"));
|
|
|
|
}
|
|
|
|
});
|
2014-06-18 11:42:31 +00:00
|
|
|
|
2014-01-24 10:24:18 +00:00
|
|
|
// Set the defaults for prompt dialogs.
|
|
|
|
jQuery.prompt.setDefaults({persistent: false});
|
|
|
|
|
2014-03-26 11:32:42 +00:00
|
|
|
// Set default desktop sharing method
|
|
|
|
setDesktopSharing(config.desktopSharing);
|
2014-04-01 11:19:11 +00:00
|
|
|
// Initialize Chrome extension inline installs
|
2014-04-13 12:30:47 +00:00
|
|
|
if (config.chromeExtensionId) {
|
2014-04-01 11:19:11 +00:00
|
|
|
initInlineInstalls();
|
|
|
|
}
|
2014-03-26 11:32:42 +00:00
|
|
|
|
2014-03-28 09:37:14 +00:00
|
|
|
// By default we use camera
|
|
|
|
getVideoSize = getCameraVideoSize;
|
|
|
|
getVideoPosition = getCameraVideoPosition;
|
2014-03-26 18:06:34 +00:00
|
|
|
|
2014-06-12 18:35:42 +00:00
|
|
|
VideoLayout.resizeLargeVideoContainer();
|
2013-12-16 11:22:23 +00:00
|
|
|
$(window).resize(function () {
|
2014-06-12 18:35:42 +00:00
|
|
|
VideoLayout.resizeLargeVideoContainer();
|
|
|
|
VideoLayout.positionLarge();
|
2013-12-16 11:22:23 +00:00
|
|
|
});
|
2014-03-26 18:06:34 +00:00
|
|
|
// Listen for large video size updates
|
|
|
|
document.getElementById('largeVideo')
|
2014-04-13 12:30:47 +00:00
|
|
|
.addEventListener('loadedmetadata', function (e) {
|
2014-03-26 18:06:34 +00:00
|
|
|
currentVideoWidth = this.videoWidth;
|
|
|
|
currentVideoHeight = this.videoHeight;
|
2014-06-12 18:35:42 +00:00
|
|
|
VideoLayout.positionLarge(currentVideoWidth, currentVideoHeight);
|
2014-03-26 18:06:34 +00:00
|
|
|
});
|
|
|
|
|
2013-12-16 11:22:23 +00:00
|
|
|
if (!$('#settings').is(':visible')) {
|
|
|
|
console.log('init');
|
|
|
|
init();
|
|
|
|
} else {
|
|
|
|
loginInfo.onsubmit = function (e) {
|
|
|
|
if (e.preventDefault) e.preventDefault();
|
|
|
|
$('#settings').hide();
|
|
|
|
init();
|
|
|
|
};
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2013-12-30 08:31:08 +00:00
|
|
|
$(window).bind('beforeunload', function () {
|
2013-12-16 11:22:23 +00:00
|
|
|
if (connection && connection.connected) {
|
|
|
|
// ensure signout
|
|
|
|
$.ajax({
|
|
|
|
type: 'POST',
|
|
|
|
url: config.bosh,
|
|
|
|
async: false,
|
|
|
|
cache: false,
|
|
|
|
contentType: 'application/xml',
|
2014-09-25 10:48:37 +00:00
|
|
|
data: "<body rid='" + (connection.rid || connection._proto.rid)
|
|
|
|
+ "' xmlns='http://jabber.org/protocol/httpbind' sid='"
|
|
|
|
+ (connection.sid || connection._proto.sid)
|
|
|
|
+ "' type='terminate'><presence xmlns='jabber:client' type='unavailable'/></body>",
|
2013-12-16 11:22:23 +00:00
|
|
|
success: function (data) {
|
|
|
|
console.log('signed out');
|
|
|
|
console.log(data);
|
|
|
|
},
|
|
|
|
error: function (XMLHttpRequest, textStatus, errorThrown) {
|
|
|
|
console.log('signout error', textStatus + ' (' + errorThrown + ')');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2014-06-26 14:58:43 +00:00
|
|
|
disposeConference(true);
|
2014-10-22 09:03:07 +00:00
|
|
|
if(APIConnector.isEnabled())
|
|
|
|
APIConnector.dispose();
|
2013-12-16 11:22:23 +00:00
|
|
|
});
|
|
|
|
|
2014-06-26 14:58:43 +00:00
|
|
|
function disposeConference(onUnload) {
|
2014-03-24 15:55:33 +00:00
|
|
|
var handler = getConferenceHandler();
|
2014-04-13 12:30:47 +00:00
|
|
|
if (handler && handler.peerconnection) {
|
2014-09-25 10:48:37 +00:00
|
|
|
// FIXME: probably removing streams is not required and close() should
|
|
|
|
// be enough
|
2014-04-13 12:30:47 +00:00
|
|
|
if (connection.jingle.localAudio) {
|
2014-03-24 15:55:33 +00:00
|
|
|
handler.peerconnection.removeStream(connection.jingle.localAudio);
|
|
|
|
}
|
2014-04-13 12:30:47 +00:00
|
|
|
if (connection.jingle.localVideo) {
|
2014-03-24 15:55:33 +00:00
|
|
|
handler.peerconnection.removeStream(connection.jingle.localVideo);
|
|
|
|
}
|
|
|
|
handler.peerconnection.close();
|
|
|
|
}
|
2014-07-03 12:30:07 +00:00
|
|
|
stopRTPStatsCollector();
|
2014-07-27 12:24:27 +00:00
|
|
|
if(onUnload) {
|
2014-06-26 14:58:43 +00:00
|
|
|
stopLocalRtpStatsCollector();
|
|
|
|
}
|
2014-03-24 15:55:33 +00:00
|
|
|
focus = null;
|
|
|
|
activecall = null;
|
|
|
|
}
|
|
|
|
|
2014-04-13 12:30:47 +00:00
|
|
|
function dump(elem, filename) {
|
2013-12-22 18:46:01 +00:00
|
|
|
elem = elem.parentNode;
|
2014-01-15 09:18:23 +00:00
|
|
|
elem.download = filename || 'meetlog.json';
|
2013-12-22 18:39:41 +00:00
|
|
|
elem.href = 'data:application/json;charset=utf-8,\n';
|
2014-08-14 15:29:28 +00:00
|
|
|
var data = populateData();
|
|
|
|
elem.href += encodeURIComponent(JSON.stringify(data, null, ' '));
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Populates the log data
|
|
|
|
*/
|
|
|
|
function populateData() {
|
2013-12-22 18:39:41 +00:00
|
|
|
var data = {};
|
|
|
|
if (connection.jingle) {
|
|
|
|
Object.keys(connection.jingle.sessions).forEach(function (sid) {
|
|
|
|
var session = connection.jingle.sessions[sid];
|
|
|
|
if (session.peerconnection && session.peerconnection.updateLog) {
|
|
|
|
// FIXME: should probably be a .dump call
|
2014-01-15 09:18:23 +00:00
|
|
|
data["jingle_" + session.sid] = {
|
|
|
|
updateLog: session.peerconnection.updateLog,
|
2014-02-05 20:34:59 +00:00
|
|
|
stats: session.peerconnection.stats,
|
2014-04-13 12:30:47 +00:00
|
|
|
url: window.location.href
|
|
|
|
};
|
2013-12-22 18:39:41 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2014-08-14 15:29:28 +00:00
|
|
|
var metadata = {};
|
2014-01-15 09:18:23 +00:00
|
|
|
metadata.time = new Date();
|
|
|
|
metadata.url = window.location.href;
|
|
|
|
metadata.ua = navigator.userAgent;
|
|
|
|
if (connection.logger) {
|
|
|
|
metadata.xmpp = connection.logger.log;
|
|
|
|
}
|
|
|
|
data.metadata = metadata;
|
2014-08-14 15:29:28 +00:00
|
|
|
return data;
|
2013-12-22 18:39:41 +00:00
|
|
|
}
|
|
|
|
|
2014-03-26 10:33:46 +00:00
|
|
|
/**
|
2013-12-20 14:19:17 +00:00
|
|
|
* Changes the style class of the element given by id.
|
|
|
|
*/
|
2013-12-16 11:22:23 +00:00
|
|
|
function buttonClick(id, classname) {
|
|
|
|
$(id).toggleClass(classname); // add the class to the clicked element
|
|
|
|
}
|
|
|
|
|
2014-03-26 10:33:46 +00:00
|
|
|
/**
|
2013-12-20 14:19:17 +00:00
|
|
|
* Locks / unlocks the room.
|
|
|
|
*/
|
2013-12-16 11:22:23 +00:00
|
|
|
function lockRoom(lock) {
|
2014-01-03 16:41:50 +00:00
|
|
|
if (lock)
|
|
|
|
connection.emuc.lockRoom(sharedKey);
|
|
|
|
else
|
|
|
|
connection.emuc.lockRoom('');
|
2014-02-26 15:19:39 +00:00
|
|
|
|
2014-06-12 18:35:42 +00:00
|
|
|
Toolbar.updateLockButton();
|
2013-12-23 16:10:07 +00:00
|
|
|
}
|
|
|
|
|
2014-03-26 10:33:46 +00:00
|
|
|
/**
|
2013-12-23 16:10:07 +00:00
|
|
|
* Sets the shared key.
|
|
|
|
*/
|
|
|
|
function setSharedKey(sKey) {
|
|
|
|
sharedKey = sKey;
|
|
|
|
}
|
|
|
|
|
2014-07-01 14:02:34 +00:00
|
|
|
function setRecordingToken(token) {
|
|
|
|
recordingToken = token;
|
|
|
|
}
|
|
|
|
|
2014-03-26 10:33:46 +00:00
|
|
|
/**
|
2013-12-20 14:19:17 +00:00
|
|
|
* Updates the room invite url.
|
|
|
|
*/
|
2013-12-16 11:22:23 +00:00
|
|
|
function updateRoomUrl(newRoomUrl) {
|
|
|
|
roomUrl = newRoomUrl;
|
2014-05-22 16:56:09 +00:00
|
|
|
|
|
|
|
// If the invite dialog has been already opened we update the information.
|
|
|
|
var inviteLink = document.getElementById('inviteLinkRef');
|
|
|
|
if (inviteLink) {
|
|
|
|
inviteLink.value = roomUrl;
|
|
|
|
inviteLink.select();
|
|
|
|
document.getElementById('jqi_state0_buttonInvite').disabled = false;
|
|
|
|
}
|
2013-12-16 11:22:23 +00:00
|
|
|
}
|
2013-12-20 14:19:17 +00:00
|
|
|
|
2014-03-26 10:33:46 +00:00
|
|
|
/**
|
2013-12-20 14:19:17 +00:00
|
|
|
* Warning to the user that the conference window is about to be closed.
|
|
|
|
*/
|
|
|
|
function closePageWarning() {
|
2014-03-01 07:39:39 +00:00
|
|
|
if (focus !== null)
|
2014-06-12 18:35:42 +00:00
|
|
|
return "You are the owner of this conference call and"
|
|
|
|
+ " you are about to end it.";
|
2013-12-20 14:19:17 +00:00
|
|
|
else
|
|
|
|
return "You are about to leave this conversation.";
|
|
|
|
}
|
2014-01-15 09:29:27 +00:00
|
|
|
|
2014-03-26 10:33:46 +00:00
|
|
|
/**
|
|
|
|
* Resizes and repositions videos in full screen mode.
|
|
|
|
*/
|
|
|
|
$(document).on('webkitfullscreenchange mozfullscreenchange fullscreenchange',
|
2014-04-13 12:30:47 +00:00
|
|
|
function () {
|
2014-06-12 18:35:42 +00:00
|
|
|
VideoLayout.resizeLargeVideoContainer();
|
|
|
|
VideoLayout.positionLarge();
|
2014-04-13 12:30:47 +00:00
|
|
|
isFullScreen = document.fullScreen ||
|
|
|
|
document.mozFullScreen ||
|
|
|
|
document.webkitIsFullScreen;
|
|
|
|
|
|
|
|
if (isFullScreen) {
|
|
|
|
setView("fullscreen");
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
setView("default");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
2014-03-26 10:33:46 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the current view.
|
|
|
|
*/
|
|
|
|
function setView(viewName) {
|
|
|
|
// if (viewName == "fullscreen") {
|
|
|
|
// document.getElementById('videolayout_fullscreen').disabled = false;
|
|
|
|
// document.getElementById('videolayout_default').disabled = true;
|
|
|
|
// }
|
|
|
|
// else {
|
|
|
|
// document.getElementById('videolayout_default').disabled = false;
|
|
|
|
// document.getElementById('videolayout_fullscreen').disabled = true;
|
|
|
|
// }
|
2014-04-07 09:51:33 +00:00
|
|
|
}
|
2014-06-18 17:05:22 +00:00
|
|
|
|
2014-08-22 15:37:11 +00:00
|
|
|
function hangUp() {
|
|
|
|
if (connection && connection.connected) {
|
|
|
|
// ensure signout
|
|
|
|
$.ajax({
|
|
|
|
type: 'POST',
|
|
|
|
url: config.bosh,
|
|
|
|
async: false,
|
|
|
|
cache: false,
|
|
|
|
contentType: 'application/xml',
|
|
|
|
data: "<body rid='" + (connection.rid || connection._proto.rid) + "' xmlns='http://jabber.org/protocol/httpbind' sid='" + (connection.sid || connection._proto.sid) + "' type='terminate'><presence xmlns='jabber:client' type='unavailable'/></body>",
|
|
|
|
success: function (data) {
|
|
|
|
console.log('signed out');
|
|
|
|
console.log(data);
|
|
|
|
},
|
|
|
|
error: function (XMLHttpRequest, textStatus, errorThrown) {
|
|
|
|
console.log('signout error', textStatus + ' (' + errorThrown + ')');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
disposeConference(true);
|
|
|
|
}
|
2014-07-01 14:02:34 +00:00
|
|
|
|
2014-06-18 17:05:22 +00:00
|
|
|
$(document).bind('fatalError.jingle',
|
|
|
|
function (event, session, error)
|
|
|
|
{
|
|
|
|
sessionTerminated = true;
|
|
|
|
connection.emuc.doLeave();
|
2014-08-14 15:29:28 +00:00
|
|
|
messageHandler.showError( "Sorry",
|
2014-06-18 17:05:22 +00:00
|
|
|
"Your browser version is too old. Please update and try again...");
|
|
|
|
}
|
|
|
|
);
|
2014-08-08 13:25:24 +00:00
|
|
|
|
2014-09-16 13:43:41 +00:00
|
|
|
function onSelectedEndpointChanged(userJid)
|
|
|
|
{
|
|
|
|
console.log('selected endpoint changed: ', userJid);
|
2014-10-02 17:11:55 +00:00
|
|
|
if (_dataChannels && _dataChannels.length != 0)
|
|
|
|
{
|
|
|
|
_dataChannels.some(function (dataChannel) {
|
|
|
|
if (dataChannel.readyState == 'open')
|
|
|
|
{
|
|
|
|
dataChannel.send(JSON.stringify({
|
|
|
|
'colibriClass': 'SelectedEndpointChangedEvent',
|
|
|
|
'selectedEndpoint': (!userJid || userJid == null)
|
|
|
|
? null : Strophe.getResourceFromJid(userJid)
|
|
|
|
}));
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
});
|
2014-09-12 17:54:40 +00:00
|
|
|
}
|
2014-09-16 13:43:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$(document).bind("selectedendpointchanged", function(event, userJid) {
|
|
|
|
onSelectedEndpointChanged(userJid);
|
2014-09-12 17:54:40 +00:00
|
|
|
});
|
|
|
|
|
2014-08-08 13:25:24 +00:00
|
|
|
function callSipButtonClicked()
|
|
|
|
{
|
2014-09-25 13:51:28 +00:00
|
|
|
var defaultNumber
|
|
|
|
= config.defaultSipNumber ? config.defaultSipNumber : '';
|
|
|
|
|
2014-08-14 15:29:28 +00:00
|
|
|
messageHandler.openTwoButtonDialog(null,
|
|
|
|
'<h2>Enter SIP number</h2>' +
|
|
|
|
'<input id="sipNumber" type="text"' +
|
2014-09-25 13:51:28 +00:00
|
|
|
' value="' + defaultNumber + '" autofocus>',
|
2014-08-14 15:29:28 +00:00
|
|
|
false,
|
|
|
|
"Dial",
|
|
|
|
function (e, v, m, f) {
|
|
|
|
if (v) {
|
|
|
|
var numberInput = document.getElementById('sipNumber');
|
|
|
|
if (numberInput.value) {
|
|
|
|
connection.rayo.dial(
|
|
|
|
numberInput.value, 'fromnumber', roomName);
|
2014-08-08 13:25:24 +00:00
|
|
|
}
|
|
|
|
}
|
2014-08-14 15:29:28 +00:00
|
|
|
},
|
|
|
|
function (event) {
|
|
|
|
document.getElementById('sipNumber').focus();
|
2014-08-08 13:25:24 +00:00
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
2014-08-25 12:48:16 +00:00
|
|
|
|
|
|
|
function hangup() {
|
|
|
|
disposeConference();
|
|
|
|
sessionTerminated = true;
|
|
|
|
connection.emuc.doLeave();
|
|
|
|
if(config.enableWelcomePage)
|
|
|
|
{
|
|
|
|
setTimeout(function()
|
|
|
|
{
|
|
|
|
window.localStorage.welcomePageDisabled = false;
|
|
|
|
window.location.pathname = "/";
|
|
|
|
}, 10000);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$.prompt("Session Terminated",
|
|
|
|
{
|
2014-08-26 15:30:49 +00:00
|
|
|
title: "You hung up the call",
|
2014-08-25 12:48:16 +00:00
|
|
|
persistent: true,
|
2014-08-26 15:30:49 +00:00
|
|
|
buttons: {
|
|
|
|
"Join again": true
|
|
|
|
},
|
|
|
|
closeText: '',
|
|
|
|
submit: function(event, value, message, formVals)
|
|
|
|
{
|
|
|
|
window.location.reload();
|
|
|
|
return false;
|
|
|
|
}
|
2014-08-25 12:48:16 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|