diff --git a/app.js b/app.js index 277cbb161..e8a02a2ee 100644 --- a/app.js +++ b/app.js @@ -52,7 +52,7 @@ const APP = { handler: null }, // Used for automated performance tests - performanceTimes: { + connectionTimes: { "index.loaded": window.indexLoadedTime }, UI, @@ -103,7 +103,7 @@ function obtainConfigAndInit() { // Get config result callback function(success, error) { if (success) { - var now = APP.performanceTimes["configuration.fetched"] = + var now = APP.connectionTimes["configuration.fetched"] = window.performance.now(); console.log("(TIME) configuration fetched:\t", now); init(); @@ -124,7 +124,7 @@ function obtainConfigAndInit() { $(document).ready(function () { - var now = APP.performanceTimes["document.ready"] = window.performance.now(); + var now = APP.connectionTimes["document.ready"] = window.performance.now(); console.log("(TIME) document ready:\t", now); URLProcessor.setConfigParametersFromUrl(); diff --git a/conference.js b/conference.js index 447859c5b..75333fcc3 100644 --- a/conference.js +++ b/conference.js @@ -21,16 +21,6 @@ const TrackErrors = JitsiMeetJS.errors.track; let room, connection, localAudio, localVideo, roomLocker; -/** - * Known custom conference commands. - */ -const Commands = { - CONNECTION_QUALITY: "stats", - EMAIL: "email", - ETHERPAD: "etherpad", - SHARED_VIDEO: "shared-video" -}; - import {VIDEO_CONTAINER_TYPE} from "./modules/UI/videolayout/LargeVideo"; /** @@ -52,10 +42,11 @@ function connect(roomName) { /** * Share email with other users. + * @param emailCommand the email command * @param {string} email new email */ -function sendEmail (email) { - room.sendCommand(Commands.EMAIL, { +function sendEmail (emailCommand, email) { + room.sendCommand(emailCommand, { value: email, attributes: { id: room.myUserId() @@ -82,8 +73,11 @@ function getDisplayName (id) { /** * Mute or unmute local audio stream if it exists. * @param {boolean} muted if audio stream should be muted or unmuted. + * @param {boolean} indicates if this local audio mute was a result of user + * interaction + * */ -function muteLocalAudio (muted) { +function muteLocalAudio (muted, userInteraction) { if (!localAudio) { return; } @@ -507,6 +501,61 @@ export default { getLogs () { return room.getLogs(); }, + + /** + * Exposes a Command(s) API on this instance. It is necessitated by (1) the + * desire to keep room private to this instance and (2) the need of other + * modules to send and receive commands to and from participants. + * Eventually, this instance remains in control with respect to the + * decision whether the Command(s) API of room (i.e. lib-jitsi-meet's + * JitsiConference) is to be used in the implementation of the Command(s) + * API of this instance. + */ + commands: { + /** + * Known custom conference commands. + */ + defaults: { + CONNECTION_QUALITY: "stats", + EMAIL: "email", + ETHERPAD: "etherpad", + SHARED_VIDEO: "shared-video", + CUSTOM_ROLE: "custom-role" + }, + /** + * Receives notifications from other participants about commands aka + * custom events (sent by sendCommand or sendCommandOnce methods). + * @param command {String} the name of the command + * @param handler {Function} handler for the command + */ + addCommandListener () { + room.addCommandListener.apply(room, arguments); + }, + /** + * Removes command. + * @param name {String} the name of the command. + */ + removeCommand () { + room.removeCommand.apply(room, arguments); + }, + /** + * Sends command. + * @param name {String} the name of the command. + * @param values {Object} with keys and values that will be sent. + */ + sendCommand () { + room.sendCommand.apply(room, arguments); + }, + /** + * Sends command one time. + * @param name {String} the name of the command. + * @param values {Object} with keys and values that will be sent. + */ + sendCommandOnce () { + room.sendCommandOnce.apply(room, arguments); + } + }, + _createRoom (localTracks) { room = connection.initJitsiConference(APP.conference.roomName, this._getConferenceOptions()); @@ -522,7 +571,7 @@ export default { this._room = room; // FIXME do not use this let email = APP.settings.getEmail(); - email && sendEmail(email); + email && sendEmail(this.commands.defaults.EMAIL, email); let nick = APP.settings.getDisplayName(); if (config.useNicks && !nick) { @@ -534,50 +583,6 @@ export default { this._setupListeners(); }, - /** - * Exposes a Command(s) API on this instance. It is necessitated by (1) the - * desire to keep room private to this instance and (2) the need of other - * modules to send and receive commands to and from participants. - * Eventually, this instance remains in control with respect to the - * decision whether the Command(s) API of room (i.e. lib-jitsi-meet's - * JitsiConference) is to be used in the implementation of the Command(s) - * API of this instance. - */ - commands: { - /** - * Receives notifications from other participants about commands aka - * custom events (sent by sendCommand or sendCommandOnce methods). - * @param command {String} the name of the command - * @param handler {Function} handler for the command - */ - addCommandListener () { - room.addCommandListener.apply(room, arguments); - }, - /** - * Removes command. - * @param name {String} the name of the command. - */ - removeCommand () { - room.removeCommand.apply(room, arguments); - }, - /** - * Sends command. - * @param name {String} the name of the command. - * @param values {Object} with keys and values that will be sent. - */ - sendCommand () { - room.sendCommand.apply(room, arguments); - }, - /** - * Sends command one time. - * @param name {String} the name of the command. - * @param values {Object} with keys and values that will be sent. - */ - sendCommandOnce () { - room.sendCommandOnce.apply(room, arguments); - }, - }, - _getConferenceOptions() { let options = config; if(config.enableRecording && !config.recordingType) { @@ -916,7 +921,8 @@ export default { APP.UI.updateLocalStats(percent, stats); // send local stats to other users - room.sendCommandOnce(Commands.CONNECTION_QUALITY, { + room.sendCommandOnce(this.commands.defaults.CONNECTION_QUALITY, + { children: ConnectionQuality.convertToMUCStats(stats), attributes: { xmlns: 'http://jitsi.org/jitmeet/stats' @@ -926,8 +932,9 @@ export default { ); // listen to remote stats - room.addCommandListener(Commands.CONNECTION_QUALITY,(values, from) => { - ConnectionQuality.updateRemoteStats(from, values); + room.addCommandListener(this.commands.defaults.CONNECTION_QUALITY, + (values, from) => { + ConnectionQuality.updateRemoteStats(from, values); }); ConnectionQuality.addListener(CQEvents.REMOTESTATS_UPDATED, @@ -935,7 +942,7 @@ export default { APP.UI.updateRemoteStats(id, percent, stats); }); - room.addCommandListener(Commands.ETHERPAD, ({value}) => { + room.addCommandListener(this.commands.defaults.ETHERPAD, ({value}) => { APP.UI.initEtherpad(value); }); @@ -948,9 +955,9 @@ export default { APP.settings.setEmail(email); APP.UI.setUserAvatar(room.myUserId(), email); - sendEmail(email); + sendEmail(this.commands.defaults.EMAIL, email); }); - room.addCommandListener(Commands.EMAIL, (data) => { + room.addCommandListener(this.commands.defaults.EMAIL, (data) => { APP.UI.setUserAvatar(data.attributes.id, data.value); }); @@ -1095,8 +1102,8 @@ export default { // send start and stop commands once, and remove any updates // that had left if (state === 'stop' || state === 'start' || state === 'playing') { - room.removeCommand(Commands.SHARED_VIDEO); - room.sendCommandOnce(Commands.SHARED_VIDEO, { + room.removeCommand(this.commands.defaults.SHARED_VIDEO); + room.sendCommandOnce(this.commands.defaults.SHARED_VIDEO, { value: url, attributes: { state: state, @@ -1108,8 +1115,8 @@ export default { else { // in case of paused, in order to allow late users to join // paused - room.removeCommand(Commands.SHARED_VIDEO); - room.sendCommand(Commands.SHARED_VIDEO, { + room.removeCommand(this.commands.defaults.SHARED_VIDEO); + room.sendCommand(this.commands.defaults.SHARED_VIDEO, { value: url, attributes: { state: state, @@ -1120,7 +1127,7 @@ export default { } }); room.addCommandListener( - Commands.SHARED_VIDEO, ({value, attributes}, id) => { + this.commands.defaults.SHARED_VIDEO, ({value, attributes}, id) => { if (attributes.state === 'stop') { APP.UI.stopSharedVideo(id, attributes); diff --git a/doc/example-config-files/jitsi.example.com.example b/doc/example-config-files/jitsi.example.com.example index 96ae864f9..eddd796ce 100755 --- a/doc/example-config-files/jitsi.example.com.example +++ b/doc/example-config-files/jitsi.example.com.example @@ -23,7 +23,7 @@ server { # xmpp websockets location /xmpp-websocket { - proxy_pass http://localhost:5280; + proxy_pass http://localhost:5280/xmpp-websocket; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; diff --git a/index.html b/index.html index a88777286..4af58e714 100644 --- a/index.html +++ b/index.html @@ -146,6 +146,9 @@
+ @@ -228,7 +231,7 @@ -