Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
Resolves some module dependancies by replaces them with events.
hristoterezovaf50bd5b94b7
diff --git a/app.js b/app.jsindex f37d9d7346..dd1f02846b 100644--- a/app.js+++ b/app.js@@ -15,6 +15,7 @@ $(document).ready(function () {UI.start();statistics.start();+ connectionquality.init();// Set default desktop sharing methoddesktopsharing.init();diff --git a/index.html b/index.htmlindex abd4be9c96..c68a57b0f5 100644--- a/index.html+++ b/index.html@@ -23,16 +23,17 @@<script src="service/RTC/StreamEventTypes.js?v=2"></script><script src="service/RTC/MediaStreamTypes.js?v=1"></script><script src="service/xmpp/XMPPEvents.js?v=1"></script>+ <script src="service/connectionquality/CQEvents.js?v=1"></script><script src="service/UI/UIEvents.js?v=1"></script><script src="service/desktopsharing/DesktopSharingEventTypes.js?v=1"></script><script src="libs/modules/simulcast.bundle.js?v=5"></script>- <script src="libs/modules/connectionquality.bundle.js?v=2"></script>- <script src="libs/modules/UI.bundle.js?v=11"></script>- <script src="libs/modules/statistics.bundle.js?v=4"></script>- <script src="libs/modules/RTC.bundle.js?v=6"></script>+ <script src="libs/modules/connectionquality.bundle.js?v=3"></script>+ <script src="libs/modules/UI.bundle.js?v=12"></script>+ <script src="libs/modules/statistics.bundle.js?v=5"></script>+ <script src="libs/modules/RTC.bundle.js?v=7"></script><script src="libs/modules/desktopsharing.bundle.js?v=3"></script><!-- desktop sharing -->- <script src="libs/modules/xmpp.bundle.js?v=6"></script>- <script src="libs/modules/keyboardshortcut.bundle.js?v=1"></script>+ <script src="libs/modules/xmpp.bundle.js?v=7"></script>+ <script src="libs/modules/keyboardshortcut.bundle.js?v=2"></script><script src="app.js?v=30"></script><!-- application logic --><script src="libs/modules/API.bundle.js?v=2"></script>diff --git a/libs/modules/API.bundle.js b/libs/modules/API.bundle.jsindex b53c899bec..7b064196d3 100644--- a/libs/modules/API.bundle.js+++ b/libs/modules/API.bundle.js@@ -47,6 +47,8 @@ var events =participantLeft: false};+var displayName = {};+/*** Processes commands from external applicaiton.* @param message the object with the command@@ -145,6 +147,16 @@ function setupListeners() {xmpp.addListener(XMPPEvents.MUC_LEFT, function (jid) {API.triggerEvent("participantLeft", {jid: jid});});+ xmpp.addListener(XMPPEvents.DISPLAY_NAME_CHANGED, function (jid, newDisplayName) {+ name = displayName[jid];+ if(!name || name != newDisplayName) {+ API.triggerEvent("displayNameChange", {jid: jid, displayname: newDisplayName});+ displayName[jid] = newDisplayName;+ }+ });+ xmpp.addListener(XMPPEvents.SENDING_CHAT_MESSAGE, function (body) {+ API.triggerEvent("outgoingMessage", {"message": body});+ });}var API = {diff --git a/libs/modules/RTC.bundle.js b/libs/modules/RTC.bundle.jsindex cd79e1937b..8d1510fb75 100644--- a/libs/modules/RTC.bundle.js+++ b/libs/modules/RTC.bundle.js@@ -508,13 +508,13 @@ var RTC = {videoStream.videoType = changedStreams[i].type;}}- })+ });+ xmpp.addListener(XMPPEvents.CALL_INCOMING, function(event) {+ DataChannels.bindDataChannelListener(event.peerconnection);+ });this.rtcUtils = new RTCUtils(this);this.rtcUtils.obtainAudioAndVideoPermissions();},- onConferenceCreated: function(event) {- DataChannels.bindDataChannelListener(event.peerconnection);- },muteRemoteVideoStream: function (jid, value) {var stream;diff --git a/libs/modules/UI.bundle.js b/libs/modules/UI.bundle.jsindex 0bbcf251e2..3b24eea56f 100644--- a/libs/modules/UI.bundle.js+++ b/libs/modules/UI.bundle.js@@ -150,6 +150,12 @@ function registerListeners() {xmpp.addListener(XMPPEvents.PASSWORD_REQUIRED, onPasswordReqiured);xmpp.addListener(XMPPEvents.CHAT_ERROR_RECEIVED, chatAddError);xmpp.addListener(XMPPEvents.ETHERPAD, initEtherpad);+ connectionquality.addListener(CQEvents.LOCALSTATS_UPDATED,+ VideoLayout.updateLocalConnectionStats);+ connectionquality.addListener(CQEvents.REMOTESTATS_UPDATED,+ VideoLayout.updateConnectionStats);+ connectionquality.addListener(CQEvents.STOP,+ VideoLayout.onStatsStop);}function bindEvents()@@ -208,13 +214,6 @@ UI.start = function () {$("#welcome_page").hide();- $('body').popover({ selector: '[data-toggle=popover]',- trigger: 'click hover',- content: function() {- return this.getAttribute("content") +- keyboardshortcut.getShortcut(this.getAttribute("shortcut"));- }- });VideoLayout.resizeLargeVideoContainer();$("#videospace").mousemove(function () {return ToolbarToggler.showToolbar();@@ -484,19 +483,6 @@ UI.inputDisplayNameHandler = function (value) {VideoLayout.inputDisplayNameHandler(value);};-UI.updateLocalConnectionStats = function(percent, stats)-{- VideoLayout.updateLocalConnectionStats(percent, stats);-};--UI.updateConnectionStats = function(jid, percent, stats)-{- VideoLayout.updateConnectionStats(jid, percent, stats);-};--UI.onStatsStop = function () {- VideoLayout.onStatsStop();-};UI.getLargeVideoState = function(){@@ -6539,25 +6525,18 @@ var VideoLayout = (function (my) {*/my.onDisplayNameChanged =function (jid, displayName, status) {- var name = null;if (jid === 'localVideoContainer'|| jid === xmpp.myJid()) {- name = NicknameHandler.getNickname();setDisplayName('localVideoContainer',displayName);} else {VideoLayout.ensurePeerContainerExists(jid);- name = $('#participant_' + Strophe.getResourceFromJid(jid) + "_name").text();setDisplayName('participant_' + Strophe.getResourceFromJid(jid),displayName,status);}- if(jid === 'localVideoContainer')- jid = xmpp.myJid();- if(!name || name != displayName)- API.triggerEvent("displayNameChange",{jid: jid, displayname: displayName});};/**diff --git a/libs/modules/connectionquality.bundle.js b/libs/modules/connectionquality.bundle.jsindex cee4a3279b..bc975af6d6 100644--- a/libs/modules/connectionquality.bundle.js+++ b/libs/modules/connectionquality.bundle.js@@ -1,4 +1,7 @@!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n;"undefined"!=typeof window?n=window:"undefined"!=typeof global?n=global:"undefined"!=typeof self&&(n=self),n.connectionquality=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){+var EventEmitter = require("events");+var eventEmitter = new EventEmitter();+/*** local stats* @type {{}}@@ -69,13 +72,20 @@ function parseMUCStats(stats) {var ConnectionQuality = {+ init: function () {+ xmpp.addListener(XMPPEvents.REMOTE_STATS, this.updateRemoteStats);+ statistics.addConnectionStatsListener(this.updateLocalStats);+ statistics.addRemoteStatsStopListener(this.stopSendingStats);++ },+/*** Updates the local statistics* @param data new statistics*/updateLocalStats: function (data) {stats = data;- UI.updateLocalConnectionStats(100 - stats.packetLoss.total, stats);+ eventEmitter.emit(CQEvents.LOCALSTATS_UPDATED, 100 - stats.packetLoss.total, stats);if (sendIntervalId == null) {startSendingStats();}@@ -88,13 +98,13 @@ var ConnectionQuality = {*/updateRemoteStats: function (jid, data) {if (data == null || data.packetLoss_total == null) {- UI.updateConnectionStats(jid, null, null);+ eventEmitter.emit(CQEvents.REMOTESTATS_UPDATED, jid, null, null);return;}remoteStats[jid] = parseMUCStats(data);- UI.updateConnectionStats(jid, 100 - data.packetLoss_total, remoteStats[jid]);-+ eventEmitter.emit(CQEvents.REMOTESTATS_UPDATED,+ jid, 100 - data.packetLoss_total, remoteStats[jid]);},/**@@ -104,7 +114,7 @@ var ConnectionQuality = {clearInterval(sendIntervalId);sendIntervalId = null;//notify UI about stopping statistics gathering- UI.onStatsStop();+ eventEmitter.emit(CQEvents.STOP);},/**@@ -112,10 +122,317 @@ var ConnectionQuality = {*/getStats: function () {return stats;+ },++ addListener: function (type, listener) {+ eventEmitter.on(type, listener);}};module.exports = ConnectionQuality;+},{"events":2}],2:[function(require,module,exports){+// Copyright Joyent, Inc. and other Node contributors.+//+// Permission is hereby granted, free of charge, to any person obtaining a+// copy of this software and associated documentation files (the+// "Software"), to deal in the Software without restriction, including+// without limitation the rights to use, copy, modify, merge, publish,+// distribute, sublicense, and/or sell copies of the Software, and to permit+// persons to whom the Software is furnished to do so, subject to the+// following conditions:+//+// The above copyright notice and this permission notice shall be included+// in all copies or substantial portions of the Software.+//+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE+// USE OR OTHER DEALINGS IN THE SOFTWARE.++function EventEmitter() {+ this._events = this._events || {};+ this._maxListeners = this._maxListeners || undefined;+}+module.exports = EventEmitter;++// Backwards-compat with node 0.10.x+EventEmitter.EventEmitter = EventEmitter;++EventEmitter.prototype._events = undefined;+EventEmitter.prototype._maxListeners = undefined;++// By default EventEmitters will print a warning if more than 10 listeners are+// added to it. This is a useful default which helps finding memory leaks.+EventEmitter.defaultMaxListeners = 10;++// Obviously not all Emitters should be limited to 10. This function allows+// that to be increased. Set to zero for unlimited.+EventEmitter.prototype.setMaxListeners = function(n) {+ if (!isNumber(n) || n < 0 || isNaN(n))+ throw TypeError('n must be a positive number');+ this._maxListeners = n;+ return this;+};++EventEmitter.prototype.emit = function(type) {+ var er, handler, len, args, i, listeners;++ if (!this._events)+ this._events = {};++ // If there is no 'error' event listener then throw.+ if (type === 'error') {+ if (!this._events.error ||+ (isObject(this._events.error) && !this._events.error.length)) {+ er = arguments[1];+ if (er instanceof Error) {+ throw er; // Unhandled 'error' event+ }+ throw TypeError('Uncaught, unspecified "error" event.');+ }+ }++ handler = this._events[type];++ if (isUndefined(handler))+ return false;++ if (isFunction(handler)) {+ switch (arguments.length) {+ // fast cases+ case 1:+ handler.call(this);+ break;+ case 2:+ handler.call(this, arguments[1]);+ break;+ case 3:+ handler.call(this, arguments[1], arguments[2]);+ break;+ // slower+ default:+ len = arguments.length;+ args = new Array(len - 1);+ for (i = 1; i < len; i++)+ args[i - 1] = arguments[i];+ handler.apply(this, args);+ }+ } else if (isObject(handler)) {+ len = arguments.length;+ args = new Array(len - 1);+ for (i = 1; i < len; i++)+ args[i - 1] = arguments[i];++ listeners = handler.slice();+ len = listeners.length;+ for (i = 0; i < len; i++)+ listeners[i].apply(this, args);+ }++ return true;+};++EventEmitter.prototype.addListener = function(type, listener) {+ var m;++ if (!isFunction(listener))+ throw TypeError('listener must be a function');++ if (!this._events)+ this._events = {};++ // To avoid recursion in the case that type === "newListener"! Before+ // adding it to the listeners, first emit "newListener".+ if (this._events.newListener)+ this.emit('newListener', type,+ isFunction(listener.listener) ?+ listener.listener : listener);++ if (!this._events[type])+ // Optimize the case of one listener. Don't need the extra array object.+ this._events[type] = listener;+ else if (isObject(this._events[type]))+ // If we've already got an array, just append.+ this._events[type].push(listener);+ else+ // Adding the second element, need to change to array.+ this._events[type] = [this._events[type], listener];++ // Check for listener leak+ if (isObject(this._events[type]) && !this._events[type].warned) {+ var m;+ if (!isUndefined(this._maxListeners)) {+ m = this._maxListeners;+ } else {+ m = EventEmitter.defaultMaxListeners;+ }++ if (m && m > 0 && this._events[type].length > m) {+ this._events[type].warned = true;+ console.error('(node) warning: possible EventEmitter memory ' ++ 'leak detected. %d listeners added. ' ++ 'Use emitter.setMaxListeners() to increase limit.',+ this._events[type].length);+ if (typeof console.trace === 'function') {+ // not supported in IE 10+ console.trace();+ }+ }+ }++ return this;+};++EventEmitter.prototype.on = EventEmitter.prototype.addListener;++EventEmitter.prototype.once = function(type, listener) {+ if (!isFunction(listener))+ throw TypeError('listener must be a function');++ var fired = false;++ function g() {+ this.removeListener(type, g);++ if (!fired) {+ fired = true;+ listener.apply(this, arguments);+ }+ }++ g.listener = listener;+ this.on(type, g);++ return this;+};++// emits a 'removeListener' event iff the listener was removed+EventEmitter.prototype.removeListener = function(type, listener) {+ var list, position, length, i;++ if (!isFunction(listener))+ throw TypeError('listener must be a function');++ if (!this._events || !this._events[type])+ return this;++ list = this._events[type];+ length = list.length;+ position = -1;++ if (list === listener ||+ (isFunction(list.listener) && list.listener === listener)) {+ delete this._events[type];+ if (this._events.removeListener)+ this.emit('removeListener', type, listener);++ } else if (isObject(list)) {+ for (i = length; i-- > 0;) {+ if (list[i] === listener ||+ (list[i].listener && list[i].listener === listener)) {+ position = i;+ break;+ }+ }++ if (position < 0)+ return this;++ if (list.length === 1) {+ list.length = 0;+ delete this._events[type];+ } else {+ list.splice(position, 1);+ }++ if (this._events.removeListener)+ this.emit('removeListener', type, listener);+ }++ return this;+};++EventEmitter.prototype.removeAllListeners = function(type) {+ var key, listeners;++ if (!this._events)+ return this;++ // not listening for removeListener, no need to emit+ if (!this._events.removeListener) {+ if (arguments.length === 0)+ this._events = {};+ else if (this._events[type])+ delete this._events[type];+ return this;+ }++ // emit removeListener for all listeners on all events+ if (arguments.length === 0) {+ for (key in this._events) {+ if (key === 'removeListener') continue;+ this.removeAllListeners(key);+ }+ this.removeAllListeners('removeListener');+ this._events = {};+ return this;+ }++ listeners = this._events[type];++ if (isFunction(listeners)) {+ this.removeListener(type, listeners);+ } else {+ // LIFO order+ while (listeners.length)+ this.removeListener(type, listeners[listeners.length - 1]);+ }+ delete this._events[type];++ return this;+};++EventEmitter.prototype.listeners = function(type) {+ var ret;+ if (!this._events || !this._events[type])+ ret = [];+ else if (isFunction(this._events[type]))+ ret = [this._events[type]];+ else+ ret = this._events[type].slice();+ return ret;+};++EventEmitter.listenerCount = function(emitter, type) {+ var ret;+ if (!emitter._events || !emitter._events[type])+ ret = 0;+ else if (isFunction(emitter._events[type]))+ ret = 1;+ else+ ret = emitter._events[type].length;+ return ret;+};++function isFunction(arg) {+ return typeof arg === 'function';+}++function isNumber(arg) {+ return typeof arg === 'number';+}++function isObject(arg) {+ return typeof arg === 'object' && arg !== null;+}++function isUndefined(arg) {+ return arg === void 0;+}+},{}]},{},[1])(1)});\ No newline at end of filediff --git a/libs/modules/keyboardshortcut.bundle.js b/libs/modules/keyboardshortcut.bundle.jsindex db236128f7..8c69e73612 100644--- a/libs/modules/keyboardshortcut.bundle.js+++ b/libs/modules/keyboardshortcut.bundle.js@@ -63,6 +63,14 @@ var KeyboardShortcut = {}}};+ var self = this;+ $('body').popover({ selector: '[data-toggle=popover]',+ trigger: 'click hover',+ content: function() {+ return this.getAttribute("content") ++ self.getShortcut(this.getAttribute("shortcut"));+ }+ });},/***diff --git a/libs/modules/statistics.bundle.js b/libs/modules/statistics.bundle.jsindex c14dab5104..86b3bc4fbb 100644--- a/libs/modules/statistics.bundle.js+++ b/libs/modules/statistics.bundle.js@@ -943,16 +943,13 @@ var statistics =stopRemote();},- onConferenceCreated: function (event) {- startRemoteStats(event.peerconnection);- },-start: function () {- this.addConnectionStatsListener(connectionquality.updateLocalStats);- this.addRemoteStatsStopListener(connectionquality.stopSendingStats);RTC.addStreamListener(onStreamCreated,StreamEventTypes.EVENT_TYPE_LOCAL_CREATED);xmpp.addListener(XMPPEvents.DISPOSE_CONFERENCE, onDisposeConference);+ xmpp.addListener(XMPPEvents.CALL_INCOMING, function (event) {+ startRemoteStats(event.peerconnection);+ });}};diff --git a/libs/modules/xmpp.bundle.js b/libs/modules/xmpp.bundle.jsindex d59a421964..c401f6ac25 100644--- a/libs/modules/xmpp.bundle.js+++ b/libs/modules/xmpp.bundle.js@@ -3375,7 +3375,7 @@ module.exports = function(XMPP, eventEmitter) {Strophe.forEachChild(stats[0], "stat", function (el) {statsObj[el.getAttribute("name")] = el.getAttribute("value");});- connectionquality.updateRemoteStats(from, statsObj);+ eventEmitter.emit(XMPPEvents.REMOTE_STATS, from, statsObj);}// Parse status.@@ -3524,7 +3524,7 @@ module.exports = function(XMPP, eventEmitter) {msg.c('nick', {xmlns: 'http://jabber.org/protocol/nick'}).t(nickname).up().up();}this.connection.send(msg);- API.triggerEvent("outgoingMessage", {"message": body});+ eventEmitter.emit(XMPPEvents.SENDING_CHAT_MESSAGE, body);},setSubject: function (subject) {var msg = $msg({to: this.roomjid, type: 'groupchat'});@@ -3824,8 +3824,6 @@ module.exports = function(XMPP, eventEmitter) {if (displayName && displayName.length > 0){-// $(document).trigger('displaynamechanged',-// [jid, displayName]);eventEmitter.emit(XMPPEvents.DISPLAY_NAME_CHANGED, from, displayName);}@@ -3847,7 +3845,7 @@ module.exports = function(XMPP, eventEmitter) {var JingleSession = require("./JingleSession");-module.exports = function(XMPP)+module.exports = function(XMPP, eventEmitter){function CallIncomingJingle(sid, connection) {var sess = connection.jingle.sessions[sid];@@ -3855,8 +3853,7 @@ module.exports = function(XMPP)// TODO: do we check activecall == null?connection.jingle.activecall = sess;- statistics.onConferenceCreated(sess);- RTC.onConferenceCreated(sess);+ eventEmitter.emit(XMPPEvents.CALL_INCOMING, sess);// TODO: check affiliation and/or roleconsole.log('emuc data for', sess.peerjid, connection.emuc.members[sess.peerjid]);@@ -4497,7 +4494,7 @@ function doJoin() {function initStrophePlugins(){require("./strophe.emuc")(XMPP, eventEmitter);- require("./strophe.jingle")();+ require("./strophe.jingle")(XMPP, eventEmitter);require("./strophe.moderate")(XMPP);require("./strophe.util")();require("./strophe.rayo")();@@ -4509,7 +4506,7 @@ function registerListeners() {StreamEventTypes.EVENT_TYPE_LOCAL_CREATED);UI.addListener(UIEvents.NICKNAME_CHANGED, function (nickname) {XMPP.addToPresence("displayName", nickname);- })+ });}function setupEvents() {diff --git a/modules/API/API.js b/modules/API/API.jsindex e7d8642056..d669312af0 100644--- a/modules/API/API.js+++ b/modules/API/API.js@@ -46,6 +46,8 @@ var events =participantLeft: false};+var displayName = {};+/*** Processes commands from external applicaiton.* @param message the object with the command@@ -144,6 +146,16 @@ function setupListeners() {xmpp.addListener(XMPPEvents.MUC_LEFT, function (jid) {API.triggerEvent("participantLeft", {jid: jid});});+ xmpp.addListener(XMPPEvents.DISPLAY_NAME_CHANGED, function (jid, newDisplayName) {+ name = displayName[jid];+ if(!name || name != newDisplayName) {+ API.triggerEvent("displayNameChange", {jid: jid, displayname: newDisplayName});+ displayName[jid] = newDisplayName;+ }+ });+ xmpp.addListener(XMPPEvents.SENDING_CHAT_MESSAGE, function (body) {+ API.triggerEvent("outgoingMessage", {"message": body});+ });}var API = {diff --git a/modules/RTC/RTC.js b/modules/RTC/RTC.jsindex afc5f6f2de..9d0d5c7e07 100644--- a/modules/RTC/RTC.js+++ b/modules/RTC/RTC.js@@ -119,13 +119,13 @@ var RTC = {videoStream.videoType = changedStreams[i].type;}}- })+ });+ xmpp.addListener(XMPPEvents.CALL_INCOMING, function(event) {+ DataChannels.bindDataChannelListener(event.peerconnection);+ });this.rtcUtils = new RTCUtils(this);this.rtcUtils.obtainAudioAndVideoPermissions();},- onConferenceCreated: function(event) {- DataChannels.bindDataChannelListener(event.peerconnection);- },muteRemoteVideoStream: function (jid, value) {var stream;diff --git a/modules/UI/UI.js b/modules/UI/UI.jsindex 53177e39da..461211ceef 100644--- a/modules/UI/UI.js+++ b/modules/UI/UI.js@@ -149,6 +149,12 @@ function registerListeners() {xmpp.addListener(XMPPEvents.PASSWORD_REQUIRED, onPasswordReqiured);xmpp.addListener(XMPPEvents.CHAT_ERROR_RECEIVED, chatAddError);xmpp.addListener(XMPPEvents.ETHERPAD, initEtherpad);+ connectionquality.addListener(CQEvents.LOCALSTATS_UPDATED,+ VideoLayout.updateLocalConnectionStats);+ connectionquality.addListener(CQEvents.REMOTESTATS_UPDATED,+ VideoLayout.updateConnectionStats);+ connectionquality.addListener(CQEvents.STOP,+ VideoLayout.onStatsStop);}function bindEvents()@@ -207,13 +213,6 @@ UI.start = function () {$("#welcome_page").hide();- $('body').popover({ selector: '[data-toggle=popover]',- trigger: 'click hover',- content: function() {- return this.getAttribute("content") +- keyboardshortcut.getShortcut(this.getAttribute("shortcut"));- }- });VideoLayout.resizeLargeVideoContainer();$("#videospace").mousemove(function () {return ToolbarToggler.showToolbar();@@ -483,19 +482,6 @@ UI.inputDisplayNameHandler = function (value) {VideoLayout.inputDisplayNameHandler(value);};-UI.updateLocalConnectionStats = function(percent, stats)-{- VideoLayout.updateLocalConnectionStats(percent, stats);-};--UI.updateConnectionStats = function(jid, percent, stats)-{- VideoLayout.updateConnectionStats(jid, percent, stats);-};--UI.onStatsStop = function () {- VideoLayout.onStatsStop();-};UI.getLargeVideoState = function(){diff --git a/modules/UI/videolayout/VideoLayout.js b/modules/UI/videolayout/VideoLayout.jsindex a24c485d9e..a506ef5f73 100644--- a/modules/UI/videolayout/VideoLayout.js+++ b/modules/UI/videolayout/VideoLayout.js@@ -1756,25 +1756,18 @@ var VideoLayout = (function (my) {*/my.onDisplayNameChanged =function (jid, displayName, status) {- var name = null;if (jid === 'localVideoContainer'|| jid === xmpp.myJid()) {- name = NicknameHandler.getNickname();setDisplayName('localVideoContainer',displayName);} else {VideoLayout.ensurePeerContainerExists(jid);- name = $('#participant_' + Strophe.getResourceFromJid(jid) + "_name").text();setDisplayName('participant_' + Strophe.getResourceFromJid(jid),displayName,status);}- if(jid === 'localVideoContainer')- jid = xmpp.myJid();- if(!name || name != displayName)- API.triggerEvent("displayNameChange",{jid: jid, displayname: displayName});};/**diff --git a/modules/connectionquality/connectionquality.js b/modules/connectionquality/connectionquality.jsindex 7652caec6c..e382d7c244 100644--- a/modules/connectionquality/connectionquality.js+++ b/modules/connectionquality/connectionquality.js@@ -1,3 +1,6 @@+var EventEmitter = require("events");+var eventEmitter = new EventEmitter();+/*** local stats* @type {{}}@@ -68,13 +71,20 @@ function parseMUCStats(stats) {var ConnectionQuality = {+ init: function () {+ xmpp.addListener(XMPPEvents.REMOTE_STATS, this.updateRemoteStats);+ statistics.addConnectionStatsListener(this.updateLocalStats);+ statistics.addRemoteStatsStopListener(this.stopSendingStats);++ },+/*** Updates the local statistics* @param data new statistics*/updateLocalStats: function (data) {stats = data;- UI.updateLocalConnectionStats(100 - stats.packetLoss.total, stats);+ eventEmitter.emit(CQEvents.LOCALSTATS_UPDATED, 100 - stats.packetLoss.total, stats);if (sendIntervalId == null) {startSendingStats();}@@ -87,13 +97,13 @@ var ConnectionQuality = {*/updateRemoteStats: function (jid, data) {if (data == null || data.packetLoss_total == null) {- UI.updateConnectionStats(jid, null, null);+ eventEmitter.emit(CQEvents.REMOTESTATS_UPDATED, jid, null, null);return;}remoteStats[jid] = parseMUCStats(data);- UI.updateConnectionStats(jid, 100 - data.packetLoss_total, remoteStats[jid]);-+ eventEmitter.emit(CQEvents.REMOTESTATS_UPDATED,+ jid, 100 - data.packetLoss_total, remoteStats[jid]);},/**@@ -103,7 +113,7 @@ var ConnectionQuality = {clearInterval(sendIntervalId);sendIntervalId = null;//notify UI about stopping statistics gathering- UI.onStatsStop();+ eventEmitter.emit(CQEvents.STOP);},/**@@ -111,6 +121,10 @@ var ConnectionQuality = {*/getStats: function () {return stats;+ },++ addListener: function (type, listener) {+ eventEmitter.on(type, listener);}};diff --git a/modules/keyboardshortcut/keyboardshortcut.js b/modules/keyboardshortcut/keyboardshortcut.jsindex 2cfe6699ae..3217b99a7e 100644--- a/modules/keyboardshortcut/keyboardshortcut.js+++ b/modules/keyboardshortcut/keyboardshortcut.js@@ -62,6 +62,14 @@ var KeyboardShortcut = {}}};+ var self = this;+ $('body').popover({ selector: '[data-toggle=popover]',+ trigger: 'click hover',+ content: function() {+ return this.getAttribute("content") ++ self.getShortcut(this.getAttribute("shortcut"));+ }+ });},/***diff --git a/modules/statistics/statistics.js b/modules/statistics/statistics.jsindex f0449cb7ab..1665afb7d0 100644--- a/modules/statistics/statistics.js+++ b/modules/statistics/statistics.js@@ -121,16 +121,13 @@ var statistics =stopRemote();},- onConferenceCreated: function (event) {- startRemoteStats(event.peerconnection);- },-start: function () {- this.addConnectionStatsListener(connectionquality.updateLocalStats);- this.addRemoteStatsStopListener(connectionquality.stopSendingStats);RTC.addStreamListener(onStreamCreated,StreamEventTypes.EVENT_TYPE_LOCAL_CREATED);xmpp.addListener(XMPPEvents.DISPOSE_CONFERENCE, onDisposeConference);+ xmpp.addListener(XMPPEvents.CALL_INCOMING, function (event) {+ startRemoteStats(event.peerconnection);+ });}};diff --git a/modules/xmpp/strophe.emuc.js b/modules/xmpp/strophe.emuc.jsindex 1d6815b758..d6d48afa35 100644--- a/modules/xmpp/strophe.emuc.js+++ b/modules/xmpp/strophe.emuc.js@@ -149,7 +149,7 @@ module.exports = function(XMPP, eventEmitter) {Strophe.forEachChild(stats[0], "stat", function (el) {statsObj[el.getAttribute("name")] = el.getAttribute("value");});- connectionquality.updateRemoteStats(from, statsObj);+ eventEmitter.emit(XMPPEvents.REMOTE_STATS, from, statsObj);}// Parse status.@@ -298,7 +298,7 @@ module.exports = function(XMPP, eventEmitter) {msg.c('nick', {xmlns: 'http://jabber.org/protocol/nick'}).t(nickname).up().up();}this.connection.send(msg);- API.triggerEvent("outgoingMessage", {"message": body});+ eventEmitter.emit(XMPPEvents.SENDING_CHAT_MESSAGE, body);},setSubject: function (subject) {var msg = $msg({to: this.roomjid, type: 'groupchat'});@@ -598,8 +598,6 @@ module.exports = function(XMPP, eventEmitter) {if (displayName && displayName.length > 0){-// $(document).trigger('displaynamechanged',-// [jid, displayName]);eventEmitter.emit(XMPPEvents.DISPLAY_NAME_CHANGED, from, displayName);}diff --git a/modules/xmpp/strophe.jingle.js b/modules/xmpp/strophe.jingle.jsindex fd6b6cdb21..44be1fc613 100644--- a/modules/xmpp/strophe.jingle.js+++ b/modules/xmpp/strophe.jingle.js@@ -2,7 +2,7 @@var JingleSession = require("./JingleSession");-module.exports = function(XMPP)+module.exports = function(XMPP, eventEmitter){function CallIncomingJingle(sid, connection) {var sess = connection.jingle.sessions[sid];@@ -10,8 +10,7 @@ module.exports = function(XMPP)// TODO: do we check activecall == null?connection.jingle.activecall = sess;- statistics.onConferenceCreated(sess);- RTC.onConferenceCreated(sess);+ eventEmitter.emit(XMPPEvents.CALL_INCOMING, sess);// TODO: check affiliation and/or roleconsole.log('emuc data for', sess.peerjid, connection.emuc.members[sess.peerjid]);diff --git a/modules/xmpp/xmpp.js b/modules/xmpp/xmpp.jsindex 5a7f2a5ea4..153a4dd72b 100644--- a/modules/xmpp/xmpp.js+++ b/modules/xmpp/xmpp.js@@ -93,7 +93,7 @@ function doJoin() {function initStrophePlugins(){require("./strophe.emuc")(XMPP, eventEmitter);- require("./strophe.jingle")();+ require("./strophe.jingle")(XMPP, eventEmitter);require("./strophe.moderate")(XMPP);require("./strophe.util")();require("./strophe.rayo")();@@ -105,7 +105,7 @@ function registerListeners() {StreamEventTypes.EVENT_TYPE_LOCAL_CREATED);UI.addListener(UIEvents.NICKNAME_CHANGED, function (nickname) {XMPP.addToPresence("displayName", nickname);- })+ });}function setupEvents() {diff --git a/service/connectionquality/CQEvents.js b/service/connectionquality/CQEvents.jsnew file mode 100644index 0000000000..4a093e5ce5--- /dev/null+++ b/service/connectionquality/CQEvents.js@@ -0,0 +1,5 @@+var CQEvents = {+ LOCALSTATS_UPDATED: "cq.localstats_updated",+ REMOTESTATS_UPDATED: "cq.remotestats_updated",+ STOP: "cq.stop"+};\ No newline at end of filediff --git a/service/xmpp/XMPPEvents.js b/service/xmpp/XMPPEvents.jsindex cc096aeed2..2cb49c2940 100644--- a/service/xmpp/XMPPEvents.js+++ b/service/xmpp/XMPPEvents.js@@ -17,6 +17,7 @@ var XMPPEvents = {PRESENCE_STATUS: "xmpp.presence_status",SUBJECT_CHANGED: "xmpp.subject_changed",MESSAGE_RECEIVED: "xmpp.message_received",+ SENDING_CHAT_MESSAGE: "xmpp.sending_chat_message",PASSWORD_REQUIRED: "xmpp.password_required",CHAT_ERROR_RECEIVED: "xmpp.chat_error_received",ETHERPAD: "xmpp.etherpad"