Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

Waits for the focus to join first.

paweldomas613e18952b66
diff --git a/app.js b/app.js
index 970f96fcee..33b7d621df 100644
--- a/app.js
+++ b/app.js
@@ -182,11 +182,9 @@ function maybeDoJoin() {
}
}
-
-function doJoin() {
+function generateRoomName() {
var roomnode = null;
var path = window.location.pathname;
- var roomjid;
// determinde the room node from the url
// TODO: just the roomnode or the whole bare jid?
@@ -214,7 +212,41 @@ function doJoin() {
}
roomName = roomnode + '@' + config.hosts.muc;
+}
+
+function doJoin() {
+ if (!roomName) {
+ generateRoomName();
+ }
+
+ var elem = $iq({to: config.hosts.focus, type: 'set'});
+ elem.c('conference', {
+ xmlns: 'http://jitsi.org/protocol/focus',
+ room: roomName
+ });
+ elem.up();
+ connection.sendIQ(elem,
+ function (result) {
+ console.info("Focus replied ", result);
+ if ('true' === $(result).find('conference').attr('ready')) {
+ doJoinAfterFocus();
+ } else {
+ console.info("Waiting for the focus...");
+ window.setTimeout(
+ function () {
+ doJoin();
+ }, 3000);
+ }
+ },
+ function (error) {
+ console.warn(error);
+ }
+ );
+}
+
+function doJoinAfterFocus() {
+ var roomjid;
roomjid = roomName;
if (config.useNicks) {
@@ -676,53 +708,6 @@ $(document).bind('joined.muc', function (event, jid, info) {
document.createTextNode(Strophe.getResourceFromJid(jid) + ' (me)')
);
- if (connection.emuc.isModerator())
- {
- Toolbar.showSipCallButton(true);
- Toolbar.showRecordingButton(true);
- }
- else
- {
- Toolbar.showSipCallButton(false);
- Toolbar.showRecordingButton(false);
- }
-/* if (Object.keys(connection.emuc.members).length < 1) {
- focus = new ColibriFocus(connection, config.hosts.bridge);
- if (nickname !== null) {
- focus.setEndpointDisplayName(connection.emuc.myroomjid,
- nickname);
- }
- Toolbar.showSipCallButton(true);
- Toolbar.showRecordingButton(false);
- }
-
- if (!focus)
- {
- Toolbar.showSipCallButton(false);
- }
-
- if (focus && config.etherpad_base) {
- Etherpad.init();
- }*/
-
- var elem = $iq({to: config.hosts.focus, type: 'set'});
- elem.c('conference', {
- xmlns: 'http://jitsi.org/protocol/focus',
- room: roomUrl.substr(roomUrl.lastIndexOf("/") + 1)
- });
- elem.up();
-
- connection.sendIQ(elem,
- function (result) {
- console.info("Focus replied ", result);
- },
- function (error) {
- console.warn(error);
- }
- );
-
- VideoLayout.showFocusIndicator();
-
// Add myself to the contact list.
ContactList.addContact(jid);