Procházet zdrojové kódy

Removes the bundles for every module and add bundle for the whole application.

master
hristoterezov před 10 roky
rodič
revize
9eb2873cfa
57 změnil soubory, kde provedl 11851 přidání a 13194 odebrání
  1. 5
    8
      Makefile
  2. 33
    13
      app.js
  3. 1
    18
      index.html
  4. 11432
    84
      libs/app.bundle.js
  5. 0
    234
      libs/modules/API.bundle.js
  6. 0
    1223
      libs/modules/RTC.bundle.js
  7. 0
    7569
      libs/modules/UI.bundle.js
  8. 0
    438
      libs/modules/connectionquality.bundle.js
  9. 0
    628
      libs/modules/desktopsharing.bundle.js
  10. 0
    95
      libs/modules/keyboardshortcut.bundle.js
  11. 0
    1260
      libs/modules/simulcast.bundle.js
  12. 0
    1265
      libs/modules/statistics.bundle.js
  13. 13
    13
      modules/API/API.js
  14. 5
    2
      modules/RTC/DataChannels.js
  15. 1
    1
      modules/RTC/LocalStream.js
  16. 2
    3
      modules/RTC/MediaStream.js
  17. 16
    13
      modules/RTC/RTC.js
  18. 3
    4
      modules/RTC/RTCUtils.js
  19. 96
    97
      modules/UI/UI.js
  20. 4
    4
      modules/UI/audio_levels/AudioLevels.js
  21. 1
    1
      modules/UI/authentication/Authentication.js
  22. 8
    7
      modules/UI/avatar/Avatar.js
  23. 2
    2
      modules/UI/etherpad/Etherpad.js
  24. 2
    2
      modules/UI/prezi/Prezi.js
  25. 4
    3
      modules/UI/side_pannels/chat/Chat.js
  26. 1
    1
      modules/UI/side_pannels/chat/Commands.js
  27. 1
    1
      modules/UI/side_pannels/contactlist/ContactList.js
  28. 2
    2
      modules/UI/side_pannels/settings/SettingsMenu.js
  29. 9
    9
      modules/UI/toolbars/Toolbar.js
  30. 2
    2
      modules/UI/toolbars/ToolbarToggler.js
  31. 2
    0
      modules/UI/util/NicknameHandler.js
  32. 2
    2
      modules/UI/videolayout/ConnectionIndicator.js
  33. 82
    84
      modules/UI/videolayout/VideoLayout.js
  34. 6
    4
      modules/connectionquality/connectionquality.js
  35. 7
    5
      modules/desktopsharing/desktopsharing.js
  36. 10
    10
      modules/keyboardshortcut/keyboardshortcut.js
  37. 6
    5
      modules/simulcast/SimulcastReceiver.js
  38. 2
    2
      modules/simulcast/SimulcastSender.js
  39. 4
    3
      modules/simulcast/simulcast.js
  40. 10
    7
      modules/statistics/RTPStatsCollector.js
  41. 5
    7
      modules/statistics/statistics.js
  42. 13
    12
      modules/xmpp/JingleSession.js
  43. 2
    2
      modules/xmpp/SDP.js
  44. 7
    7
      modules/xmpp/TraceablePeerConnection.js
  45. 4
    1
      modules/xmpp/moderator.js
  46. 6
    6
      modules/xmpp/strophe.emuc.js
  47. 2
    0
      modules/xmpp/strophe.jingle.js
  48. 1
    1
      modules/xmpp/strophe.moderate.js
  49. 25
    23
      modules/xmpp/xmpp.js
  50. 1
    2
      service/RTC/MediaStreamTypes.js
  51. 1
    1
      service/RTC/RTCBrowserType.js
  52. 3
    1
      service/RTC/RTCEvents.js
  53. 1
    2
      service/RTC/StreamEventTypes.js
  54. 1
    1
      service/UI/UIEvents.js
  55. 3
    1
      service/connectionquality/CQEvents.js
  56. 1
    2
      service/desktopsharing/DesktopSharingEventTypes.js
  57. 1
    1
      service/xmpp/XMPPEvents.js

+ 5
- 8
Makefile Zobrazit soubor

@@ -1,23 +1,20 @@
1 1
 BROWSERIFY = browserify
2 2
 GLOBAL_FLAGS = -e
3
-MODULE_DIR = modules
4
-MODULE_SUBDIRS = $(wildcard $(MODULE_DIR)/*/)
5
-MODULES = $(MODULE_SUBDIRS:$(MODULE_DIR)/%/=%)
6 3
 OUTPUT_DIR = .
7
-DEPLOY_DIR = libs/modules
4
+DEPLOY_DIR = libs
8 5
 
9 6
 all: compile deploy clean
10 7
 
11 8
 compile:FLAGS = $(GLOBAL_FLAGS)
12
-compile:$(MODULES)
9
+compile: app
13 10
 
14 11
 debug: compile-debug deploy clean
15 12
 
16 13
 compile-debug:FLAGS = -d $(GLOBAL_FLAGS)
17
-compile-debug:$(MODULES)
14
+compile-debug: app
18 15
 
19
-$(MODULES): *.js
20
-	$(BROWSERIFY) $(FLAGS) $(MODULE_DIR)/$@/$@.js -s $@ -o $(OUTPUT_DIR)/$@.bundle.js
16
+app:
17
+	$(BROWSERIFY) $(FLAGS) app.js -s APP -o $(OUTPUT_DIR)/app.bundle.js
21 18
 
22 19
 clean:
23 20
 	@rm -f $(OUTPUT_DIR)/*.bundle.js

+ 33
- 13
app.js Zobrazit soubor

@@ -1,30 +1,50 @@
1 1
 /* jshint -W117 */
2 2
 /* application specific logic */
3 3
 
4
+var APP =
5
+{
6
+    init: function () {
7
+        this.UI = require("./modules/UI/UI");
8
+        this.API = require("./modules/API/API");
9
+        this.connectionquality = require("./modules/connectionquality/connectionquality");
10
+        this.statistics = require("./modules/statistics/statistics");
11
+        this.RTC = require("./modules/RTC/RTC");
12
+        this.simulcast = require("./modules/simulcast/simulcast");
13
+        this.desktopsharing = require("./modules/desktopsharing/desktopsharing");
14
+        this.xmpp = require("./modules/xmpp/xmpp");
15
+        this.keyboardshortcut = require("./modules/keyboardshortcut/keyboardshortcut");
16
+    }
17
+};
18
+
4 19
 function init() {
5 20
 
6
-    RTC.start();
7
-    xmpp.start(UI.getCreadentials);
21
+    APP.RTC.start();
22
+    APP.xmpp.start(APP.UI.getCreadentials);
23
+    APP.statistics.start();
24
+    APP.connectionquality.init();
25
+
26
+    // Set default desktop sharing method
27
+    APP.desktopsharing.init();
28
+
29
+    APP.keyboardshortcut.init();
8 30
 }
9 31
 
10 32
 
11 33
 $(document).ready(function () {
12 34
 
13
-    if(API.isEnabled())
14
-        API.init();
35
+    APP.init();
15 36
 
16
-    UI.start();
17
-    statistics.start();
18
-    connectionquality.init();
19
-    
20
-    // Set default desktop sharing method
21
-    desktopsharing.init();
37
+    if(APP.API.isEnabled())
38
+        APP.API.init();
39
+
40
+    APP.UI.start(init);
22 41
 
23
-    keyboardshortcut.init();
24 42
 });
25 43
 
26 44
 $(window).bind('beforeunload', function () {
27
-    if(API.isEnabled())
28
-        API.dispose();
45
+    if(APP.API.isEnabled())
46
+        APP.API.dispose();
29 47
 });
30 48
 
49
+module.exports = APP;
50
+

+ 1
- 18
index.html Zobrazit soubor

@@ -19,24 +19,7 @@
19 19
     <script src="libs/popover.js?v=1"></script><!-- bootstrap tooltip lib -->
20 20
     <script src="libs/toastr.js?v=1"></script><!-- notifications lib -->
21 21
     <script src="interface_config.js?v=5"></script>
22
-    <script src="service/RTC/RTCBrowserType.js?v=1"></script>
23
-    <script src="service/RTC/StreamEventTypes.js?v=2"></script>
24
-    <script src="service/RTC/MediaStreamTypes.js?v=1"></script>
25
-    <script src="service/RTC/RTCEvents.js?v=1"></script>
26
-    <script src="service/xmpp/XMPPEvents.js?v=1"></script>
27
-    <script src="service/connectionquality/CQEvents.js?v=1"></script>
28
-    <script src="service/UI/UIEvents.js?v=1"></script>
29
-    <script src="service/desktopsharing/DesktopSharingEventTypes.js?v=1"></script>
30
-    <script src="libs/modules/connectionquality.bundle.js?v=3"></script>
31
-    <script src="libs/modules/UI.bundle.js?v=14"></script>
32
-    <script src="libs/modules/statistics.bundle.js?v=5"></script>
33
-    <script src="libs/modules/RTC.bundle.js?v=9"></script>
34
-    <script src="libs/modules/simulcast.bundle.js?v=6"></script>
35
-    <script src="libs/modules/desktopsharing.bundle.js?v=3"></script><!-- desktop sharing -->
36
-    <script src="libs/modules/xmpp.bundle.js?v=8"></script>
37
-    <script src="libs/modules/keyboardshortcut.bundle.js?v=2"></script>
38
-    <script src="app.js?v=30"></script><!-- application logic -->
39
-    <script src="libs/modules/API.bundle.js?v=2"></script>
22
+    <script src="libs/app.bundle.js?v=1"></script>
40 23
 
41 24
     <script src="analytics.js?v=1"></script><!-- google analytics plugin -->
42 25
     <link rel="stylesheet" href="css/font.css?v=6"/>

libs/app.bundle.js
Diff nebyl zobrazen, protože je příliš veliký
Zobrazit soubor


+ 0
- 234
libs/modules/API.bundle.js Zobrazit soubor

@@ -1,234 +0,0 @@
1
-!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.API=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){
2
-/**
3
- * Implements API class that communicates with external api class
4
- * and provides interface to access Jitsi Meet features by external
5
- * applications that embed Jitsi Meet
6
- */
7
-
8
-
9
-
10
-/**
11
- * List of the available commands.
12
- * @type {{
13
- *              displayName: inputDisplayNameHandler,
14
- *              muteAudio: toggleAudio,
15
- *              muteVideo: toggleVideo,
16
- *              filmStrip: toggleFilmStrip
17
- *          }}
18
- */
19
-var commands =
20
-{
21
-    displayName: UI.inputDisplayNameHandler,
22
-    muteAudio: UI.toggleAudio,
23
-    muteVideo: UI.toggleVideo,
24
-    toggleFilmStrip: UI.toggleFilmStrip,
25
-    toggleChat: UI.toggleChat,
26
-    toggleContactList: UI.toggleContactList
27
-};
28
-
29
-
30
-/**
31
- * Maps the supported events and their status
32
- * (true it the event is enabled and false if it is disabled)
33
- * @type {{
34
- *              incomingMessage: boolean,
35
- *              outgoingMessage: boolean,
36
- *              displayNameChange: boolean,
37
- *              participantJoined: boolean,
38
- *              participantLeft: boolean
39
- *      }}
40
- */
41
-var events =
42
-{
43
-    incomingMessage: false,
44
-    outgoingMessage:false,
45
-    displayNameChange: false,
46
-    participantJoined: false,
47
-    participantLeft: false
48
-};
49
-
50
-var displayName = {};
51
-
52
-/**
53
- * Processes commands from external applicaiton.
54
- * @param message the object with the command
55
- */
56
-function processCommand(message)
57
-{
58
-    if(message.action != "execute")
59
-    {
60
-        console.error("Unknown action of the message");
61
-        return;
62
-    }
63
-    for(var key in message)
64
-    {
65
-        if(commands[key])
66
-            commands[key].apply(null, message[key]);
67
-    }
68
-}
69
-
70
-/**
71
- * Processes events objects from external applications
72
- * @param event the event
73
- */
74
-function processEvent(event) {
75
-    if(!event.action)
76
-    {
77
-        console.error("Event with no action is received.");
78
-        return;
79
-    }
80
-
81
-    var i = 0;
82
-    switch(event.action)
83
-    {
84
-        case "add":
85
-            for(; i < event.events.length; i++)
86
-            {
87
-                events[event.events[i]] = true;
88
-            }
89
-            break;
90
-        case "remove":
91
-            for(; i < event.events.length; i++)
92
-            {
93
-                events[event.events[i]] = false;
94
-            }
95
-            break;
96
-        default:
97
-            console.error("Unknown action for event.");
98
-    }
99
-
100
-}
101
-
102
-/**
103
- * Sends message to the external application.
104
- * @param object
105
- */
106
-function sendMessage(object) {
107
-    window.parent.postMessage(JSON.stringify(object), "*");
108
-}
109
-
110
-/**
111
- * Processes a message event from the external application
112
- * @param event the message event
113
- */
114
-function processMessage(event)
115
-{
116
-    var message;
117
-    try {
118
-        message = JSON.parse(event.data);
119
-    } catch (e) {}
120
-
121
-    if(!message.type)
122
-        return;
123
-    switch (message.type)
124
-    {
125
-        case "command":
126
-            processCommand(message);
127
-            break;
128
-        case "event":
129
-            processEvent(message);
130
-            break;
131
-        default:
132
-            console.error("Unknown type of the message");
133
-            return;
134
-    }
135
-
136
-}
137
-
138
-function setupListeners() {
139
-    xmpp.addListener(XMPPEvents.MUC_ENTER, function (from) {
140
-        API.triggerEvent("participantJoined", {jid: from});
141
-    });
142
-    xmpp.addListener(XMPPEvents.MESSAGE_RECEIVED, function (from, nick, txt, myjid) {
143
-        if (from != myjid)
144
-            API.triggerEvent("incomingMessage",
145
-                {"from": from, "nick": nick, "message": txt});
146
-    });
147
-    xmpp.addListener(XMPPEvents.MUC_LEFT, function (jid) {
148
-        API.triggerEvent("participantLeft", {jid: jid});
149
-    });
150
-    xmpp.addListener(XMPPEvents.DISPLAY_NAME_CHANGED, function (jid, newDisplayName) {
151
-        name = displayName[jid];
152
-        if(!name || name != newDisplayName) {
153
-            API.triggerEvent("displayNameChange", {jid: jid, displayname: newDisplayName});
154
-            displayName[jid] = newDisplayName;
155
-        }
156
-    });
157
-    xmpp.addListener(XMPPEvents.SENDING_CHAT_MESSAGE, function (body) {
158
-        API.triggerEvent("outgoingMessage", {"message": body});
159
-    });
160
-}
161
-
162
-var API = {
163
-    /**
164
-     * Check whether the API should be enabled or not.
165
-     * @returns {boolean}
166
-     */
167
-    isEnabled: function () {
168
-        var hash = location.hash;
169
-        if(hash && hash.indexOf("external") > -1 && window.postMessage)
170
-            return true;
171
-        return false;
172
-    },
173
-    /**
174
-     * Initializes the APIConnector. Setups message event listeners that will
175
-     * receive information from external applications that embed Jitsi Meet.
176
-     * It also sends a message to the external application that APIConnector
177
-     * is initialized.
178
-     */
179
-    init: function () {
180
-        if (window.addEventListener)
181
-        {
182
-            window.addEventListener('message',
183
-                processMessage, false);
184
-        }
185
-        else
186
-        {
187
-            window.attachEvent('onmessage', processMessage);
188
-        }
189
-        sendMessage({type: "system", loaded: true});
190
-        setupListeners();
191
-    },
192
-    /**
193
-     * Checks whether the event is enabled ot not.
194
-     * @param name the name of the event.
195
-     * @returns {*}
196
-     */
197
-    isEventEnabled: function (name) {
198
-        return events[name];
199
-    },
200
-
201
-    /**
202
-     * Sends event object to the external application that has been subscribed
203
-     * for that event.
204
-     * @param name the name event
205
-     * @param object data associated with the event
206
-     */
207
-    triggerEvent: function (name, object) {
208
-        if(this.isEnabled() && this.isEventEnabled(name))
209
-            sendMessage({
210
-                type: "event", action: "result", event: name, result: object});
211
-    },
212
-
213
-    /**
214
-     * Removes the listeners.
215
-     */
216
-    dispose: function () {
217
-        if(window.removeEventListener)
218
-        {
219
-            window.removeEventListener("message",
220
-                processMessage, false);
221
-        }
222
-        else
223
-        {
224
-            window.detachEvent('onmessage', processMessage);
225
-        }
226
-
227
-    }
228
-
229
-
230
-};
231
-
232
-module.exports = API;
233
-},{}]},{},[1])(1)
234
-});

+ 0
- 1223
libs/modules/RTC.bundle.js
Diff nebyl zobrazen, protože je příliš veliký
Zobrazit soubor


+ 0
- 7569
libs/modules/UI.bundle.js
Diff nebyl zobrazen, protože je příliš veliký
Zobrazit soubor


+ 0
- 438
libs/modules/connectionquality.bundle.js Zobrazit soubor

@@ -1,438 +0,0 @@
1
-!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){
2
-var EventEmitter = require("events");
3
-var eventEmitter = new EventEmitter();
4
-
5
-/**
6
- * local stats
7
- * @type {{}}
8
- */
9
-var stats = {};
10
-
11
-/**
12
- * remote stats
13
- * @type {{}}
14
- */
15
-var remoteStats = {};
16
-
17
-/**
18
- * Interval for sending statistics to other participants
19
- * @type {null}
20
- */
21
-var sendIntervalId = null;
22
-
23
-
24
-/**
25
- * Start statistics sending.
26
- */
27
-function startSendingStats() {
28
-    sendStats();
29
-    sendIntervalId = setInterval(sendStats, 10000);
30
-}
31
-
32
-/**
33
- * Sends statistics to other participants
34
- */
35
-function sendStats() {
36
-    xmpp.addToPresence("connectionQuality", convertToMUCStats(stats));
37
-}
38
-
39
-/**
40
- * Converts statistics to format for sending through XMPP
41
- * @param stats the statistics
42
- * @returns {{bitrate_donwload: *, bitrate_uplpoad: *, packetLoss_total: *, packetLoss_download: *, packetLoss_upload: *}}
43
- */
44
-function convertToMUCStats(stats) {
45
-    return {
46
-        "bitrate_download": stats.bitrate.download,
47
-        "bitrate_upload": stats.bitrate.upload,
48
-        "packetLoss_total": stats.packetLoss.total,
49
-        "packetLoss_download": stats.packetLoss.download,
50
-        "packetLoss_upload": stats.packetLoss.upload
51
-    };
52
-}
53
-
54
-/**
55
- * Converts statitistics to format used by VideoLayout
56
- * @param stats
57
- * @returns {{bitrate: {download: *, upload: *}, packetLoss: {total: *, download: *, upload: *}}}
58
- */
59
-function parseMUCStats(stats) {
60
-    return {
61
-        bitrate: {
62
-            download: stats.bitrate_download,
63
-            upload: stats.bitrate_upload
64
-        },
65
-        packetLoss: {
66
-            total: stats.packetLoss_total,
67
-            download: stats.packetLoss_download,
68
-            upload: stats.packetLoss_upload
69
-        }
70
-    };
71
-}
72
-
73
-
74
-var ConnectionQuality = {
75
-    init: function () {
76
-        xmpp.addListener(XMPPEvents.REMOTE_STATS, this.updateRemoteStats);
77
-        statistics.addConnectionStatsListener(this.updateLocalStats);
78
-        statistics.addRemoteStatsStopListener(this.stopSendingStats);
79
-
80
-    },
81
-
82
-    /**
83
-     * Updates the local statistics
84
-     * @param data new statistics
85
-     */
86
-    updateLocalStats: function (data) {
87
-        stats = data;
88
-        eventEmitter.emit(CQEvents.LOCALSTATS_UPDATED, 100 - stats.packetLoss.total, stats);
89
-        if (sendIntervalId == null) {
90
-            startSendingStats();
91
-        }
92
-    },
93
-
94
-    /**
95
-     * Updates remote statistics
96
-     * @param jid the jid associated with the statistics
97
-     * @param data the statistics
98
-     */
99
-    updateRemoteStats: function (jid, data) {
100
-        if (data == null || data.packetLoss_total == null) {
101
-            eventEmitter.emit(CQEvents.REMOTESTATS_UPDATED, jid, null, null);
102
-            return;
103
-        }
104
-        remoteStats[jid] = parseMUCStats(data);
105
-
106
-        eventEmitter.emit(CQEvents.REMOTESTATS_UPDATED,
107
-            jid, 100 - data.packetLoss_total, remoteStats[jid]);
108
-    },
109
-
110
-    /**
111
-     * Stops statistics sending.
112
-     */
113
-    stopSendingStats: function () {
114
-        clearInterval(sendIntervalId);
115
-        sendIntervalId = null;
116
-        //notify UI about stopping statistics gathering
117
-        eventEmitter.emit(CQEvents.STOP);
118
-    },
119
-
120
-    /**
121
-     * Returns the local statistics.
122
-     */
123
-    getStats: function () {
124
-        return stats;
125
-    },
126
-    
127
-    addListener: function (type, listener) {
128
-        eventEmitter.on(type, listener);
129
-    }
130
-
131
-};
132
-
133
-module.exports = ConnectionQuality;
134
-},{"events":2}],2:[function(require,module,exports){
135
-// Copyright Joyent, Inc. and other Node contributors.
136
-//
137
-// Permission is hereby granted, free of charge, to any person obtaining a
138
-// copy of this software and associated documentation files (the
139
-// "Software"), to deal in the Software without restriction, including
140
-// without limitation the rights to use, copy, modify, merge, publish,
141
-// distribute, sublicense, and/or sell copies of the Software, and to permit
142
-// persons to whom the Software is furnished to do so, subject to the
143
-// following conditions:
144
-//
145
-// The above copyright notice and this permission notice shall be included
146
-// in all copies or substantial portions of the Software.
147
-//
148
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
149
-// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
150
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
151
-// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
152
-// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
153
-// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
154
-// USE OR OTHER DEALINGS IN THE SOFTWARE.
155
-
156
-function EventEmitter() {
157
-  this._events = this._events || {};
158
-  this._maxListeners = this._maxListeners || undefined;
159
-}
160
-module.exports = EventEmitter;
161
-
162
-// Backwards-compat with node 0.10.x
163
-EventEmitter.EventEmitter = EventEmitter;
164
-
165
-EventEmitter.prototype._events = undefined;
166
-EventEmitter.prototype._maxListeners = undefined;
167
-
168
-// By default EventEmitters will print a warning if more than 10 listeners are
169
-// added to it. This is a useful default which helps finding memory leaks.
170
-EventEmitter.defaultMaxListeners = 10;
171
-
172
-// Obviously not all Emitters should be limited to 10. This function allows
173
-// that to be increased. Set to zero for unlimited.
174
-EventEmitter.prototype.setMaxListeners = function(n) {
175
-  if (!isNumber(n) || n < 0 || isNaN(n))
176
-    throw TypeError('n must be a positive number');
177
-  this._maxListeners = n;
178
-  return this;
179
-};
180
-
181
-EventEmitter.prototype.emit = function(type) {
182
-  var er, handler, len, args, i, listeners;
183
-
184
-  if (!this._events)
185
-    this._events = {};
186
-
187
-  // If there is no 'error' event listener then throw.
188
-  if (type === 'error') {
189
-    if (!this._events.error ||
190
-        (isObject(this._events.error) && !this._events.error.length)) {
191
-      er = arguments[1];
192
-      if (er instanceof Error) {
193
-        throw er; // Unhandled 'error' event
194
-      }
195
-      throw TypeError('Uncaught, unspecified "error" event.');
196
-    }
197
-  }
198
-
199
-  handler = this._events[type];
200
-
201
-  if (isUndefined(handler))
202
-    return false;
203
-
204
-  if (isFunction(handler)) {
205
-    switch (arguments.length) {
206
-      // fast cases
207
-      case 1:
208
-        handler.call(this);
209
-        break;
210
-      case 2:
211
-        handler.call(this, arguments[1]);
212
-        break;
213
-      case 3:
214
-        handler.call(this, arguments[1], arguments[2]);
215
-        break;
216
-      // slower
217
-      default:
218
-        len = arguments.length;
219
-        args = new Array(len - 1);
220
-        for (i = 1; i < len; i++)
221
-          args[i - 1] = arguments[i];
222
-        handler.apply(this, args);
223
-    }
224
-  } else if (isObject(handler)) {
225
-    len = arguments.length;
226
-    args = new Array(len - 1);
227
-    for (i = 1; i < len; i++)
228
-      args[i - 1] = arguments[i];
229
-
230
-    listeners = handler.slice();
231
-    len = listeners.length;
232
-    for (i = 0; i < len; i++)
233
-      listeners[i].apply(this, args);
234
-  }
235
-
236
-  return true;
237
-};
238
-
239
-EventEmitter.prototype.addListener = function(type, listener) {
240
-  var m;
241
-
242
-  if (!isFunction(listener))
243
-    throw TypeError('listener must be a function');
244
-
245
-  if (!this._events)
246
-    this._events = {};
247
-
248
-  // To avoid recursion in the case that type === "newListener"! Before
249
-  // adding it to the listeners, first emit "newListener".
250
-  if (this._events.newListener)
251
-    this.emit('newListener', type,
252
-              isFunction(listener.listener) ?
253
-              listener.listener : listener);
254
-
255
-  if (!this._events[type])
256
-    // Optimize the case of one listener. Don't need the extra array object.
257
-    this._events[type] = listener;
258
-  else if (isObject(this._events[type]))
259
-    // If we've already got an array, just append.
260
-    this._events[type].push(listener);
261
-  else
262
-    // Adding the second element, need to change to array.
263
-    this._events[type] = [this._events[type], listener];
264
-
265
-  // Check for listener leak
266
-  if (isObject(this._events[type]) && !this._events[type].warned) {
267
-    var m;
268
-    if (!isUndefined(this._maxListeners)) {
269
-      m = this._maxListeners;
270
-    } else {
271
-      m = EventEmitter.defaultMaxListeners;
272
-    }
273
-
274
-    if (m && m > 0 && this._events[type].length > m) {
275
-      this._events[type].warned = true;
276
-      console.error('(node) warning: possible EventEmitter memory ' +
277
-                    'leak detected. %d listeners added. ' +
278
-                    'Use emitter.setMaxListeners() to increase limit.',
279
-                    this._events[type].length);
280
-      if (typeof console.trace === 'function') {
281
-        // not supported in IE 10
282
-        console.trace();
283
-      }
284
-    }
285
-  }
286
-
287
-  return this;
288
-};
289
-
290
-EventEmitter.prototype.on = EventEmitter.prototype.addListener;
291
-
292
-EventEmitter.prototype.once = function(type, listener) {
293
-  if (!isFunction(listener))
294
-    throw TypeError('listener must be a function');
295
-
296
-  var fired = false;
297
-
298
-  function g() {
299
-    this.removeListener(type, g);
300
-
301
-    if (!fired) {
302
-      fired = true;
303
-      listener.apply(this, arguments);
304
-    }
305
-  }
306
-
307
-  g.listener = listener;
308
-  this.on(type, g);
309
-
310
-  return this;
311
-};
312
-
313
-// emits a 'removeListener' event iff the listener was removed
314
-EventEmitter.prototype.removeListener = function(type, listener) {
315
-  var list, position, length, i;
316
-
317
-  if (!isFunction(listener))
318
-    throw TypeError('listener must be a function');
319
-
320
-  if (!this._events || !this._events[type])
321
-    return this;
322
-
323
-  list = this._events[type];
324
-  length = list.length;
325
-  position = -1;
326
-
327
-  if (list === listener ||
328
-      (isFunction(list.listener) && list.listener === listener)) {
329
-    delete this._events[type];
330
-    if (this._events.removeListener)
331
-      this.emit('removeListener', type, listener);
332
-
333
-  } else if (isObject(list)) {
334
-    for (i = length; i-- > 0;) {
335
-      if (list[i] === listener ||
336
-          (list[i].listener && list[i].listener === listener)) {
337
-        position = i;
338
-        break;
339
-      }
340
-    }
341
-
342
-    if (position < 0)
343
-      return this;
344
-
345
-    if (list.length === 1) {
346
-      list.length = 0;
347
-      delete this._events[type];
348
-    } else {
349
-      list.splice(position, 1);
350
-    }
351
-
352
-    if (this._events.removeListener)
353
-      this.emit('removeListener', type, listener);
354
-  }
355
-
356
-  return this;
357
-};
358
-
359
-EventEmitter.prototype.removeAllListeners = function(type) {
360
-  var key, listeners;
361
-
362
-  if (!this._events)
363
-    return this;
364
-
365
-  // not listening for removeListener, no need to emit
366
-  if (!this._events.removeListener) {
367
-    if (arguments.length === 0)
368
-      this._events = {};
369
-    else if (this._events[type])
370
-      delete this._events[type];
371
-    return this;
372
-  }
373
-
374
-  // emit removeListener for all listeners on all events
375
-  if (arguments.length === 0) {
376
-    for (key in this._events) {
377
-      if (key === 'removeListener') continue;
378
-      this.removeAllListeners(key);
379
-    }
380
-    this.removeAllListeners('removeListener');
381
-    this._events = {};
382
-    return this;
383
-  }
384
-
385
-  listeners = this._events[type];
386
-
387
-  if (isFunction(listeners)) {
388
-    this.removeListener(type, listeners);
389
-  } else {
390
-    // LIFO order
391
-    while (listeners.length)
392
-      this.removeListener(type, listeners[listeners.length - 1]);
393
-  }
394
-  delete this._events[type];
395
-
396
-  return this;
397
-};
398
-
399
-EventEmitter.prototype.listeners = function(type) {
400
-  var ret;
401
-  if (!this._events || !this._events[type])
402
-    ret = [];
403
-  else if (isFunction(this._events[type]))
404
-    ret = [this._events[type]];
405
-  else
406
-    ret = this._events[type].slice();
407
-  return ret;
408
-};
409
-
410
-EventEmitter.listenerCount = function(emitter, type) {
411
-  var ret;
412
-  if (!emitter._events || !emitter._events[type])
413
-    ret = 0;
414
-  else if (isFunction(emitter._events[type]))
415
-    ret = 1;
416
-  else
417
-    ret = emitter._events[type].length;
418
-  return ret;
419
-};
420
-
421
-function isFunction(arg) {
422
-  return typeof arg === 'function';
423
-}
424
-
425
-function isNumber(arg) {
426
-  return typeof arg === 'number';
427
-}
428
-
429
-function isObject(arg) {
430
-  return typeof arg === 'object' && arg !== null;
431
-}
432
-
433
-function isUndefined(arg) {
434
-  return arg === void 0;
435
-}
436
-
437
-},{}]},{},[1])(1)
438
-});

+ 0
- 628
libs/modules/desktopsharing.bundle.js Zobrazit soubor

@@ -1,628 +0,0 @@
1
-!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.desktopsharing=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){
2
-/* global $, alert, changeLocalVideo, chrome, config, getConferenceHandler, getUserMediaWithConstraints */
3
-/**
4
- * Indicates that desktop stream is currently in use(for toggle purpose).
5
- * @type {boolean}
6
- */
7
-var isUsingScreenStream = false;
8
-/**
9
- * Indicates that switch stream operation is in progress and prevent from triggering new events.
10
- * @type {boolean}
11
- */
12
-var switchInProgress = false;
13
-
14
-/**
15
- * Method used to get screen sharing stream.
16
- *
17
- * @type {function (stream_callback, failure_callback}
18
- */
19
-var obtainDesktopStream = null;
20
-
21
-/**
22
- * Flag used to cache desktop sharing enabled state. Do not use directly as it can be <tt>null</tt>.
23
- * @type {null|boolean}
24
- */
25
-var _desktopSharingEnabled = null;
26
-
27
-var EventEmitter = require("events");
28
-
29
-var eventEmitter = new EventEmitter();
30
-
31
-/**
32
- * Method obtains desktop stream from WebRTC 'screen' source.
33
- * Flag 'chrome://flags/#enable-usermedia-screen-capture' must be enabled.
34
- */
35
-function obtainWebRTCScreen(streamCallback, failCallback) {
36
-    RTC.getUserMediaWithConstraints(
37
-        ['screen'],
38
-        streamCallback,
39
-        failCallback
40
-    );
41
-}
42
-
43
-/**
44
- * Constructs inline install URL for Chrome desktop streaming extension.
45
- * The 'chromeExtensionId' must be defined in config.js.
46
- * @returns {string}
47
- */
48
-function getWebStoreInstallUrl()
49
-{
50
-    return "https://chrome.google.com/webstore/detail/" + config.chromeExtensionId;
51
-}
52
-
53
-/**
54
- * Checks whether extension update is required.
55
- * @param minVersion minimal required version
56
- * @param extVersion current extension version
57
- * @returns {boolean}
58
- */
59
-function isUpdateRequired(minVersion, extVersion)
60
-{
61
-    try
62
-    {
63
-        var s1 = minVersion.split('.');
64
-        var s2 = extVersion.split('.');
65
-
66
-        var len = Math.max(s1.length, s2.length);
67
-        for (var i = 0; i < len; i++)
68
-        {
69
-            var n1 = 0,
70
-                n2 = 0;
71
-
72
-            if (i < s1.length)
73
-                n1 = parseInt(s1[i]);
74
-            if (i < s2.length)
75
-                n2 = parseInt(s2[i]);
76
-
77
-            if (isNaN(n1) || isNaN(n2))
78
-            {
79
-                return true;
80
-            }
81
-            else if (n1 !== n2)
82
-            {
83
-                return n1 > n2;
84
-            }
85
-        }
86
-
87
-        // will happen if boths version has identical numbers in
88
-        // their components (even if one of them is longer, has more components)
89
-        return false;
90
-    }
91
-    catch (e)
92
-    {
93
-        console.error("Failed to parse extension version", e);
94
-        UI.messageHandler.showError('Error',
95
-            'Error when trying to detect desktopsharing extension.');
96
-        return true;
97
-    }
98
-}
99
-
100
-
101
-function checkExtInstalled(isInstalledCallback) {
102
-    if (!chrome.runtime) {
103
-        // No API, so no extension for sure
104
-        isInstalledCallback(false);
105
-        return;
106
-    }
107
-    chrome.runtime.sendMessage(
108
-        config.chromeExtensionId,
109
-        { getVersion: true },
110
-        function (response) {
111
-            if (!response || !response.version) {
112
-                // Communication failure - assume that no endpoint exists
113
-                console.warn("Extension not installed?: " + chrome.runtime.lastError);
114
-                isInstalledCallback(false);
115
-            } else {
116
-                // Check installed extension version
117
-                var extVersion = response.version;
118
-                console.log('Extension version is: ' + extVersion);
119
-                var updateRequired = isUpdateRequired(config.minChromeExtVersion, extVersion);
120
-                if (updateRequired) {
121
-                    alert(
122
-                        'Jitsi Desktop Streamer requires update. ' +
123
-                        'Changes will take effect after next Chrome restart.');
124
-                }
125
-                isInstalledCallback(!updateRequired);
126
-            }
127
-        }
128
-    );
129
-}
130
-
131
-function doGetStreamFromExtension(streamCallback, failCallback) {
132
-    // Sends 'getStream' msg to the extension. Extension id must be defined in the config.
133
-    chrome.runtime.sendMessage(
134
-        config.chromeExtensionId,
135
-        { getStream: true, sources: config.desktopSharingSources },
136
-        function (response) {
137
-            if (!response) {
138
-                failCallback(chrome.runtime.lastError);
139
-                return;
140
-            }
141
-            console.log("Response from extension: " + response);
142
-            if (response.streamId) {
143
-                RTC.getUserMediaWithConstraints(
144
-                    ['desktop'],
145
-                    function (stream) {
146
-                        streamCallback(stream);
147
-                    },
148
-                    failCallback,
149
-                    null, null, null,
150
-                    response.streamId);
151
-            } else {
152
-                failCallback("Extension failed to get the stream");
153
-            }
154
-        }
155
-    );
156
-}
157
-/**
158
- * Asks Chrome extension to call chooseDesktopMedia and gets chrome 'desktop' stream for returned stream token.
159
- */
160
-function obtainScreenFromExtension(streamCallback, failCallback) {
161
-    checkExtInstalled(
162
-        function (isInstalled) {
163
-            if (isInstalled) {
164
-                doGetStreamFromExtension(streamCallback, failCallback);
165
-            } else {
166
-                chrome.webstore.install(
167
-                    getWebStoreInstallUrl(),
168
-                    function (arg) {
169
-                        console.log("Extension installed successfully", arg);
170
-                        // We need to reload the page in order to get the access to chrome.runtime
171
-                        window.location.reload(false);
172
-                    },
173
-                    function (arg) {
174
-                        console.log("Failed to install the extension", arg);
175
-                        failCallback(arg);
176
-                        UI.messageHandler.showError('Error',
177
-                            'Failed to install desktop sharing extension');
178
-                    }
179
-                );
180
-            }
181
-        }
182
-    );
183
-}
184
-
185
-/**
186
- * Call this method to toggle desktop sharing feature.
187
- * @param method pass "ext" to use chrome extension for desktop capture(chrome extension required),
188
- *        pass "webrtc" to use WebRTC "screen" desktop source('chrome://flags/#enable-usermedia-screen-capture'
189
- *        must be enabled), pass any other string or nothing in order to disable this feature completely.
190
- */
191
-function setDesktopSharing(method) {
192
-    // Check if we are running chrome
193
-    if (!navigator.webkitGetUserMedia) {
194
-        obtainDesktopStream = null;
195
-        console.info("Desktop sharing disabled");
196
-    } else if (method == "ext") {
197
-        obtainDesktopStream = obtainScreenFromExtension;
198
-        console.info("Using Chrome extension for desktop sharing");
199
-    } else if (method == "webrtc") {
200
-        obtainDesktopStream = obtainWebRTCScreen;
201
-        console.info("Using Chrome WebRTC for desktop sharing");
202
-    }
203
-
204
-    // Reset enabled cache
205
-    _desktopSharingEnabled = null;
206
-}
207
-
208
-/**
209
- * Initializes <link rel=chrome-webstore-item /> with extension id set in config.js to support inline installs.
210
- * Host site must be selected as main website of published extension.
211
- */
212
-function initInlineInstalls()
213
-{
214
-    $("link[rel=chrome-webstore-item]").attr("href", getWebStoreInstallUrl());
215
-}
216
-
217
-function getSwitchStreamFailed(error) {
218
-    console.error("Failed to obtain the stream to switch to", error);
219
-    switchInProgress = false;
220
-}
221
-
222
-function streamSwitchDone() {
223
-    switchInProgress = false;
224
-    eventEmitter.emit(
225
-        DesktopSharingEventTypes.SWITCHING_DONE,
226
-        isUsingScreenStream);
227
-}
228
-
229
-function newStreamCreated(stream)
230
-{
231
-    eventEmitter.emit(DesktopSharingEventTypes.NEW_STREAM_CREATED,
232
-        stream, isUsingScreenStream, streamSwitchDone);
233
-}
234
-
235
-
236
-module.exports = {
237
-    isUsingScreenStream: function () {
238
-        return isUsingScreenStream;
239
-    },
240
-
241
-    /**
242
-     * @returns {boolean} <tt>true</tt> if desktop sharing feature is available and enabled.
243
-     */
244
-    isDesktopSharingEnabled: function () {
245
-        if (_desktopSharingEnabled === null) {
246
-            if (obtainDesktopStream === obtainScreenFromExtension) {
247
-                // Parse chrome version
248
-                var userAgent = navigator.userAgent.toLowerCase();
249
-                // We can assume that user agent is chrome, because it's enforced when 'ext' streaming method is set
250
-                var ver = parseInt(userAgent.match(/chrome\/(\d+)\./)[1], 10);
251
-                console.log("Chrome version" + userAgent, ver);
252
-                _desktopSharingEnabled = ver >= 34;
253
-            } else {
254
-                _desktopSharingEnabled = obtainDesktopStream === obtainWebRTCScreen;
255
-            }
256
-        }
257
-        return _desktopSharingEnabled;
258
-    },
259
-    
260
-    init: function () {
261
-        setDesktopSharing(config.desktopSharing);
262
-
263
-        // Initialize Chrome extension inline installs
264
-        if (config.chromeExtensionId) {
265
-            initInlineInstalls();
266
-        }
267
-
268
-        eventEmitter.emit(DesktopSharingEventTypes.INIT);
269
-    },
270
-
271
-    addListener: function(listener, type)
272
-    {
273
-        eventEmitter.on(type, listener);
274
-    },
275
-
276
-    removeListener: function (listener,type) {
277
-        eventEmitter.removeListener(type, listener);
278
-    },
279
-
280
-    /*
281
-     * Toggles screen sharing.
282
-     */
283
-    toggleScreenSharing: function () {
284
-        if (switchInProgress || !obtainDesktopStream) {
285
-            console.warn("Switch in progress or no method defined");
286
-            return;
287
-        }
288
-        switchInProgress = true;
289
-
290
-        if (!isUsingScreenStream)
291
-        {
292
-            // Switch to desktop stream
293
-            obtainDesktopStream(
294
-                function (stream) {
295
-                    // We now use screen stream
296
-                    isUsingScreenStream = true;
297
-                    // Hook 'ended' event to restore camera when screen stream stops
298
-                    stream.addEventListener('ended',
299
-                        function (e) {
300
-                            if (!switchInProgress && isUsingScreenStream) {
301
-                                toggleScreenSharing();
302
-                            }
303
-                        }
304
-                    );
305
-                    newStreamCreated(stream);
306
-                },
307
-                getSwitchStreamFailed);
308
-        } else {
309
-            // Disable screen stream
310
-            RTC.getUserMediaWithConstraints(
311
-                ['video'],
312
-                function (stream) {
313
-                    // We are now using camera stream
314
-                    isUsingScreenStream = false;
315
-                    newStreamCreated(stream);
316
-                },
317
-                getSwitchStreamFailed, config.resolution || '360'
318
-            );
319
-        }
320
-    }
321
-};
322
-
323
-
324
-},{"events":2}],2:[function(require,module,exports){
325
-// Copyright Joyent, Inc. and other Node contributors.
326
-//
327
-// Permission is hereby granted, free of charge, to any person obtaining a
328
-// copy of this software and associated documentation files (the
329
-// "Software"), to deal in the Software without restriction, including
330
-// without limitation the rights to use, copy, modify, merge, publish,
331
-// distribute, sublicense, and/or sell copies of the Software, and to permit
332
-// persons to whom the Software is furnished to do so, subject to the
333
-// following conditions:
334
-//
335
-// The above copyright notice and this permission notice shall be included
336
-// in all copies or substantial portions of the Software.
337
-//
338
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
339
-// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
340
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
341
-// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
342
-// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
343
-// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
344
-// USE OR OTHER DEALINGS IN THE SOFTWARE.
345
-
346
-function EventEmitter() {
347
-  this._events = this._events || {};
348
-  this._maxListeners = this._maxListeners || undefined;
349
-}
350
-module.exports = EventEmitter;
351
-
352
-// Backwards-compat with node 0.10.x
353
-EventEmitter.EventEmitter = EventEmitter;
354
-
355
-EventEmitter.prototype._events = undefined;
356
-EventEmitter.prototype._maxListeners = undefined;
357
-
358
-// By default EventEmitters will print a warning if more than 10 listeners are
359
-// added to it. This is a useful default which helps finding memory leaks.
360
-EventEmitter.defaultMaxListeners = 10;
361
-
362
-// Obviously not all Emitters should be limited to 10. This function allows
363
-// that to be increased. Set to zero for unlimited.
364
-EventEmitter.prototype.setMaxListeners = function(n) {
365
-  if (!isNumber(n) || n < 0 || isNaN(n))
366
-    throw TypeError('n must be a positive number');
367
-  this._maxListeners = n;
368
-  return this;
369
-};
370
-
371
-EventEmitter.prototype.emit = function(type) {
372
-  var er, handler, len, args, i, listeners;
373
-
374
-  if (!this._events)
375
-    this._events = {};
376
-
377
-  // If there is no 'error' event listener then throw.
378
-  if (type === 'error') {
379
-    if (!this._events.error ||
380
-        (isObject(this._events.error) && !this._events.error.length)) {
381
-      er = arguments[1];
382
-      if (er instanceof Error) {
383
-        throw er; // Unhandled 'error' event
384
-      }
385
-      throw TypeError('Uncaught, unspecified "error" event.');
386
-    }
387
-  }
388
-
389
-  handler = this._events[type];
390
-
391
-  if (isUndefined(handler))
392
-    return false;
393
-
394
-  if (isFunction(handler)) {
395
-    switch (arguments.length) {
396
-      // fast cases
397
-      case 1:
398
-        handler.call(this);
399
-        break;
400
-      case 2:
401
-        handler.call(this, arguments[1]);
402
-        break;
403
-      case 3:
404
-        handler.call(this, arguments[1], arguments[2]);
405
-        break;
406
-      // slower
407
-      default:
408
-        len = arguments.length;
409
-        args = new Array(len - 1);
410
-        for (i = 1; i < len; i++)
411
-          args[i - 1] = arguments[i];
412
-        handler.apply(this, args);
413
-    }
414
-  } else if (isObject(handler)) {
415
-    len = arguments.length;
416
-    args = new Array(len - 1);
417
-    for (i = 1; i < len; i++)
418
-      args[i - 1] = arguments[i];
419
-
420
-    listeners = handler.slice();
421
-    len = listeners.length;
422
-    for (i = 0; i < len; i++)
423
-      listeners[i].apply(this, args);
424
-  }
425
-
426
-  return true;
427
-};
428
-
429
-EventEmitter.prototype.addListener = function(type, listener) {
430
-  var m;
431
-
432
-  if (!isFunction(listener))
433
-    throw TypeError('listener must be a function');
434
-
435
-  if (!this._events)
436
-    this._events = {};
437
-
438
-  // To avoid recursion in the case that type === "newListener"! Before
439
-  // adding it to the listeners, first emit "newListener".
440
-  if (this._events.newListener)
441
-    this.emit('newListener', type,
442
-              isFunction(listener.listener) ?
443
-              listener.listener : listener);
444
-
445
-  if (!this._events[type])
446
-    // Optimize the case of one listener. Don't need the extra array object.
447
-    this._events[type] = listener;
448
-  else if (isObject(this._events[type]))
449
-    // If we've already got an array, just append.
450
-    this._events[type].push(listener);
451
-  else
452
-    // Adding the second element, need to change to array.
453
-    this._events[type] = [this._events[type], listener];
454
-
455
-  // Check for listener leak
456
-  if (isObject(this._events[type]) && !this._events[type].warned) {
457
-    var m;
458
-    if (!isUndefined(this._maxListeners)) {
459
-      m = this._maxListeners;
460
-    } else {
461
-      m = EventEmitter.defaultMaxListeners;
462
-    }
463
-
464
-    if (m && m > 0 && this._events[type].length > m) {
465
-      this._events[type].warned = true;
466
-      console.error('(node) warning: possible EventEmitter memory ' +
467
-                    'leak detected. %d listeners added. ' +
468
-                    'Use emitter.setMaxListeners() to increase limit.',
469
-                    this._events[type].length);
470
-      if (typeof console.trace === 'function') {
471
-        // not supported in IE 10
472
-        console.trace();
473
-      }
474
-    }
475
-  }
476
-
477
-  return this;
478
-};
479
-
480
-EventEmitter.prototype.on = EventEmitter.prototype.addListener;
481
-
482
-EventEmitter.prototype.once = function(type, listener) {
483
-  if (!isFunction(listener))
484
-    throw TypeError('listener must be a function');
485
-
486
-  var fired = false;
487
-
488
-  function g() {
489
-    this.removeListener(type, g);
490
-
491
-    if (!fired) {
492
-      fired = true;
493
-      listener.apply(this, arguments);
494
-    }
495
-  }
496
-
497
-  g.listener = listener;
498
-  this.on(type, g);
499
-
500
-  return this;
501
-};
502
-
503
-// emits a 'removeListener' event iff the listener was removed
504
-EventEmitter.prototype.removeListener = function(type, listener) {
505
-  var list, position, length, i;
506
-
507
-  if (!isFunction(listener))
508
-    throw TypeError('listener must be a function');
509
-
510
-  if (!this._events || !this._events[type])
511
-    return this;
512
-
513
-  list = this._events[type];
514
-  length = list.length;
515
-  position = -1;
516
-
517
-  if (list === listener ||
518
-      (isFunction(list.listener) && list.listener === listener)) {
519
-    delete this._events[type];
520
-    if (this._events.removeListener)
521
-      this.emit('removeListener', type, listener);
522
-
523
-  } else if (isObject(list)) {
524
-    for (i = length; i-- > 0;) {
525
-      if (list[i] === listener ||
526
-          (list[i].listener && list[i].listener === listener)) {
527
-        position = i;
528
-        break;
529
-      }
530
-    }
531
-
532
-    if (position < 0)
533
-      return this;
534
-
535
-    if (list.length === 1) {
536
-      list.length = 0;
537
-      delete this._events[type];
538
-    } else {
539
-      list.splice(position, 1);
540
-    }
541
-
542
-    if (this._events.removeListener)
543
-      this.emit('removeListener', type, listener);
544
-  }
545
-
546
-  return this;
547
-};
548
-
549
-EventEmitter.prototype.removeAllListeners = function(type) {
550
-  var key, listeners;
551
-
552
-  if (!this._events)
553
-    return this;
554
-
555
-  // not listening for removeListener, no need to emit
556
-  if (!this._events.removeListener) {
557
-    if (arguments.length === 0)
558
-      this._events = {};
559
-    else if (this._events[type])
560
-      delete this._events[type];
561
-    return this;
562
-  }
563
-
564
-  // emit removeListener for all listeners on all events
565
-  if (arguments.length === 0) {
566
-    for (key in this._events) {
567
-      if (key === 'removeListener') continue;
568
-      this.removeAllListeners(key);
569
-    }
570
-    this.removeAllListeners('removeListener');
571
-    this._events = {};
572
-    return this;
573
-  }
574
-
575
-  listeners = this._events[type];
576
-
577
-  if (isFunction(listeners)) {
578
-    this.removeListener(type, listeners);
579
-  } else {
580
-    // LIFO order
581
-    while (listeners.length)
582
-      this.removeListener(type, listeners[listeners.length - 1]);
583
-  }
584
-  delete this._events[type];
585
-
586
-  return this;
587
-};
588
-
589
-EventEmitter.prototype.listeners = function(type) {
590
-  var ret;
591
-  if (!this._events || !this._events[type])
592
-    ret = [];
593
-  else if (isFunction(this._events[type]))
594
-    ret = [this._events[type]];
595
-  else
596
-    ret = this._events[type].slice();
597
-  return ret;
598
-};
599
-
600
-EventEmitter.listenerCount = function(emitter, type) {
601
-  var ret;
602
-  if (!emitter._events || !emitter._events[type])
603
-    ret = 0;
604
-  else if (isFunction(emitter._events[type]))
605
-    ret = 1;
606
-  else
607
-    ret = emitter._events[type].length;
608
-  return ret;
609
-};
610
-
611
-function isFunction(arg) {
612
-  return typeof arg === 'function';
613
-}
614
-
615
-function isNumber(arg) {
616
-  return typeof arg === 'number';
617
-}
618
-
619
-function isObject(arg) {
620
-  return typeof arg === 'object' && arg !== null;
621
-}
622
-
623
-function isUndefined(arg) {
624
-  return arg === void 0;
625
-}
626
-
627
-},{}]},{},[1])(1)
628
-});

+ 0
- 95
libs/modules/keyboardshortcut.bundle.js Zobrazit soubor

@@ -1,95 +0,0 @@
1
-!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var o;"undefined"!=typeof window?o=window:"undefined"!=typeof global?o=global:"undefined"!=typeof self&&(o=self),o.keyboardshortcut=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){
2
-//maps keycode to character, id of popover for given function and function
3
-var shortcuts = {
4
-    67: {
5
-        character: "C",
6
-        id: "toggleChatPopover",
7
-        function: UI.toggleChat
8
-    },
9
-    70: {
10
-        character: "F",
11
-        id: "filmstripPopover",
12
-        function: UI.toggleFilmStrip
13
-    },
14
-    77: {
15
-        character: "M",
16
-        id: "mutePopover",
17
-        function: UI.toggleAudio
18
-    },
19
-    84: {
20
-        character: "T",
21
-        function: function() {
22
-            if(!RTC.localAudio.isMuted()) {
23
-                UI.toggleAudio();
24
-            }
25
-        }
26
-    },
27
-    86: {
28
-        character: "V",
29
-        id: "toggleVideoPopover",
30
-        function: UI.toggleVideo
31
-    }
32
-};
33
-
34
-
35
-var KeyboardShortcut = {
36
-    init: function () {
37
-        window.onkeyup = function(e) {
38
-            var keycode = e.which;
39
-            if(!($(":focus").is("input[type=text]") ||
40
-                $(":focus").is("input[type=password]") ||
41
-                $(":focus").is("textarea"))) {
42
-                if (typeof shortcuts[keycode] === "object") {
43
-                    shortcuts[keycode].function();
44
-                }
45
-                else if (keycode >= "0".charCodeAt(0) &&
46
-                    keycode <= "9".charCodeAt(0)) {
47
-                    UI.clickOnVideo(keycode - "0".charCodeAt(0) + 1);
48
-                }
49
-                //esc while the smileys are visible hides them
50
-            } else if (keycode === 27 && $('#smileysContainer').is(':visible')) {
51
-                UI.toggleSmileys();
52
-            }
53
-        };
54
-
55
-        window.onkeydown = function(e) {
56
-            if(!($(":focus").is("input[type=text]") ||
57
-                $(":focus").is("input[type=password]") ||
58
-                $(":focus").is("textarea"))) {
59
-                if(e.which === "T".charCodeAt(0)) {
60
-                    if(RTC.localAudio.isMuted()) {
61
-                        UI.toggleAudio();
62
-                    }
63
-                }
64
-            }
65
-        };
66
-        var self = this;
67
-        $('body').popover({ selector: '[data-toggle=popover]',
68
-            trigger: 'click hover',
69
-            content: function() {
70
-                return this.getAttribute("content") +
71
-                    self.getShortcut(this.getAttribute("shortcut"));
72
-            }
73
-        });
74
-    },
75
-    /**
76
-     *
77
-     * @param id indicates the popover associated with the shortcut
78
-     * @returns {string} the keyboard shortcut used for the id given
79
-     */
80
-    getShortcut: function (id) {
81
-        for (var keycode in shortcuts) {
82
-            if (shortcuts.hasOwnProperty(keycode)) {
83
-                if (shortcuts[keycode].id === id) {
84
-                    return " (" + shortcuts[keycode].character + ")";
85
-                }
86
-            }
87
-        }
88
-        return "";
89
-    }
90
-};
91
-
92
-module.exports = KeyboardShortcut;
93
-
94
-},{}]},{},[1])(1)
95
-});

+ 0
- 1260
libs/modules/simulcast.bundle.js
Diff nebyl zobrazen, protože je příliš veliký
Zobrazit soubor


+ 0
- 1265
libs/modules/statistics.bundle.js
Diff nebyl zobrazen, protože je příliš veliký
Zobrazit soubor


+ 13
- 13
modules/API/API.js Zobrazit soubor

@@ -4,7 +4,7 @@
4 4
  * applications that embed Jitsi Meet
5 5
  */
6 6
 
7
-
7
+var XMPPEvents = require("../../service/xmpp/XMPPEvents");
8 8
 
9 9
 /**
10 10
  * List of the available commands.
@@ -17,12 +17,12 @@
17 17
  */
18 18
 var commands =
19 19
 {
20
-    displayName: UI.inputDisplayNameHandler,
21
-    muteAudio: UI.toggleAudio,
22
-    muteVideo: UI.toggleVideo,
23
-    toggleFilmStrip: UI.toggleFilmStrip,
24
-    toggleChat: UI.toggleChat,
25
-    toggleContactList: UI.toggleContactList
20
+    displayName: APP.UI.inputDisplayNameHandler,
21
+    muteAudio: APP.UI.toggleAudio,
22
+    muteVideo: APP.UI.toggleVideo,
23
+    toggleFilmStrip: APP.UI.toggleFilmStrip,
24
+    toggleChat: APP.UI.toggleChat,
25
+    toggleContactList: APP.UI.toggleContactList
26 26
 };
27 27
 
28 28
 
@@ -135,26 +135,26 @@ function processMessage(event)
135 135
 }
136 136
 
137 137
 function setupListeners() {
138
-    xmpp.addListener(XMPPEvents.MUC_ENTER, function (from) {
138
+    APP.xmpp.addListener(XMPPEvents.MUC_ENTER, function (from) {
139 139
         API.triggerEvent("participantJoined", {jid: from});
140 140
     });
141
-    xmpp.addListener(XMPPEvents.MESSAGE_RECEIVED, function (from, nick, txt, myjid) {
141
+    APP.xmpp.addListener(XMPPEvents.MESSAGE_RECEIVED, function (from, nick, txt, myjid) {
142 142
         if (from != myjid)
143 143
             API.triggerEvent("incomingMessage",
144 144
                 {"from": from, "nick": nick, "message": txt});
145 145
     });
146
-    xmpp.addListener(XMPPEvents.MUC_LEFT, function (jid) {
146
+    APP.xmpp.addListener(XMPPEvents.MUC_LEFT, function (jid) {
147 147
         API.triggerEvent("participantLeft", {jid: jid});
148 148
     });
149
-    xmpp.addListener(XMPPEvents.DISPLAY_NAME_CHANGED, function (jid, newDisplayName) {
149
+    APP.xmpp.addListener(XMPPEvents.DISPLAY_NAME_CHANGED, function (jid, newDisplayName) {
150 150
         name = displayName[jid];
151 151
         if(!name || name != newDisplayName) {
152 152
             API.triggerEvent("displayNameChange", {jid: jid, displayname: newDisplayName});
153 153
             displayName[jid] = newDisplayName;
154 154
         }
155 155
     });
156
-    xmpp.addListener(XMPPEvents.SENDING_CHAT_MESSAGE, function (body) {
157
-        API.triggerEvent("outgoingMessage", {"message": body});
156
+    APP.xmpp.addListener(XMPPEvents.SENDING_CHAT_MESSAGE, function (body) {
157
+        APP.API.triggerEvent("outgoingMessage", {"message": body});
158 158
     });
159 159
 }
160 160
 

+ 5
- 2
modules/RTC/DataChannels.js Zobrazit soubor

@@ -2,11 +2,14 @@
2 2
 
3 3
 // cache datachannels to avoid garbage collection
4 4
 // https://code.google.com/p/chromium/issues/detail?id=405545
5
+var RTCEvents = require("../../service/RTC/RTCEvents");
6
+
5 7
 var _dataChannels = [];
6 8
 var eventEmitter = null;
7 9
 
8 10
 
9 11
 
12
+
10 13
 var DataChannels =
11 14
 {
12 15
 
@@ -33,7 +36,7 @@ var DataChannels =
33 36
             // selections so that it can do adaptive simulcast,
34 37
             // we want the notification to trigger even if userJid is undefined,
35 38
             // or null.
36
-            var userJid = UI.getLargeVideoState().userJid;
39
+            var userJid = APP.UI.getLargeVideoState().userJid;
37 40
             // we want the notification to trigger even if userJid is undefined,
38 41
             // or null.
39 42
             onSelectedEndpointChanged(userJid);
@@ -67,7 +70,7 @@ var DataChannels =
67 70
                     console.info(
68 71
                         "Data channel new dominant speaker event: ",
69 72
                         dominantSpeakerEndpoint);
70
-                    eventEmitter.emit(RTC.DOMINANTSPEAKER_CHANGED, dominantSpeakerEndpoint);
73
+                    eventEmitter.emit(RTCEvents.DOMINANTSPEAKER_CHANGED, dominantSpeakerEndpoint);
71 74
                 }
72 75
                 else if ("InLastNChangeEvent" === colibriClass)
73 76
                 {

+ 1
- 1
modules/RTC/LocalStream.js Zobrazit soubor

@@ -1,4 +1,4 @@
1
-//var StreamEventTypes = require("../../service/RTC/StreamEventTypes.js");
1
+var StreamEventTypes = require("../../service/RTC/StreamEventTypes.js");
2 2
 
3 3
 function LocalStream(stream, type, eventEmitter, videoType)
4 4
 {

+ 2
- 3
modules/RTC/MediaStream.js Zobrazit soubor

@@ -1,7 +1,6 @@
1 1
 ////These lines should be uncommented when require works in app.js
2
-//var RTCBrowserType = require("../../service/RTC/RTCBrowserType.js");
3
-//var StreamEventTypes = require("../../service/RTC/StreamEventTypes.js");
4
-//var MediaStreamType = require("../../service/RTC/MediaStreamTypes");
2
+var RTCBrowserType = require("../../service/RTC/RTCBrowserType.js");
3
+var MediaStreamType = require("../../service/RTC/MediaStreamTypes");
5 4
 
6 5
 /**
7 6
  * Creates a MediaStream object for the given data, session id and ssrc.

+ 16
- 13
modules/RTC/RTC.js Zobrazit soubor

@@ -3,9 +3,12 @@ var RTCUtils = require("./RTCUtils.js");
3 3
 var LocalStream = require("./LocalStream.js");
4 4
 var DataChannels = require("./DataChannels");
5 5
 var MediaStream = require("./MediaStream.js");
6
-//These lines should be uncommented when require works in app.js
7
-//var StreamEventTypes = require("../../service/RTC/StreamEventTypes.js");
8
-//var XMPPEvents = require("../service/xmpp/XMPPEvents");
6
+var DesktopSharingEventTypes
7
+    = require("../../service/desktopsharing/DesktopSharingEventTypes");
8
+var MediaStreamType = require("../../service/RTC/MediaStreamTypes");
9
+var StreamEventTypes = require("../../service/RTC/StreamEventTypes.js");
10
+var XMPPEvents = require("../../service/xmpp/XMPPEvents");
11
+var UIEvents = require("../../service/UI/UIEvents");
9 12
 
10 13
 var eventEmitter = new EventEmitter();
11 14
 
@@ -61,7 +64,7 @@ var RTC = {
61 64
     createRemoteStream: function (data, sid, thessrc) {
62 65
         var remoteStream = new MediaStream(data, sid, thessrc,
63 66
             this.getBrowserType());
64
-        var jid = data.peerjid || xmpp.myJid();
67
+        var jid = data.peerjid || APP.xmpp.myJid();
65 68
         if(!this.remoteStreams[jid]) {
66 69
             this.remoteStreams[jid] = {};
67 70
         }
@@ -105,11 +108,11 @@ var RTC = {
105 108
     },
106 109
     start: function () {
107 110
         var self = this;
108
-        desktopsharing.addListener(
111
+        APP.desktopsharing.addListener(
109 112
             function (stream, isUsingScreenStream, callback) {
110 113
                 self.changeLocalVideo(stream, isUsingScreenStream, callback);
111 114
             }, DesktopSharingEventTypes.NEW_STREAM_CREATED);
112
-        xmpp.addListener(XMPPEvents.CHANGED_STREAMS, function (jid, changedStreams) {
115
+        APP.xmpp.addListener(XMPPEvents.CHANGED_STREAMS, function (jid, changedStreams) {
113 116
             for(var i = 0; i < changedStreams.length; i++) {
114 117
                 var type = changedStreams[i].type;
115 118
                 if (type != "audio") {
@@ -123,12 +126,12 @@ var RTC = {
123 126
                 }
124 127
             }
125 128
         });
126
-        xmpp.addListener(XMPPEvents.CALL_INCOMING, function(event) {
129
+        APP.xmpp.addListener(XMPPEvents.CALL_INCOMING, function(event) {
127 130
             DataChannels.init(event.peerconnection, eventEmitter);
128 131
         });
129
-        UI.addListener(UIEvents.SELECTED_ENDPOINT,
132
+        APP.UI.addListener(UIEvents.SELECTED_ENDPOINT,
130 133
             DataChannels.handleSelectedEndpointEvent);
131
-        UI.addListener(UIEvents.PINNED_ENDPOINT,
134
+        APP.UI.addListener(UIEvents.PINNED_ENDPOINT,
132 135
             DataChannels.handlePinnedEndpointEvent);
133 136
         this.rtcUtils = new RTCUtils(this);
134 137
         this.rtcUtils.obtainAudioAndVideoPermissions();
@@ -164,10 +167,10 @@ var RTC = {
164 167
     changeLocalVideo: function (stream, isUsingScreenStream, callback) {
165 168
         var oldStream = this.localVideo.getOriginalStream();
166 169
         var type = (isUsingScreenStream? "screen" : "video");
167
-        RTC.localVideo = this.createLocalStream(stream, "video", true, type);
170
+        this.localVideo = this.createLocalStream(stream, "video", true, type);
168 171
         // Stop the stream to trigger onended event for old stream
169 172
         oldStream.stop();
170
-        xmpp.switchStreams(stream, oldStream,callback);
173
+        APP.xmpp.switchStreams(stream, oldStream,callback);
171 174
     },
172 175
     /**
173 176
      * Checks if video identified by given src is desktop stream.
@@ -180,8 +183,8 @@ var RTC = {
180 183
             return false;
181 184
         var isDesktop = false;
182 185
         var stream = null;
183
-        if (xmpp.myJid() &&
184
-            xmpp.myResource() === jid) {
186
+        if (APP.xmpp.myJid() &&
187
+            APP.xmpp.myResource() === jid) {
185 188
             // local video
186 189
             stream = this.localVideo;
187 190
         } else {

+ 3
- 4
modules/RTC/RTCUtils.js Zobrazit soubor

@@ -1,5 +1,4 @@
1
-//This should be uncommented when app.js supports require
2
-//var RTCBrowserType = require("../../service/RTC/RTCBrowserType.js");
1
+var RTCBrowserType = require("../../service/RTC/RTCBrowserType.js");
3 2
 
4 3
 function setResolutionConstraints(constraints, resolution, isAndroid)
5 4
 {
@@ -236,7 +235,7 @@ RTCUtils.prototype.getUserMediaWithConstraints = function(
236 235
 
237 236
             // We currently do not support FF, as it doesn't have multistream support.
238 237
             && !isFF) {
239
-            simulcast.getUserMedia(constraints, function (stream) {
238
+            APP.simulcast.getUserMedia(constraints, function (stream) {
240 239
                     console.log('onUserMediaSuccess');
241 240
                     success_callback(stream);
242 241
                 },
@@ -292,7 +291,7 @@ RTCUtils.prototype.obtainAudioAndVideoPermissions = function() {
292 291
                 cb,
293 292
                 function (error) {
294 293
                     console.error('failed to obtain audio/video stream - stop', error);
295
-                    UI.messageHandler.showError("Error",
294
+                    APP.UI.messageHandler.showError("Error",
296 295
                             "Failed to obtain permissions to use the local microphone" +
297 296
                             "and/or camera.");
298 297
                 }

+ 96
- 97
modules/UI/UI.js Zobrazit soubor

@@ -20,6 +20,12 @@ var messageHandler = UI.messageHandler;
20 20
 var Authentication  = require("./authentication/Authentication");
21 21
 var UIUtil = require("./util/UIUtil");
22 22
 var NicknameHandler = require("./util/NicknameHandler");
23
+var CQEvents = require("../../service/connectionquality/CQEvents");
24
+var DesktopSharingEventTypes
25
+    = require("../../service/desktopsharing/DesktopSharingEventTypes");
26
+var RTCEvents = require("../../service/RTC/RTCEvents");
27
+var StreamEventTypes = require("../../service/RTC/StreamEventTypes");
28
+var XMPPEvents = require("../../service/xmpp/XMPPEvents");
23 29
 
24 30
 var eventEmitter = new EventEmitter();
25 31
 var roomName = null;
@@ -73,38 +79,38 @@ function onDisplayNameChanged(jid, displayName) {
73 79
 }
74 80
 
75 81
 function registerListeners() {
76
-    RTC.addStreamListener(streamHandler, StreamEventTypes.EVENT_TYPE_LOCAL_CREATED);
82
+    APP.RTC.addStreamListener(streamHandler, StreamEventTypes.EVENT_TYPE_LOCAL_CREATED);
77 83
 
78
-    RTC.addStreamListener(streamHandler, StreamEventTypes.EVENT_TYPE_LOCAL_CHANGED);
79
-    RTC.addStreamListener(function (stream) {
84
+    APP.RTC.addStreamListener(streamHandler, StreamEventTypes.EVENT_TYPE_LOCAL_CHANGED);
85
+    APP.RTC.addStreamListener(function (stream) {
80 86
         VideoLayout.onRemoteStreamAdded(stream);
81 87
     }, StreamEventTypes.EVENT_TYPE_REMOTE_CREATED);
82
-    RTC.addListener(RTCEvents.LASTN_CHANGED, onLastNChanged);
83
-    RTC.addListener(RTCEvents.DOMINANTSPEAKER_CHANGED, function (resourceJid) {
88
+    APP.RTC.addListener(RTCEvents.LASTN_CHANGED, onLastNChanged);
89
+    APP.RTC.addListener(RTCEvents.DOMINANTSPEAKER_CHANGED, function (resourceJid) {
84 90
         VideoLayout.onDominantSpeakerChanged(resourceJid);
85 91
     });
86
-    RTC.addListener(RTCEvents.LASTN_ENDPOINT_CHANGED,
92
+    APP.RTC.addListener(RTCEvents.LASTN_ENDPOINT_CHANGED,
87 93
         function (lastNEndpoints, endpointsEnteringLastN, stream) {
88 94
             VideoLayout.onLastNEndpointsChanged(lastNEndpoints,
89 95
                 endpointsEnteringLastN, stream);
90 96
         });
91
-    RTC.addListener(RTCEvents.SIMULCAST_LAYER_CHANGED,
97
+    APP.RTC.addListener(RTCEvents.SIMULCAST_LAYER_CHANGED,
92 98
         function (endpointSimulcastLayers) {
93 99
            VideoLayout.onSimulcastLayersChanged(endpointSimulcastLayers);
94 100
         });
95
-    RTC.addListener(RTCEvents.SIMULCAST_LAYER_CHANGING,
101
+    APP.RTC.addListener(RTCEvents.SIMULCAST_LAYER_CHANGING,
96 102
         function (endpointSimulcastLayers) {
97 103
             VideoLayout.onSimulcastLayersChanging(endpointSimulcastLayers);
98 104
         });
99 105
     VideoLayout.init(eventEmitter);
100 106
 
101
-    statistics.addAudioLevelListener(function(jid, audioLevel)
107
+    APP.statistics.addAudioLevelListener(function(jid, audioLevel)
102 108
     {
103 109
         var resourceJid;
104
-        if(jid === statistics.LOCAL_JID)
110
+        if(jid === APP.statistics.LOCAL_JID)
105 111
         {
106 112
             resourceJid = AudioLevels.LOCAL_LEVEL;
107
-            if(RTC.localAudio.isMuted())
113
+            if(APP.RTC.localAudio.isMuted())
108 114
             {
109 115
                 audioLevel = 0;
110 116
             }
@@ -117,23 +123,31 @@ function registerListeners() {
117 123
         AudioLevels.updateAudioLevel(resourceJid, audioLevel,
118 124
             UI.getLargeVideoState().userResourceJid);
119 125
     });
120
-    desktopsharing.addListener(function () {
126
+    APP.desktopsharing.addListener(function () {
121 127
         ToolbarToggler.showDesktopSharingButton();
122 128
     }, DesktopSharingEventTypes.INIT);
123
-    desktopsharing.addListener(
129
+    APP.desktopsharing.addListener(
124 130
         Toolbar.changeDesktopSharingButtonState,
125 131
         DesktopSharingEventTypes.SWITCHING_DONE);
126
-    xmpp.addListener(XMPPEvents.DISPOSE_CONFERENCE, onDisposeConference);
127
-    xmpp.addListener(XMPPEvents.KICKED, function () {
132
+    APP.connectionquality.addListener(CQEvents.LOCALSTATS_UPDATED,
133
+        VideoLayout.updateLocalConnectionStats);
134
+    APP.connectionquality.addListener(CQEvents.REMOTESTATS_UPDATED,
135
+        VideoLayout.updateConnectionStats);
136
+    APP.connectionquality.addListener(CQEvents.STOP,
137
+        VideoLayout.onStatsStop);
138
+    APP.xmpp.addListener(XMPPEvents.DISPOSE_CONFERENCE, onDisposeConference);
139
+    APP.xmpp.addListener(XMPPEvents.KICKED, function () {
128 140
         messageHandler.openMessageDialog("Session Terminated",
129 141
             "Ouch! You have been kicked out of the meet!");
130 142
     });
131
-    xmpp.addListener(XMPPEvents.BRIDGE_DOWN, function () {
143
+    APP.xmpp.addListener(XMPPEvents.BRIDGE_DOWN, function () {
132 144
         messageHandler.showError("Error",
133 145
             "Jitsi Videobridge is currently unavailable. Please try again later!");
134 146
     });
135
-    xmpp.addListener(XMPPEvents.USER_ID_CHANGED, Avatar.setUserAvatar);
136
-    xmpp.addListener(XMPPEvents.CHANGED_STREAMS, function (jid, changedStreams) {
147
+    APP.xmpp.addListener(XMPPEvents.USER_ID_CHANGED, function (from, id) {
148
+        Avatar.setUserAvatar(from, id);
149
+    });
150
+    APP.xmpp.addListener(XMPPEvents.CHANGED_STREAMS, function (jid, changedStreams) {
137 151
         for(stream in changedStreams)
138 152
         {
139 153
             // might need to update the direction if participant just went from sendrecv to recvonly
@@ -153,29 +167,53 @@ function registerListeners() {
153 167
         }
154 168
 
155 169
     });
156
-    xmpp.addListener(XMPPEvents.DISPLAY_NAME_CHANGED, onDisplayNameChanged);
157
-    xmpp.addListener(XMPPEvents.MUC_JOINED, onMucJoined);
158
-    xmpp.addListener(XMPPEvents.LOCALROLE_CHANGED, onLocalRoleChange);
159
-    xmpp.addListener(XMPPEvents.MUC_ENTER, onMucEntered);
160
-    xmpp.addListener(XMPPEvents.MUC_ROLE_CHANGED, onMucRoleChanged);
161
-    xmpp.addListener(XMPPEvents.PRESENCE_STATUS, onMucPresenceStatus);
162
-    xmpp.addListener(XMPPEvents.SUBJECT_CHANGED, chatSetSubject);
163
-    xmpp.addListener(XMPPEvents.MESSAGE_RECEIVED, updateChatConversation);
164
-    xmpp.addListener(XMPPEvents.MUC_LEFT, onMucLeft);
165
-    xmpp.addListener(XMPPEvents.PASSWORD_REQUIRED, onPasswordReqiured);
166
-    xmpp.addListener(XMPPEvents.CHAT_ERROR_RECEIVED, chatAddError);
167
-    xmpp.addListener(XMPPEvents.ETHERPAD, initEtherpad);
168
-    connectionquality.addListener(CQEvents.LOCALSTATS_UPDATED,
169
-        VideoLayout.updateLocalConnectionStats);
170
-    connectionquality.addListener(CQEvents.REMOTESTATS_UPDATED,
171
-        VideoLayout.updateConnectionStats);
172
-    connectionquality.addListener(CQEvents.STOP,
173
-        VideoLayout.onStatsStop);
174
-    xmpp.addListener(XMPPEvents.AUTHENTICATION_REQUIRED, onAuthenticationRequired);
170
+    APP.xmpp.addListener(XMPPEvents.DISPLAY_NAME_CHANGED, onDisplayNameChanged);
171
+    APP.xmpp.addListener(XMPPEvents.MUC_JOINED, onMucJoined);
172
+    APP.xmpp.addListener(XMPPEvents.LOCALROLE_CHANGED, onLocalRoleChange);
173
+    APP.xmpp.addListener(XMPPEvents.MUC_ENTER, onMucEntered);
174
+    APP.xmpp.addListener(XMPPEvents.MUC_ROLE_CHANGED, onMucRoleChanged);
175
+    APP.xmpp.addListener(XMPPEvents.PRESENCE_STATUS, onMucPresenceStatus);
176
+    APP.xmpp.addListener(XMPPEvents.SUBJECT_CHANGED, chatSetSubject);
177
+    APP.xmpp.addListener(XMPPEvents.MESSAGE_RECEIVED, updateChatConversation);
178
+    APP.xmpp.addListener(XMPPEvents.MUC_LEFT, onMucLeft);
179
+    APP.xmpp.addListener(XMPPEvents.PASSWORD_REQUIRED, onPasswordReqiured);
180
+    APP.xmpp.addListener(XMPPEvents.CHAT_ERROR_RECEIVED, chatAddError);
181
+    APP.xmpp.addListener(XMPPEvents.ETHERPAD, initEtherpad);
182
+    APP.xmpp.addListener(XMPPEvents.AUTHENTICATION_REQUIRED, onAuthenticationRequired);
183
+
184
+
185
+}
186
+
175 187
 
188
+/**
189
+ * Mutes/unmutes the local video.
190
+ *
191
+ * @param mute <tt>true</tt> to mute the local video; otherwise, <tt>false</tt>
192
+ * @param options an object which specifies optional arguments such as the
193
+ * <tt>boolean</tt> key <tt>byUser</tt> with default value <tt>true</tt> which
194
+ * specifies whether the method was initiated in response to a user command (in
195
+ * contrast to an automatic decision taken by the application logic)
196
+ */
197
+function setVideoMute(mute, options) {
198
+    APP.xmpp.setVideoMute(
199
+        mute,
200
+        function (mute) {
201
+            var video = $('#video');
202
+            var communicativeClass = "icon-camera";
203
+            var muteClass = "icon-camera icon-camera-disabled";
176 204
 
205
+            if (mute) {
206
+                video.removeClass(communicativeClass);
207
+                video.addClass(muteClass);
208
+            } else {
209
+                video.removeClass(muteClass);
210
+                video.addClass(communicativeClass);
211
+            }
212
+        },
213
+        options);
177 214
 }
178 215
 
216
+
179 217
 function bindEvents()
180 218
 {
181 219
     /**
@@ -194,7 +232,7 @@ function bindEvents()
194 232
     });
195 233
 }
196 234
 
197
-UI.start = function () {
235
+UI.start = function (init) {
198 236
     document.title = interfaceConfig.APP_NAME;
199 237
     if(config.enableWelcomePage && window.location.pathname == "/" &&
200 238
         (!window.localStorage.welcomePageDisabled || window.localStorage.welcomePageDisabled == "false"))
@@ -314,10 +352,6 @@ UI.start = function () {
314 352
 
315 353
 };
316 354
 
317
-UI.toggleSmileys = function () {
318
-    Chat.toggleSmileys();
319
-};
320
-
321 355
 function chatAddError(errorMessage, originalText)
322 356
 {
323 357
     return Chat.chatAddError(errorMessage, originalText);
@@ -347,7 +381,7 @@ function onMucJoined(jid, info) {
347 381
 
348 382
     // Show authenticate button if needed
349 383
     Toolbar.showAuthenticateButton(
350
-            xmpp.isExternalAuthEnabled() && !xmpp.isModerator());
384
+            APP.xmpp.isExternalAuthEnabled() && !APP.xmpp.isModerator());
351 385
 
352 386
     var displayName = !config.displayJids
353 387
         ? info.displayName : Strophe.getResourceFromJid(jid);
@@ -485,6 +519,11 @@ function onLastNChanged(oldValue, newValue) {
485 519
     }
486 520
 }
487 521
 
522
+
523
+UI.toggleSmileys = function () {
524
+    Chat.toggleSmileys();
525
+};
526
+
488 527
 UI.getSettings = function () {
489 528
     return Settings.getSettings();
490 529
 };
@@ -501,10 +540,6 @@ UI.toggleContactList = function () {
501 540
     return BottomToolbar.toggleContactList();
502 541
 };
503 542
 
504
-UI.setRecordingButtonState = function (state) {
505
-    Toolbar.setRecordingButtonState(state);
506
-};
507
-
508 543
 UI.inputDisplayNameHandler = function (value) {
509 544
     VideoLayout.inputDisplayNameHandler(value);
510 545
 };
@@ -515,10 +550,6 @@ UI.getLargeVideoState = function()
515 550
     return VideoLayout.getLargeVideoState();
516 551
 };
517 552
 
518
-UI.showLocalAudioIndicator = function (mute) {
519
-    VideoLayout.showLocalAudioIndicator(mute);
520
-};
521
-
522 553
 UI.generateRoomName = function() {
523 554
     if(roomName)
524 555
         return roomName;
@@ -560,19 +591,15 @@ UI.connectionIndicatorShowMore = function(id)
560 591
     return VideoLayout.connectionIndicators[id].showMore();
561 592
 };
562 593
 
563
-UI.showToolbar = function () {
564
-    return ToolbarToggler.showToolbar();
565
-};
566
-
567
-UI.dockToolbar = function (isDock) {
568
-    return ToolbarToggler.dockToolbar(isDock);
569
-};
570
-
571 594
 UI.getCreadentials = function () {
595
+    var settings = this.getSettings();
572 596
     return {
573 597
         bosh: document.getElementById('boshURL').value,
574 598
         password: document.getElementById('password').value,
575
-        jid: document.getElementById('jid').value
599
+        jid: document.getElementById('jid').value,
600
+        email: settings.email,
601
+        displayName: settings.displayName,
602
+        uid: settings.uid
576 603
     };
577 604
 };
578 605
 
@@ -615,20 +642,20 @@ UI.checkForNicknameAndJoin = function () {
615 642
     if (config.useNicks) {
616 643
         nick = window.prompt('Your nickname (optional)');
617 644
     }
618
-    xmpp.joinRoom(roomName, config.useNicks, nick);
619
-}
645
+    APP.xmpp.joinRoom(roomName, config.useNicks, nick);
646
+};
620 647
 
621 648
 
622 649
 function dump(elem, filename) {
623 650
     elem = elem.parentNode;
624 651
     elem.download = filename || 'meetlog.json';
625 652
     elem.href = 'data:application/json;charset=utf-8,\n';
626
-    var data = xmpp.populateData();
653
+    var data = APP.xmpp.populateData();
627 654
     var metadata = {};
628 655
     metadata.time = new Date();
629 656
     metadata.url = window.location.href;
630 657
     metadata.ua = navigator.userAgent;
631
-    var log = xmpp.getLogger();
658
+    var log = APP.xmpp.getLogger();
632 659
     if (log) {
633 660
         metadata.xmpp = log;
634 661
     }
@@ -639,35 +666,7 @@ function dump(elem, filename) {
639 666
 
640 667
 UI.getRoomName = function () {
641 668
     return roomName;
642
-}
643
-
644
-/**
645
- * Mutes/unmutes the local video.
646
- *
647
- * @param mute <tt>true</tt> to mute the local video; otherwise, <tt>false</tt>
648
- * @param options an object which specifies optional arguments such as the
649
- * <tt>boolean</tt> key <tt>byUser</tt> with default value <tt>true</tt> which
650
- * specifies whether the method was initiated in response to a user command (in
651
- * contrast to an automatic decision taken by the application logic)
652
- */
653
-function setVideoMute(mute, options) {
654
-    xmpp.setVideoMute(
655
-        mute,
656
-        function (mute) {
657
-            var video = $('#video');
658
-            var communicativeClass = "icon-camera";
659
-            var muteClass = "icon-camera icon-camera-disabled";
660
-
661
-            if (mute) {
662
-                video.removeClass(communicativeClass);
663
-                video.addClass(muteClass);
664
-            } else {
665
-                video.removeClass(muteClass);
666
-                video.addClass(communicativeClass);
667
-            }
668
-        },
669
-        options);
670
-}
669
+};
671 670
 
672 671
 /**
673 672
  * Mutes/unmutes the local video.
@@ -675,14 +674,14 @@ function setVideoMute(mute, options) {
675 674
 UI.toggleVideo = function () {
676 675
     UIUtil.buttonClick("#video", "icon-camera icon-camera-disabled");
677 676
 
678
-    setVideoMute(!RTC.localVideo.isMuted());
677
+    setVideoMute(!APP.RTC.localVideo.isMuted());
679 678
 };
680 679
 
681 680
 /**
682 681
  * Mutes / unmutes audio for the local participant.
683 682
  */
684 683
 UI.toggleAudio = function() {
685
-    UI.setAudioMuted(!RTC.localAudio.isMuted());
684
+    UI.setAudioMuted(!APP.RTC.localAudio.isMuted());
686 685
 };
687 686
 
688 687
 /**
@@ -690,8 +689,8 @@ UI.toggleAudio = function() {
690 689
  */
691 690
 UI.setAudioMuted = function (mute) {
692 691
 
693
-    if(!xmpp.setAudioMute(mute, function () {
694
-        UI.showLocalAudioIndicator(mute);
692
+    if(!APP.xmpp.setAudioMute(mute, function () {
693
+        VideoLayout.showLocalAudioIndicator(mute);
695 694
 
696 695
         UIUtil.buttonClick("#mute", "icon-microphone icon-mic-disabled");
697 696
     }))

+ 4
- 4
modules/UI/audio_levels/AudioLevels.js Zobrazit soubor

@@ -87,10 +87,10 @@ var AudioLevels = (function(my) {
87 87
         drawContext.drawImage(canvasCache, 0, 0);
88 88
 
89 89
         if(resourceJid === AudioLevels.LOCAL_LEVEL) {
90
-            if(!xmpp.myJid()) {
90
+            if(!APP.xmpp.myJid()) {
91 91
                 return;
92 92
             }
93
-            resourceJid = xmpp.myResource();
93
+            resourceJid = APP.xmpp.myResource();
94 94
         }
95 95
 
96 96
         if(resourceJid  === largeVideoResourceJid) {
@@ -221,8 +221,8 @@ var AudioLevels = (function(my) {
221 221
     function getVideoSpanId(resourceJid) {
222 222
         var videoSpanId = null;
223 223
         if (resourceJid === AudioLevels.LOCAL_LEVEL
224
-                || (xmpp.myResource() && resourceJid
225
-                    === xmpp.myResource()))
224
+                || (APP.xmpp.myResource() && resourceJid
225
+                    === APP.xmpp.myResource()))
226 226
             videoSpanId = 'localVideoContainer';
227 227
         else
228 228
             videoSpanId = 'participant_' + resourceJid;

+ 1
- 1
modules/UI/authentication/Authentication.js Zobrazit soubor

@@ -53,7 +53,7 @@ var Authentication = {
53 53
     closeAuthenticationDialog: function () {
54 54
         // Close authentication dialog if opened
55 55
         if (authDialog) {
56
-            UI.messageHandler.closeDialog();
56
+            APP.UI.messageHandler.closeDialog();
57 57
             authDialog = null;
58 58
         }
59 59
     },

+ 8
- 7
modules/UI/avatar/Avatar.js Zobrazit soubor

@@ -1,4 +1,5 @@
1 1
 var Settings = require("../side_pannels/settings/Settings");
2
+var MediaStreamType = require("../../../service/RTC/MediaStreamTypes");
2 3
 
3 4
 var users = {};
4 5
 var activeSpeakerJid;
@@ -12,21 +13,21 @@ function setVisibility(selector, show) {
12 13
 function isUserMuted(jid) {
13 14
     // XXX(gp) we may want to rename this method to something like
14 15
     // isUserStreaming, for example.
15
-    if (jid && jid != xmpp.myJid()) {
16
+    if (jid && jid != APP.xmpp.myJid()) {
16 17
         var resource = Strophe.getResourceFromJid(jid);
17 18
         if (!require("../videolayout/VideoLayout").isInLastN(resource)) {
18 19
             return true;
19 20
         }
20 21
     }
21 22
 
22
-    if (!RTC.remoteStreams[jid] || !RTC.remoteStreams[jid][MediaStreamType.VIDEO_TYPE]) {
23
+    if (!APP.RTC.remoteStreams[jid] || !APP.RTC.remoteStreams[jid][MediaStreamType.VIDEO_TYPE]) {
23 24
         return null;
24 25
     }
25
-    return RTC.remoteStreams[jid][MediaStreamType.VIDEO_TYPE].muted;
26
+    return APP.RTC.remoteStreams[jid][MediaStreamType.VIDEO_TYPE].muted;
26 27
 }
27 28
 
28 29
 function getGravatarUrl(id, size) {
29
-    if(id === xmpp.myJid() || !id) {
30
+    if(id === APP.xmpp.myJid() || !id) {
30 31
         id = Settings.getSettings().uid;
31 32
     }
32 33
     return 'https://www.gravatar.com/avatar/' +
@@ -57,7 +58,7 @@ var Avatar = {
57 58
 
58 59
         // set the avatar in the settings menu if it is local user and get the
59 60
         // local video container
60
-        if (jid === xmpp.myJid()) {
61
+        if (jid === APP.xmpp.myJid()) {
61 62
             $('#avatar').get(0).src = thumbUrl;
62 63
             thumbnail = $('#localVideoContainer');
63 64
         }
@@ -100,7 +101,7 @@ var Avatar = {
100 101
             var video = $('#participant_' + resourceJid + '>video');
101 102
             var avatar = $('#avatar_' + resourceJid);
102 103
 
103
-            if (jid === xmpp.myJid()) {
104
+            if (jid === APP.xmpp.myJid()) {
104 105
                 video = $('#localVideoWrapper>video');
105 106
             }
106 107
             if (show === undefined || show === null) {
@@ -130,7 +131,7 @@ var Avatar = {
130 131
      */
131 132
     updateActiveSpeakerAvatarSrc: function (jid) {
132 133
         if (!jid) {
133
-            jid = xmpp.findJidFromResource(
134
+            jid = APP.xmpp.findJidFromResource(
134 135
                 require("../videolayout/VideoLayout").getLargeVideoState().userResourceJid);
135 136
         }
136 137
         var avatar = $("#activeSpeakerAvatar")[0];

+ 2
- 2
modules/UI/etherpad/Etherpad.js Zobrazit soubor

@@ -1,4 +1,4 @@
1
-/* global $, config, dockToolbar,
1
+/* global $, config,
2 2
    setLargeVideoVisible, Util */
3 3
 
4 4
 var VideoLayout = require("../videolayout/VideoLayout");
@@ -30,7 +30,7 @@ function resize() {
30 30
  * Shares the Etherpad name with other participants.
31 31
  */
32 32
 function shareEtherpad() {
33
-    xmpp.addToPresence("etherpad", etherpadName);
33
+    APP.xmpp.addToPresence("etherpad", etherpadName);
34 34
 }
35 35
 
36 36
 /**

+ 2
- 2
modules/UI/prezi/Prezi.js Zobrazit soubor

@@ -31,7 +31,7 @@ var Prezi = {
31 31
      * to load.
32 32
      */
33 33
     openPreziDialog: function() {
34
-        var myprezi = xmpp.getPrezi();
34
+        var myprezi = APP.xmpp.getPrezi();
35 35
         if (myprezi) {
36 36
             messageHandler.openTwoButtonDialog("Remove Prezi",
37 37
                 "Are you sure you would like to remove your Prezi?",
@@ -196,7 +196,7 @@ function presentationAdded(event, jid, presUrl, currentSlide) {
196 196
 
197 197
     preziPlayer.on(PreziPlayer.EVENT_CURRENT_STEP, function(event) {
198 198
         console.log("event value", event.value);
199
-        xmpp.addToPresence("preziSlide", event.value);
199
+        APP.xmpp.addToPresence("preziSlide", event.value);
200 200
     });
201 201
 
202 202
     $("#" + elementId).css( 'background-image',

+ 4
- 3
modules/UI/side_pannels/chat/Chat.js Zobrazit soubor

@@ -1,10 +1,11 @@
1
-/* global $, Util, nickname:true, showToolbar */
1
+/* global $, Util, nickname:true */
2 2
 var Replacement = require("./Replacement");
3 3
 var CommandsProcessor = require("./Commands");
4 4
 var ToolbarToggler = require("../../toolbars/ToolbarToggler");
5 5
 var smileys = require("./smileys.json").smileys;
6 6
 var NicknameHandler = require("../../util/NicknameHandler");
7 7
 var UIUtil = require("../../util/UIUtil");
8
+var UIEvents = require("../../../../service/UI/UIEvents");
8 9
 
9 10
 var notificationInterval = false;
10 11
 var unreadMessages = 0;
@@ -204,7 +205,7 @@ var Chat = (function (my) {
204 205
                 else
205 206
                 {
206 207
                     var message = UIUtil.escapeHtml(value);
207
-                    xmpp.sendChatMessage(message, NicknameHandler.getNickname());
208
+                    APP.xmpp.sendChatMessage(message, NicknameHandler.getNickname());
208 209
                 }
209 210
             }
210 211
         });
@@ -230,7 +231,7 @@ var Chat = (function (my) {
230 231
     my.updateChatConversation = function (from, displayName, message) {
231 232
         var divClassName = '';
232 233
 
233
-        if (xmpp.myJid() === from) {
234
+        if (APP.xmpp.myJid() === from) {
234 235
             divClassName = "localuser";
235 236
         }
236 237
         else {

+ 1
- 1
modules/UI/side_pannels/chat/Commands.js Zobrazit soubor

@@ -34,7 +34,7 @@ function getCommand(message)
34 34
 function processTopic(commandArguments)
35 35
 {
36 36
     var topic = UIUtil.escapeHtml(commandArguments);
37
-    xmpp.setSubject(topic);
37
+    APP.xmpp.setSubject(topic);
38 38
 }
39 39
 
40 40
 /**

+ 1
- 1
modules/UI/side_pannels/contactlist/ContactList.js Zobrazit soubor

@@ -110,7 +110,7 @@ var ContactList = {
110 110
 
111 111
         var clElement = contactlist.get(0);
112 112
 
113
-        if (resourceJid === xmpp.myResource()
113
+        if (resourceJid === APP.xmpp.myResource()
114 114
             && $('#contactlist>ul .title')[0].nextSibling.nextSibling) {
115 115
             clElement.insertBefore(newContact,
116 116
                 $('#contactlist>ul .title')[0].nextSibling.nextSibling);

+ 2
- 2
modules/UI/side_pannels/settings/SettingsMenu.js Zobrazit soubor

@@ -11,11 +11,11 @@ var SettingsMenu = {
11 11
 
12 12
         if(newDisplayName) {
13 13
             var displayName = Settings.setDisplayName(newDisplayName);
14
-            xmpp.addToPresence("displayName", displayName, true);
14
+            APP.xmpp.addToPresence("displayName", displayName, true);
15 15
         }
16 16
 
17 17
 
18
-        xmpp.addToPresence("email", newEmail);
18
+        APP.xmpp.addToPresence("email", newEmail);
19 19
         var email = Settings.setEmail(newEmail);
20 20
 
21 21
 

+ 9
- 9
modules/UI/toolbars/Toolbar.js Zobrazit soubor

@@ -15,10 +15,10 @@ var UI = null;
15 15
 var buttonHandlers =
16 16
 {
17 17
     "toolbar_button_mute": function () {
18
-        return UI.toggleAudio();
18
+        return APP.UI.toggleAudio();
19 19
     },
20 20
     "toolbar_button_camera": function () {
21
-        return UI.toggleVideo();
21
+        return APP.UI.toggleVideo();
22 22
     },
23 23
     "toolbar_button_authentication": function () {
24 24
         return Toolbar.authenticateClicked();
@@ -42,7 +42,7 @@ var buttonHandlers =
42 42
         return Etherpad.toggleEtherpad(0);
43 43
     },
44 44
     "toolbar_button_desktopsharing": function () {
45
-        return desktopsharing.toggleScreenSharing();
45
+        return APP.desktopsharing.toggleScreenSharing();
46 46
     },
47 47
     "toolbar_button_fullScreen": function()
48 48
     {
@@ -61,7 +61,7 @@ var buttonHandlers =
61 61
 };
62 62
 
63 63
 function hangup() {
64
-    xmpp.disposeConference();
64
+    APP.xmpp.disposeConference();
65 65
     if(config.enableWelcomePage)
66 66
     {
67 67
         setTimeout(function()
@@ -91,7 +91,7 @@ function hangup() {
91 91
 
92 92
 function toggleRecording() {
93 93
     xmpp.toggleRecording(function (callback) {
94
-        UI.messageHandler.openTwoButtonDialog(null,
94
+        APP.UI.messageHandler.openTwoButtonDialog(null,
95 95
                 '<h2>Enter recording token</h2>' +
96 96
                 '<input id="recordingToken" type="text" ' +
97 97
                 'placeholder="token" autofocus>',
@@ -235,11 +235,11 @@ var Toolbar = (function (my) {
235 235
     my.authenticateClicked = function () {
236 236
         Authentication.focusAuthenticationWindow();
237 237
         // Get authentication URL
238
-        xmpp.getAuthUrl(UI.getRoomName(), function (url) {
238
+        APP.xmpp.getAuthUrl(APP.UI.getRoomName(), function (url) {
239 239
             // Open popup with authentication URL
240 240
             var authenticationWindow = Authentication.createAuthenticationWindow(function () {
241 241
                 // On popup closed - retry room allocation
242
-                xmpp.allocateConferenceFocus(UI.getRoomName(), UI.checkForNicknameAndJoin);
242
+                xAPP.mpp.allocateConferenceFocus(APP.UI.getRoomName(), APP.UI.checkForNicknameAndJoin);
243 243
             }, url);
244 244
             if (!authenticationWindow) {
245 245
                 Toolbar.showAuthenticateButton(true);
@@ -281,7 +281,7 @@ var Toolbar = (function (my) {
281 281
      */
282 282
     my.openLockDialog = function () {
283 283
         // Only the focus is able to set a shared key.
284
-        if (!xmpp.isModerator()) {
284
+        if (!APP.xmpp.isModerator()) {
285 285
             if (sharedKey) {
286 286
                 messageHandler.openMessageDialog(null,
287 287
                         "This conversation is currently protected by" +
@@ -488,7 +488,7 @@ var Toolbar = (function (my) {
488 488
 
489 489
     // Shows or hides SIP calls button
490 490
     my.showSipCallButton = function (show) {
491
-        if (xmpp.isSipGatewayEnabled() && show) {
491
+        if (APP.xmpp.isSipGatewayEnabled() && show) {
492 492
             $('#sipCallButton').css({display: "inline"});
493 493
         } else {
494 494
             $('#sipCallButton').css({display: "none"});

+ 2
- 2
modules/UI/toolbars/ToolbarToggler.js Zobrazit soubor

@@ -4,7 +4,7 @@ var toolbarTimeoutObject,
4 4
     toolbarTimeout = interfaceConfig.INITIAL_TOOLBAR_TIMEOUT;
5 5
 
6 6
 function showDesktopSharingButton() {
7
-    if (desktopsharing.isDesktopSharingEnabled()) {
7
+    if (APP.desktopsharing.isDesktopSharingEnabled()) {
8 8
         $('#desktopsharing').css({display: "inline"});
9 9
     } else {
10 10
         $('#desktopsharing').css({display: "none"});
@@ -67,7 +67,7 @@ var ToolbarToggler = {
67 67
             toolbarTimeout = interfaceConfig.TOOLBAR_TIMEOUT;
68 68
         }
69 69
 
70
-        if (xmpp.isModerator())
70
+        if (APP.xmpp.isModerator())
71 71
         {
72 72
 //            TODO: Enable settings functionality.
73 73
 //                  Need to uncomment the settings button in index.html.

+ 2
- 0
modules/UI/util/NicknameHandler.js Zobrazit soubor

@@ -1,3 +1,5 @@
1
+var UIEvents = require("../../../service/UI/UIEvents");
2
+
1 3
 var nickname = null;
2 4
 var eventEmitter = null;
3 5
 

+ 2
- 2
modules/UI/videolayout/ConnectionIndicator.js Zobrazit soubor

@@ -103,7 +103,7 @@ ConnectionIndicator.prototype.generateText = function () {
103 103
         }
104 104
         else if(keys.length > 1)
105 105
         {
106
-            var displayedSsrc = simulcast.getReceivingSSRC(this.jid);
106
+            var displayedSsrc = APP.simulcast.getReceivingSSRC(this.jid);
107 107
             resolutionValue = this.resolution[displayedSsrc];
108 108
         }
109 109
     }
@@ -158,7 +158,7 @@ ConnectionIndicator.prototype.generateText = function () {
158 158
 
159 159
     if(this.videoContainer.id == "localVideoContainer")
160 160
         result += "<div class=\"jitsipopover_showmore\" " +
161
-            "onclick = \"UI.connectionIndicatorShowMore('" +
161
+            "onclick = \"APP.UI.connectionIndicatorShowMore('" +
162 162
             this.videoContainer.id + "')\">" +
163 163
             (this.showMoreValue? "Show less" : "Show More") + "</div><br />";
164 164
 

+ 82
- 84
modules/UI/videolayout/VideoLayout.js Zobrazit soubor

@@ -5,6 +5,8 @@ var ContactList = require("../side_pannels/contactlist/ContactList");
5 5
 var UIUtil = require("../util/UIUtil");
6 6
 var ConnectionIndicator = require("./ConnectionIndicator");
7 7
 var NicknameHandler = require("../util/NicknameHandler");
8
+var MediaStreamType = require("../../../service/RTC/MediaStreamTypes");
9
+var UIEvents = require("../../../service/UI/UIEvents");
8 10
 
9 11
 var currentDominantSpeaker = null;
10 12
 var lastNCount = config.channelLastN;
@@ -61,7 +63,7 @@ function videoactive( videoelem) {
61 63
             (parentResourceJid &&
62 64
                 VideoLayout.getDominantSpeakerResourceJid() === parentResourceJid)) {
63 65
             VideoLayout.updateLargeVideo(
64
-                RTC.getVideoSrc(videoelem[0]),
66
+                APP.RTC.getVideoSrc(videoelem[0]),
65 67
                 1,
66 68
                 parentResourceJid);
67 69
         }
@@ -97,8 +99,8 @@ function waitForRemoteVideo(selector, ssrc, stream, jid) {
97 99
     if (stream.id === 'mixedmslabel') return;
98 100
 
99 101
     if (selector[0].currentTime > 0) {
100
-        var videoStream = simulcast.getReceivingVideoStream(stream);
101
-        RTC.attachMediaStream(selector, videoStream); // FIXME: why do i have to do this for FF?
102
+        var videoStream = APP.simulcast.getReceivingVideoStream(stream);
103
+        APP.RTC.attachMediaStream(selector, videoStream); // FIXME: why do i have to do this for FF?
102 104
         videoactive(selector);
103 105
     } else {
104 106
         setTimeout(function () {
@@ -283,7 +285,7 @@ function getParticipantContainer(resourceJid)
283 285
     if (!resourceJid)
284 286
         return null;
285 287
 
286
-    if (resourceJid === xmpp.myResource())
288
+    if (resourceJid === APP.xmpp.myResource())
287 289
         return $("#localVideoContainer");
288 290
     else
289 291
         return $("#participant_" + resourceJid);
@@ -359,7 +361,7 @@ function addRemoteVideoMenu(jid, parentElement) {
359 361
             event.preventDefault();
360 362
         }
361 363
         var isMute = mutedAudios[jid] == true;
362
-        xmpp.setMute(jid, !isMute);
364
+        APP.xmpp.setMute(jid, !isMute);
363 365
 
364 366
         popupmenuElement.setAttribute('style', 'display:none;');
365 367
 
@@ -382,7 +384,7 @@ function addRemoteVideoMenu(jid, parentElement) {
382 384
     var ejectLinkItem = document.createElement('a');
383 385
     ejectLinkItem.innerHTML = ejectIndicator + ' Kick out';
384 386
     ejectLinkItem.onclick = function(){
385
-        xmpp.eject(jid);
387
+        APP.xmpp.eject(jid);
386 388
         popupmenuElement.setAttribute('style', 'display:none;');
387 389
     };
388 390
 
@@ -519,11 +521,11 @@ var VideoLayout = (function (my) {
519 521
     };
520 522
 
521 523
     my.changeLocalAudio = function(stream) {
522
-        RTC.attachMediaStream($('#localAudio'), stream.getOriginalStream());
524
+        APP.RTC.attachMediaStream($('#localAudio'), stream.getOriginalStream());
523 525
         document.getElementById('localAudio').autoplay = true;
524 526
         document.getElementById('localAudio').volume = 0;
525 527
         if (preMuted) {
526
-            if(!UI.setAudioMuted(true))
528
+            if(!APP.UI.setAudioMuted(true))
527 529
             {
528 530
                 preMuted = mute;
529 531
             }
@@ -537,7 +539,7 @@ var VideoLayout = (function (my) {
537 539
             flipX = false;
538 540
         var localVideo = document.createElement('video');
539 541
         localVideo.id = 'localVideo_' +
540
-            RTC.getStreamID(stream.getOriginalStream());
542
+            APP.RTC.getStreamID(stream.getOriginalStream());
541 543
         localVideo.autoplay = true;
542 544
         localVideo.volume = 0; // is it required if audio is separated ?
543 545
         localVideo.oncontextmenu = function () { return false; };
@@ -556,22 +558,18 @@ var VideoLayout = (function (my) {
556 558
         AudioLevels.updateAudioLevelCanvas(null, VideoLayout);
557 559
 
558 560
         var localVideoSelector = $('#' + localVideo.id);
559
-        // Add click handler to both video and video wrapper elements in case
560
-        // there's no video.
561
-        localVideoSelector.click(function (event) {
562
-            event.stopPropagation();
563
-            VideoLayout.handleVideoThumbClicked(
564
-                RTC.getVideoSrc(localVideo),
565
-                false,
566
-                xmpp.myResource());
567
-        });
568
-        $('#localVideoContainer').click(function (event) {
561
+
562
+        function localVideoClick(event) {
569 563
             event.stopPropagation();
570 564
             VideoLayout.handleVideoThumbClicked(
571
-                RTC.getVideoSrc(localVideo),
565
+                APP.RTC.getVideoSrc(localVideo),
572 566
                 false,
573
-                xmpp.myResource());
574
-        });
567
+                APP.xmpp.myResource());
568
+        }
569
+        // Add click handler to both video and video wrapper elements in case
570
+        // there's no video.
571
+        localVideoSelector.click(localVideoClick);
572
+        $('#localVideoContainer').click(localVideoClick);
575 573
 
576 574
         // Add hover handler
577 575
         $('#localVideoContainer').hover(
@@ -580,14 +578,14 @@ var VideoLayout = (function (my) {
580 578
             },
581 579
             function() {
582 580
                 if (!VideoLayout.isLargeVideoVisible()
583
-                        || RTC.getVideoSrc(localVideo) !== RTC.getVideoSrc($('#largeVideo')[0]))
581
+                        || APP.RTC.getVideoSrc(localVideo) !== APP.RTC.getVideoSrc($('#largeVideo')[0]))
584 582
                     VideoLayout.showDisplayName('localVideoContainer', false);
585 583
             }
586 584
         );
587 585
         // Add stream ended handler
588 586
         stream.getOriginalStream().onended = function () {
589 587
             localVideoContainer.removeChild(localVideo);
590
-            VideoLayout.updateRemovedVideo(RTC.getVideoSrc(localVideo));
588
+            VideoLayout.updateRemovedVideo(APP.RTC.getVideoSrc(localVideo));
591 589
         };
592 590
         // Flip video x axis if needed
593 591
         flipXLocalVideo = flipX;
@@ -595,12 +593,12 @@ var VideoLayout = (function (my) {
595 593
             localVideoSelector.addClass("flipVideoX");
596 594
         }
597 595
         // Attach WebRTC stream
598
-        var videoStream = simulcast.getLocalVideoStream();
599
-        RTC.attachMediaStream(localVideoSelector, videoStream);
596
+        var videoStream = APP.simulcast.getLocalVideoStream();
597
+        APP.RTC.attachMediaStream(localVideoSelector, videoStream);
600 598
 
601
-        localVideoSrc = RTC.getVideoSrc(localVideo);
599
+        localVideoSrc = APP.RTC.getVideoSrc(localVideo);
602 600
 
603
-        var myResourceJid = xmpp.myResource();
601
+        var myResourceJid = APP.xmpp.myResource();
604 602
 
605 603
         VideoLayout.updateLargeVideo(localVideoSrc, 0,
606 604
             myResourceJid);
@@ -613,7 +611,7 @@ var VideoLayout = (function (my) {
613 611
      * @param removedVideoSrc src stream identifier of the video.
614 612
      */
615 613
     my.updateRemovedVideo = function(removedVideoSrc) {
616
-        if (removedVideoSrc === RTC.getVideoSrc($('#largeVideo')[0])) {
614
+        if (removedVideoSrc === APP.RTC.getVideoSrc($('#largeVideo')[0])) {
617 615
             // this is currently displayed as large
618 616
             // pick the last visible video in the row
619 617
             // if nobody else is left, this picks the local video
@@ -625,7 +623,7 @@ var VideoLayout = (function (my) {
625 623
                 console.info("Last visible video no longer exists");
626 624
                 pick = $('#remoteVideos>span[id!="mixedstream"]>video').get(0);
627 625
 
628
-                if (!pick || !RTC.getVideoSrc(pick)) {
626
+                if (!pick || !APP.RTC.getVideoSrc(pick)) {
629 627
                     // Try local video
630 628
                     console.info("Fallback to local video...");
631 629
                     pick = $('#remoteVideos>span>span>video').get(0);
@@ -640,7 +638,7 @@ var VideoLayout = (function (my) {
640 638
                 {
641 639
                     if(container.id == "localVideoWrapper")
642 640
                     {
643
-                        jid = xmpp.myResource();
641
+                        jid = APP.xmpp.myResource();
644 642
                     }
645 643
                     else
646 644
                     {
@@ -648,7 +646,7 @@ var VideoLayout = (function (my) {
648 646
                     }
649 647
                 }
650 648
 
651
-                VideoLayout.updateLargeVideo(RTC.getVideoSrc(pick), pick.volume, jid);
649
+                VideoLayout.updateLargeVideo(APP.RTC.getVideoSrc(pick), pick.volume, jid);
652 650
             } else {
653 651
                 console.warn("Failed to elect large video");
654 652
             }
@@ -703,7 +701,7 @@ var VideoLayout = (function (my) {
703 701
     my.updateLargeVideo = function(newSrc, vol, resourceJid) {
704 702
         console.log('hover in', newSrc);
705 703
 
706
-        if (RTC.getVideoSrc($('#largeVideo')[0]) !== newSrc) {
704
+        if (APP.RTC.getVideoSrc($('#largeVideo')[0]) !== newSrc) {
707 705
 
708 706
             $('#activeSpeaker').css('visibility', 'hidden');
709 707
             // Due to the simulcast the localVideoSrc may have changed when the
@@ -716,7 +714,7 @@ var VideoLayout = (function (my) {
716 714
 
717 715
             largeVideoState.newSrc = newSrc;
718 716
             largeVideoState.isVisible = $('#largeVideo').is(':visible');
719
-            largeVideoState.isDesktop = RTC.isVideoSrcDesktop(resourceJid);
717
+            largeVideoState.isDesktop = APP.RTC.isVideoSrcDesktop(resourceJid);
720 718
             if(largeVideoState.userResourceJid) {
721 719
                 largeVideoState.oldResourceJid = largeVideoState.userResourceJid;
722 720
             } else {
@@ -742,12 +740,12 @@ var VideoLayout = (function (my) {
742 740
                 var doUpdate = function () {
743 741
 
744 742
                     Avatar.updateActiveSpeakerAvatarSrc(
745
-                        xmpp.findJidFromResource(
743
+                        APP.xmpp.findJidFromResource(
746 744
                             largeVideoState.userResourceJid));
747 745
 
748 746
                     if (!userChanged && largeVideoState.preload &&
749 747
                         largeVideoState.preload !== null &&
750
-                        RTC.getVideoSrc($(largeVideoState.preload)[0]) === newSrc)
748
+                        APP.RTC.getVideoSrc($(largeVideoState.preload)[0]) === newSrc)
751 749
                     {
752 750
 
753 751
                         console.info('Switching to preloaded video');
@@ -774,7 +772,7 @@ var VideoLayout = (function (my) {
774 772
                         largeVideoState.preload = null;
775 773
                         largeVideoState.preload_ssrc = 0;
776 774
                     } else {
777
-                        RTC.setVideoSrc($('#largeVideo')[0], largeVideoState.newSrc);
775
+                        APP.RTC.setVideoSrc($('#largeVideo')[0], largeVideoState.newSrc);
778 776
                     }
779 777
 
780 778
                     var videoTransform = document.getElementById('largeVideo')
@@ -822,7 +820,7 @@ var VideoLayout = (function (my) {
822 820
 
823 821
                     if(userChanged) {
824 822
                         Avatar.showUserAvatar(
825
-                            xmpp.findJidFromResource(
823
+                            APP.xmpp.findJidFromResource(
826 824
                                 largeVideoState.oldResourceJid));
827 825
                     }
828 826
 
@@ -837,7 +835,7 @@ var VideoLayout = (function (my) {
837 835
             }
838 836
         } else {
839 837
             Avatar.showUserAvatar(
840
-                xmpp.findJidFromResource(
838
+                APP.xmpp.findJidFromResource(
841 839
                     largeVideoState.userResourceJid));
842 840
         }
843 841
 
@@ -870,7 +868,7 @@ var VideoLayout = (function (my) {
870 868
 
871 869
                 if (dominantSpeakerVideo) {
872 870
                     VideoLayout.updateLargeVideo(
873
-                        RTC.getVideoSrc(dominantSpeakerVideo),
871
+                        APP.RTC.getVideoSrc(dominantSpeakerVideo),
874 872
                         1,
875 873
                         currentDominantSpeaker);
876 874
                 }
@@ -976,7 +974,7 @@ var VideoLayout = (function (my) {
976 974
                 focusedVideoInfo = null;
977 975
                 if(focusResourceJid) {
978 976
                     Avatar.showUserAvatar(
979
-                        xmpp.findJidFromResource(focusResourceJid));
977
+                        APP.xmpp.findJidFromResource(focusResourceJid));
980 978
                 }
981 979
             }
982 980
         }
@@ -1048,7 +1046,7 @@ var VideoLayout = (function (my) {
1048 1046
 
1049 1047
         // If the peerJid is null then this video span couldn't be directly
1050 1048
         // associated with a participant (this could happen in the case of prezi).
1051
-        if (xmpp.isModerator() && peerJid !== null)
1049
+        if (APP.xmpp.isModerator() && peerJid !== null)
1052 1050
             addRemoteVideoMenu(peerJid, container);
1053 1051
 
1054 1052
         remotes.appendChild(container);
@@ -1067,7 +1065,7 @@ var VideoLayout = (function (my) {
1067 1065
                         ? document.createElement('video')
1068 1066
                         : document.createElement('audio');
1069 1067
         var id = (isVideo ? 'remoteVideo_' : 'remoteAudio_')
1070
-                    + sid + '_' + RTC.getStreamID(stream);
1068
+                    + sid + '_' + APP.RTC.getStreamID(stream);
1071 1069
 
1072 1070
         element.id = id;
1073 1071
         element.autoplay = true;
@@ -1094,8 +1092,8 @@ var VideoLayout = (function (my) {
1094 1092
             // If the container is currently visible we attach the stream.
1095 1093
             if (!isVideo
1096 1094
                 || (container.offsetParent !== null && isVideo)) {
1097
-                var videoStream = simulcast.getReceivingVideoStream(stream);
1098
-                RTC.attachMediaStream(sel, videoStream);
1095
+                var videoStream = APP.simulcast.getReceivingVideoStream(stream);
1096
+                APP.RTC.attachMediaStream(sel, videoStream);
1099 1097
 
1100 1098
                 if (isVideo)
1101 1099
                     waitForRemoteVideo(sel, thessrc, stream, peerJid);
@@ -1133,7 +1131,7 @@ var VideoLayout = (function (my) {
1133 1131
                 var videoThumb = $('#' + container.id + '>video').get(0);
1134 1132
                 if (videoThumb) {
1135 1133
                     VideoLayout.handleVideoThumbClicked(
1136
-                        RTC.getVideoSrc(videoThumb),
1134
+                        APP.RTC.getVideoSrc(videoThumb),
1137 1135
                         false,
1138 1136
                         Strophe.getResourceFromJid(peerJid));
1139 1137
                 }
@@ -1152,13 +1150,13 @@ var VideoLayout = (function (my) {
1152 1150
                     var videoSrc = null;
1153 1151
                     if ($('#' + container.id + '>video')
1154 1152
                             && $('#' + container.id + '>video').length > 0) {
1155
-                        videoSrc = RTC.getVideoSrc($('#' + container.id + '>video').get(0));
1153
+                        videoSrc = APP.RTC.getVideoSrc($('#' + container.id + '>video').get(0));
1156 1154
                     }
1157 1155
 
1158 1156
                     // If the video has been "pinned" by the user we want to
1159 1157
                     // keep the display name on place.
1160 1158
                     if (!VideoLayout.isLargeVideoVisible()
1161
-                            || videoSrc !== RTC.getVideoSrc($('#largeVideo')[0]))
1159
+                            || videoSrc !== APP.RTC.getVideoSrc($('#largeVideo')[0]))
1162 1160
                         VideoLayout.showDisplayName(container.id, false);
1163 1161
                 }
1164 1162
             );
@@ -1183,7 +1181,7 @@ var VideoLayout = (function (my) {
1183 1181
         var removedVideoSrc = null;
1184 1182
         if (isVideo) {
1185 1183
             select = $('#' + container.id + '>video');
1186
-            removedVideoSrc = RTC.getVideoSrc(select.get(0));
1184
+            removedVideoSrc = APP.RTC.getVideoSrc(select.get(0));
1187 1185
         }
1188 1186
         else
1189 1187
             select = $('#' + container.id + '>audio');
@@ -1230,16 +1228,16 @@ var VideoLayout = (function (my) {
1230 1228
                 peerContainer.show();
1231 1229
             }
1232 1230
 
1231
+            var jid = APP.xmpp.findJidFromResource(resourceJid);
1233 1232
             if (state == 'show')
1234 1233
             {
1235 1234
                 // peerContainer.css('-webkit-filter', '');
1236
-                var jid = xmpp.findJidFromResource(resourceJid);
1235
+
1237 1236
                 Avatar.showUserAvatar(jid, false);
1238 1237
             }
1239 1238
             else // if (state == 'avatar')
1240 1239
             {
1241 1240
                 // peerContainer.css('-webkit-filter', 'grayscale(100%)');
1242
-                var jid = xmpp.findJidFromResource(resourceJid);
1243 1241
                 Avatar.showUserAvatar(jid, true);
1244 1242
             }
1245 1243
         }
@@ -1330,7 +1328,7 @@ var VideoLayout = (function (my) {
1330 1328
      */
1331 1329
     my.showModeratorIndicator = function () {
1332 1330
 
1333
-        var isModerator = xmpp.isModerator();
1331
+        var isModerator = APP.xmpp.isModerator();
1334 1332
         if (isModerator) {
1335 1333
             var indicatorSpan = $('#localVideoContainer .focusindicator');
1336 1334
 
@@ -1340,7 +1338,7 @@ var VideoLayout = (function (my) {
1340 1338
             }
1341 1339
         }
1342 1340
 
1343
-        var members = xmpp.getMembers();
1341
+        var members = APP.xmpp.getMembers();
1344 1342
 
1345 1343
         Object.keys(members).forEach(function (jid) {
1346 1344
 
@@ -1532,7 +1530,7 @@ var VideoLayout = (function (my) {
1532 1530
         var videoSpanId = null;
1533 1531
         var videoContainerId = null;
1534 1532
         if (resourceJid
1535
-                === xmpp.myResource()) {
1533
+                === APP.xmpp.myResource()) {
1536 1534
             videoSpanId = 'localVideoWrapper';
1537 1535
             videoContainerId = 'localVideoContainer';
1538 1536
         }
@@ -1575,7 +1573,7 @@ var VideoLayout = (function (my) {
1575 1573
             }
1576 1574
 
1577 1575
             Avatar.showUserAvatar(
1578
-                xmpp.findJidFromResource(resourceJid));
1576
+                APP.xmpp.findJidFromResource(resourceJid));
1579 1577
         }
1580 1578
     };
1581 1579
 
@@ -1701,7 +1699,7 @@ var VideoLayout = (function (my) {
1701 1699
                     eventEmitter.emit(UIEvents.PINNED_ENDPOINT,
1702 1700
                         Strophe.getResourceFromJid(jid));
1703 1701
                 }
1704
-            } else if (jid == xmpp.myJid()) {
1702
+            } else if (jid == APP.xmpp.myJid()) {
1705 1703
                 $("#localVideoContainer").click();
1706 1704
             }
1707 1705
         }
@@ -1719,7 +1717,7 @@ var VideoLayout = (function (my) {
1719 1717
             return;
1720 1718
         }*/
1721 1719
         var videoSpanId = null;
1722
-        if (jid === xmpp.myJid()) {
1720
+        if (jid === APP.xmpp.myJid()) {
1723 1721
             videoSpanId = 'localVideoContainer';
1724 1722
         } else {
1725 1723
             VideoLayout.ensurePeerContainerExists(jid);
@@ -1728,7 +1726,7 @@ var VideoLayout = (function (my) {
1728 1726
 
1729 1727
         mutedAudios[jid] = isMuted;
1730 1728
 
1731
-        if (xmpp.isModerator()) {
1729
+        if (APP.xmpp.isModerator()) {
1732 1730
             VideoLayout.updateRemoteVideoMenu(jid, isMuted);
1733 1731
         }
1734 1732
 
@@ -1741,12 +1739,12 @@ var VideoLayout = (function (my) {
1741 1739
      */
1742 1740
     $(document).bind('videomuted.muc', function (event, jid, value) {
1743 1741
         var isMuted = (value === "true");
1744
-        if(!RTC.muteRemoteVideoStream(jid, isMuted))
1742
+        if(!APP.RTC.muteRemoteVideoStream(jid, isMuted))
1745 1743
             return;
1746 1744
 
1747 1745
         Avatar.showUserAvatar(jid, isMuted);
1748 1746
         var videoSpanId = null;
1749
-        if (jid === xmpp.myJid()) {
1747
+        if (jid === APP.xmpp.myJid()) {
1750 1748
             videoSpanId = 'localVideoContainer';
1751 1749
         } else {
1752 1750
             VideoLayout.ensurePeerContainerExists(jid);
@@ -1763,7 +1761,7 @@ var VideoLayout = (function (my) {
1763 1761
     my.onDisplayNameChanged =
1764 1762
                     function (jid, displayName, status) {
1765 1763
         if (jid === 'localVideoContainer'
1766
-            || jid === xmpp.myJid()) {
1764
+            || jid === APP.xmpp.myJid()) {
1767 1765
             setDisplayName('localVideoContainer',
1768 1766
                            displayName);
1769 1767
         } else {
@@ -1782,7 +1780,7 @@ var VideoLayout = (function (my) {
1782 1780
     my.onDominantSpeakerChanged = function (resourceJid) {
1783 1781
         // We ignore local user events.
1784 1782
         if (resourceJid
1785
-                === xmpp.myResource())
1783
+                === APP.xmpp.myResource())
1786 1784
             return;
1787 1785
 
1788 1786
         // Update the current dominant speaker.
@@ -1816,7 +1814,7 @@ var VideoLayout = (function (my) {
1816 1814
             // Update the large video if the video source is already available,
1817 1815
             // otherwise wait for the "videoactive.jingle" event.
1818 1816
             if (video.length && video[0].currentTime > 0)
1819
-                VideoLayout.updateLargeVideo(RTC.getVideoSrc(video[0]), resourceJid);
1817
+                VideoLayout.updateLargeVideo(APP.RTC.getVideoSrc(video[0]), resourceJid);
1820 1818
         }
1821 1819
     };
1822 1820
 
@@ -1911,13 +1909,13 @@ var VideoLayout = (function (my) {
1911 1909
                 if (!isVisible) {
1912 1910
                     console.log("Add to last N", resourceJid);
1913 1911
 
1914
-                    var jid = xmpp.findJidFromResource(resourceJid);
1915
-                    var mediaStream = RTC.remoteStreams[jid][MediaStreamType.VIDEO_TYPE];
1912
+                    var jid = APP.xmpp.findJidFromResource(resourceJid);
1913
+                    var mediaStream = APP.RTC.remoteStreams[jid][MediaStreamType.VIDEO_TYPE];
1916 1914
                     var sel = $('#participant_' + resourceJid + '>video');
1917 1915
 
1918
-                    var videoStream = simulcast.getReceivingVideoStream(
1916
+                    var videoStream = APP.simulcast.getReceivingVideoStream(
1919 1917
                         mediaStream.stream);
1920
-                    RTC.attachMediaStream(sel, videoStream);
1918
+                    APP.RTC.attachMediaStream(sel, videoStream);
1921 1919
                     if (lastNPickupJid == mediaStream.peerjid) {
1922 1920
                         // Clean up the lastN pickup jid.
1923 1921
                         lastNPickupJid = null;
@@ -1944,7 +1942,7 @@ var VideoLayout = (function (my) {
1944 1942
 
1945 1943
             var resource, container, src;
1946 1944
             var myResource
1947
-                = xmpp.myResource();
1945
+                = APP.xmpp.myResource();
1948 1946
 
1949 1947
             // Find out which endpoint to show in the large video.
1950 1948
             for (var i = 0; i < lastNEndpoints.length; i++) {
@@ -1987,16 +1985,16 @@ var VideoLayout = (function (my) {
1987 1985
             var primarySSRC = esl.simulcastLayer.primarySSRC;
1988 1986
 
1989 1987
             // Get session and stream from primary ssrc.
1990
-            var res = simulcast.getReceivingVideoStreamBySSRC(primarySSRC);
1988
+            var res = APP.simulcast.getReceivingVideoStreamBySSRC(primarySSRC);
1991 1989
             var sid = res.sid;
1992 1990
             var electedStream = res.stream;
1993 1991
 
1994 1992
             if (sid && electedStream) {
1995
-                var msid = simulcast.getRemoteVideoStreamIdBySSRC(primarySSRC);
1993
+                var msid = APP.simulcast.getRemoteVideoStreamIdBySSRC(primarySSRC);
1996 1994
 
1997 1995
                 console.info([esl, primarySSRC, msid, sid, electedStream]);
1998 1996
 
1999
-                var preload = (Strophe.getResourceFromJid(xmpp.getJidFromSSRC(primarySSRC)) == largeVideoState.userResourceJid);
1997
+                var preload = (Strophe.getResourceFromJid(APP.xmpp.getJidFromSSRC(primarySSRC)) == largeVideoState.userResourceJid);
2000 1998
 
2001 1999
                 if (preload) {
2002 2000
                     if (largeVideoState.preload)
@@ -2008,7 +2006,7 @@ var VideoLayout = (function (my) {
2008 2006
                     // ssrcs are unique in an rtp session
2009 2007
                     largeVideoState.preload_ssrc = primarySSRC;
2010 2008
 
2011
-                    RTC.attachMediaStream(largeVideoState.preload, electedStream)
2009
+                    APP.RTC.attachMediaStream(largeVideoState.preload, electedStream)
2012 2010
                 }
2013 2011
 
2014 2012
             } else {
@@ -2043,12 +2041,12 @@ var VideoLayout = (function (my) {
2043 2041
             var primarySSRC = esl.simulcastLayer.primarySSRC;
2044 2042
 
2045 2043
             // Get session and stream from primary ssrc.
2046
-            var res = simulcast.getReceivingVideoStreamBySSRC(primarySSRC);
2044
+            var res = APP.simulcast.getReceivingVideoStreamBySSRC(primarySSRC);
2047 2045
             var sid = res.sid;
2048 2046
             var electedStream = res.stream;
2049 2047
 
2050 2048
             if (sid && electedStream) {
2051
-                var msid = simulcast.getRemoteVideoStreamIdBySSRC(primarySSRC);
2049
+                var msid = APP.simulcast.getRemoteVideoStreamIdBySSRC(primarySSRC);
2052 2050
 
2053 2051
                 console.info('Switching simulcast substream.');
2054 2052
                 console.info([esl, primarySSRC, msid, sid, electedStream]);
@@ -2056,15 +2054,15 @@ var VideoLayout = (function (my) {
2056 2054
                 var msidParts = msid.split(' ');
2057 2055
                 var selRemoteVideo = $(['#', 'remoteVideo_', sid, '_', msidParts[0]].join(''));
2058 2056
 
2059
-                var updateLargeVideo = (Strophe.getResourceFromJid(xmpp.getJidFromSSRC(primarySSRC))
2057
+                var updateLargeVideo = (Strophe.getResourceFromJid(APP.xmpp.getJidFromSSRC(primarySSRC))
2060 2058
                     == largeVideoState.userResourceJid);
2061 2059
                 var updateFocusedVideoSrc = (focusedVideoInfo && focusedVideoInfo.src && focusedVideoInfo.src != '' &&
2062
-                    (RTC.getVideoSrc(selRemoteVideo[0]) == focusedVideoInfo.src));
2060
+                    (APP.RTC.getVideoSrc(selRemoteVideo[0]) == focusedVideoInfo.src));
2063 2061
 
2064 2062
                 var electedStreamUrl;
2065 2063
                 if (largeVideoState.preload_ssrc == primarySSRC)
2066 2064
                 {
2067
-                    RTC.setVideoSrc(selRemoteVideo[0], RTC.getVideoSrc(largeVideoState.preload[0]));
2065
+                    APP.RTC.setVideoSrc(selRemoteVideo[0], APP.RTC.getVideoSrc(largeVideoState.preload[0]));
2068 2066
                 }
2069 2067
                 else
2070 2068
                 {
@@ -2075,22 +2073,22 @@ var VideoLayout = (function (my) {
2075 2073
 
2076 2074
                     largeVideoState.preload_ssrc = 0;
2077 2075
 
2078
-                    RTC.attachMediaStream(selRemoteVideo, electedStream);
2076
+                    APP.RTC.attachMediaStream(selRemoteVideo, electedStream);
2079 2077
                 }
2080 2078
 
2081
-                var jid = xmpp.getJidFromSSRC(primarySSRC);
2079
+                var jid = APP.xmpp.getJidFromSSRC(primarySSRC);
2082 2080
 
2083 2081
                 if (updateLargeVideo) {
2084
-                    VideoLayout.updateLargeVideo(RTC.getVideoSrc(selRemoteVideo[0]), null,
2082
+                    VideoLayout.updateLargeVideo(APP.RTC.getVideoSrc(selRemoteVideo[0]), null,
2085 2083
                         Strophe.getResourceFromJid(jid));
2086 2084
                 }
2087 2085
 
2088 2086
                 if (updateFocusedVideoSrc) {
2089
-                    focusedVideoInfo.src = RTC.getVideoSrc(selRemoteVideo[0]);
2087
+                    focusedVideoInfo.src = APP.RTC.getVideoSrc(selRemoteVideo[0]);
2090 2088
                 }
2091 2089
 
2092 2090
                 var videoId;
2093
-                if(resource == xmpp.myResource())
2091
+                if(resource == APP.xmpp.myResource())
2094 2092
                 {
2095 2093
                     videoId = "localVideoContainer";
2096 2094
                 }
@@ -2118,8 +2116,8 @@ var VideoLayout = (function (my) {
2118 2116
         if(object.resolution !== null)
2119 2117
         {
2120 2118
             resolution = object.resolution;
2121
-            object.resolution = resolution[xmpp.myJid()];
2122
-            delete resolution[xmpp.myJid()];
2119
+            object.resolution = resolution[APP.xmpp.myJid()];
2120
+            delete resolution[APP.xmpp.myJid()];
2123 2121
         }
2124 2122
         updateStatsIndicator("localVideoContainer", percent, object);
2125 2123
         for(var jid in resolution)

+ 6
- 4
modules/connectionquality/connectionquality.js Zobrazit soubor

@@ -1,5 +1,7 @@
1 1
 var EventEmitter = require("events");
2 2
 var eventEmitter = new EventEmitter();
3
+var CQEvents = require("../../service/connectionquality/CQEvents");
4
+var XMPPEvents = require("../../service/xmpp/XMPPEvents");
3 5
 
4 6
 /**
5 7
  * local stats
@@ -32,7 +34,7 @@ function startSendingStats() {
32 34
  * Sends statistics to other participants
33 35
  */
34 36
 function sendStats() {
35
-    xmpp.addToPresence("connectionQuality", convertToMUCStats(stats));
37
+    APP.xmpp.addToPresence("connectionQuality", convertToMUCStats(stats));
36 38
 }
37 39
 
38 40
 /**
@@ -72,9 +74,9 @@ function parseMUCStats(stats) {
72 74
 
73 75
 var ConnectionQuality = {
74 76
     init: function () {
75
-        xmpp.addListener(XMPPEvents.REMOTE_STATS, this.updateRemoteStats);
76
-        statistics.addConnectionStatsListener(this.updateLocalStats);
77
-        statistics.addRemoteStatsStopListener(this.stopSendingStats);
77
+        APP.xmpp.addListener(XMPPEvents.REMOTE_STATS, this.updateRemoteStats);
78
+        APP.statistics.addConnectionStatsListener(this.updateLocalStats);
79
+        APP.statistics.addRemoteStatsStopListener(this.stopSendingStats);
78 80
 
79 81
     },
80 82
 

+ 7
- 5
modules/desktopsharing/desktopsharing.js Zobrazit soubor

@@ -27,12 +27,14 @@ var EventEmitter = require("events");
27 27
 
28 28
 var eventEmitter = new EventEmitter();
29 29
 
30
+var DesktopSharingEventTypes = require("../../service/desktopsharing/DesktopSharingEventTypes");
31
+
30 32
 /**
31 33
  * Method obtains desktop stream from WebRTC 'screen' source.
32 34
  * Flag 'chrome://flags/#enable-usermedia-screen-capture' must be enabled.
33 35
  */
34 36
 function obtainWebRTCScreen(streamCallback, failCallback) {
35
-    RTC.getUserMediaWithConstraints(
37
+    APP.RTC.getUserMediaWithConstraints(
36 38
         ['screen'],
37 39
         streamCallback,
38 40
         failCallback
@@ -90,7 +92,7 @@ function isUpdateRequired(minVersion, extVersion)
90 92
     catch (e)
91 93
     {
92 94
         console.error("Failed to parse extension version", e);
93
-        UI.messageHandler.showError('Error',
95
+        APP.UI.messageHandler.showError('Error',
94 96
             'Error when trying to detect desktopsharing extension.');
95 97
         return true;
96 98
     }
@@ -139,7 +141,7 @@ function doGetStreamFromExtension(streamCallback, failCallback) {
139 141
             }
140 142
             console.log("Response from extension: " + response);
141 143
             if (response.streamId) {
142
-                RTC.getUserMediaWithConstraints(
144
+                APP.RTC.getUserMediaWithConstraints(
143 145
                     ['desktop'],
144 146
                     function (stream) {
145 147
                         streamCallback(stream);
@@ -172,7 +174,7 @@ function obtainScreenFromExtension(streamCallback, failCallback) {
172 174
                     function (arg) {
173 175
                         console.log("Failed to install the extension", arg);
174 176
                         failCallback(arg);
175
-                        UI.messageHandler.showError('Error',
177
+                        APP.UI.messageHandler.showError('Error',
176 178
                             'Failed to install desktop sharing extension');
177 179
                     }
178 180
                 );
@@ -306,7 +308,7 @@ module.exports = {
306 308
                 getSwitchStreamFailed);
307 309
         } else {
308 310
             // Disable screen stream
309
-            RTC.getUserMediaWithConstraints(
311
+            APP.RTC.getUserMediaWithConstraints(
310 312
                 ['video'],
311 313
                 function (stream) {
312 314
                     // We are now using camera stream

+ 10
- 10
modules/keyboardshortcut/keyboardshortcut.js Zobrazit soubor

@@ -3,30 +3,30 @@ var shortcuts = {
3 3
     67: {
4 4
         character: "C",
5 5
         id: "toggleChatPopover",
6
-        function: UI.toggleChat
6
+        function: APP.UI.toggleChat
7 7
     },
8 8
     70: {
9 9
         character: "F",
10 10
         id: "filmstripPopover",
11
-        function: UI.toggleFilmStrip
11
+        function: APP.UI.toggleFilmStrip
12 12
     },
13 13
     77: {
14 14
         character: "M",
15 15
         id: "mutePopover",
16
-        function: UI.toggleAudio
16
+        function: APP.UI.toggleAudio
17 17
     },
18 18
     84: {
19 19
         character: "T",
20 20
         function: function() {
21
-            if(!RTC.localAudio.isMuted()) {
22
-                UI.toggleAudio();
21
+            if(!APP.RTC.localAudio.isMuted()) {
22
+                APP.UI.toggleAudio();
23 23
             }
24 24
         }
25 25
     },
26 26
     86: {
27 27
         character: "V",
28 28
         id: "toggleVideoPopover",
29
-        function: UI.toggleVideo
29
+        function: APP.UI.toggleVideo
30 30
     }
31 31
 };
32 32
 
@@ -43,11 +43,11 @@ var KeyboardShortcut = {
43 43
                 }
44 44
                 else if (keycode >= "0".charCodeAt(0) &&
45 45
                     keycode <= "9".charCodeAt(0)) {
46
-                    UI.clickOnVideo(keycode - "0".charCodeAt(0) + 1);
46
+                    APP.UI.clickOnVideo(keycode - "0".charCodeAt(0) + 1);
47 47
                 }
48 48
                 //esc while the smileys are visible hides them
49 49
             } else if (keycode === 27 && $('#smileysContainer').is(':visible')) {
50
-                UI.toggleSmileys();
50
+                APP.UI.toggleSmileys();
51 51
             }
52 52
         };
53 53
 
@@ -56,8 +56,8 @@ var KeyboardShortcut = {
56 56
                 $(":focus").is("input[type=password]") ||
57 57
                 $(":focus").is("textarea"))) {
58 58
                 if(e.which === "T".charCodeAt(0)) {
59
-                    if(RTC.localAudio.isMuted()) {
60
-                        UI.toggleAudio();
59
+                    if(APP.RTC.localAudio.isMuted()) {
60
+                        APP.UI.toggleAudio();
61 61
                     }
62 62
                 }
63 63
             }

+ 6
- 5
modules/simulcast/SimulcastReceiver.js Zobrazit soubor

@@ -1,5 +1,6 @@
1 1
 var SimulcastLogger = require("./SimulcastLogger");
2 2
 var SimulcastUtils = require("./SimulcastUtils");
3
+var MediaStreamType = require("../../service/RTC/MediaStreamTypes");
3 4
 
4 5
 function SimulcastReceiver() {
5 6
     this.simulcastUtils = new SimulcastUtils();
@@ -161,7 +162,7 @@ SimulcastReceiver.prototype.getReceivingSSRC = function (jid) {
161 162
     // low quality (that the sender always streams).
162 163
     if(!ssrc)
163 164
     {
164
-        var remoteStreamObject = RTC.remoteStreams[jid][MediaStreamType.VIDEO_TYPE];
165
+        var remoteStreamObject = APP.RTC.remoteStreams[jid][MediaStreamType.VIDEO_TYPE];
165 166
         var remoteStream = remoteStreamObject.getOriginalStream();
166 167
         var tracks = remoteStream.getVideoTracks();
167 168
         if (tracks) {
@@ -184,10 +185,10 @@ SimulcastReceiver.prototype.getReceivingVideoStreamBySSRC = function (ssrc)
184 185
 {
185 186
     var sid, electedStream;
186 187
     var i, j, k;
187
-    var jid = xmpp.getJidFromSSRC(ssrc);
188
-    if(jid && RTC.remoteStreams[jid])
188
+    var jid = APP.xmpp.getJidFromSSRC(ssrc);
189
+    if(jid && APP.RTC.remoteStreams[jid])
189 190
     {
190
-        var remoteStreamObject = RTC.remoteStreams[jid][MediaStreamType.VIDEO_TYPE];
191
+        var remoteStreamObject = APP.RTC.remoteStreams[jid][MediaStreamType.VIDEO_TYPE];
191 192
         var remoteStream = remoteStreamObject.getOriginalStream();
192 193
         var tracks = remoteStream.getVideoTracks();
193 194
         if (tracks) {
@@ -207,7 +208,7 @@ SimulcastReceiver.prototype.getReceivingVideoStreamBySSRC = function (ssrc)
207 208
     }
208 209
     else
209 210
     {
210
-        console.debug(RTC.remoteStreams, jid, ssrc);
211
+        console.debug(APP.RTC.remoteStreams, jid, ssrc);
211 212
     }
212 213
 
213 214
     return {

+ 2
- 2
modules/simulcast/SimulcastSender.js Zobrazit soubor

@@ -32,7 +32,7 @@ SimulcastSender.prototype.getLocalVideoStream = function () {
32 32
     return (this.displayedLocalVideoStream != null)
33 33
         ? this.displayedLocalVideoStream
34 34
         // in case we have no simulcast at all, i.e. we didn't perform the GUM
35
-        : RTC.localVideo.getOriginalStream();
35
+        : APP.RTC.localVideo.getOriginalStream();
36 36
 };
37 37
 
38 38
 function NativeSimulcastSender() {
@@ -47,7 +47,7 @@ NativeSimulcastSender.prototype._localVideoSourceCache = '';
47 47
 
48 48
 NativeSimulcastSender.prototype.reset = function () {
49 49
     this._localExplosionMap = {};
50
-    this._isUsingScreenStream = desktopsharing.isUsingScreenStream();
50
+    this._isUsingScreenStream = APP.desktopsharing.isUsingScreenStream();
51 51
 };
52 52
 
53 53
 NativeSimulcastSender.prototype._cacheLocalVideoSources = function (lines) {

+ 4
- 3
modules/simulcast/simulcast.js Zobrazit soubor

@@ -6,6 +6,7 @@ var NoSimulcastSender = SimulcastSender["no"];
6 6
 var NativeSimulcastSender = SimulcastSender["native"];
7 7
 var SimulcastReceiver = require("./SimulcastReceiver");
8 8
 var SimulcastUtils = require("./SimulcastUtils");
9
+var RTCEvents = require("../../service/RTC/RTCEvents");
9 10
 
10 11
 
11 12
 /**
@@ -46,18 +47,18 @@ function SimulcastManager() {
46 47
         }
47 48
 
48 49
     }
49
-    RTC.addListener(RTCEvents.SIMULCAST_LAYER_CHANGED,
50
+    APP.RTC.addListener(RTCEvents.SIMULCAST_LAYER_CHANGED,
50 51
         function (endpointSimulcastLayers) {
51 52
             endpointSimulcastLayers.forEach(function (esl) {
52 53
                 var ssrc = esl.simulcastLayer.primarySSRC;
53 54
                 simulcast._setReceivingVideoStream(esl.endpoint, ssrc);
54 55
             });
55 56
         });
56
-    RTC.addListener(RTCEvents.SIMULCAST_START, function (simulcastLayer) {
57
+    APP.RTC.addListener(RTCEvents.SIMULCAST_START, function (simulcastLayer) {
57 58
         var ssrc = simulcastLayer.primarySSRC;
58 59
         simulcast._setLocalVideoStreamEnabled(ssrc, true);
59 60
     });
60
-    RTC.addListener(RTCEvents.SIMULCAST_STOP, function (simulcastLayer) {
61
+    APP.RTC.addListener(RTCEvents.SIMULCAST_STOP, function (simulcastLayer) {
61 62
         var ssrc = simulcastLayer.primarySSRC;
62 63
         simulcast._setLocalVideoStreamEnabled(ssrc, false);
63 64
     });

+ 10
- 7
modules/statistics/RTPStatsCollector.js Zobrazit soubor

@@ -1,5 +1,8 @@
1 1
 /* global ssrc2jid */
2 2
 /* jshint -W117 */
3
+var RTCBrowserType = require("../../service/RTC/RTCBrowserType");
4
+
5
+
3 6
 /**
4 7
  * Calculates packet lost percent using the number of lost packets and the
5 8
  * number of all packet.
@@ -14,10 +17,10 @@ function calculatePacketLoss(lostPackets, totalPackets) {
14 17
 }
15 18
 
16 19
 function getStatValue(item, name) {
17
-    if(!keyMap[RTC.getBrowserType()][name])
20
+    if(!keyMap[APP.RTC.getBrowserType()][name])
18 21
         throw "The property isn't supported!";
19
-    var key = keyMap[RTC.getBrowserType()][name];
20
-    return RTC.getBrowserType() == RTCBrowserType.RTC_BROWSER_CHROME? item.stat(key) : item[key];
22
+    var key = keyMap[APP.RTC.getBrowserType()][name];
23
+    return APP.RTC.getBrowserType() == RTCBrowserType.RTC_BROWSER_CHROME? item.stat(key) : item[key];
21 24
 }
22 25
 
23 26
 /**
@@ -330,7 +333,7 @@ StatsCollector.prototype.addStatsToBeLogged = function (reports) {
330 333
 
331 334
 StatsCollector.prototype.logStats = function () {
332 335
 
333
-    if(!xmpp.sendLogs(this.statsToBeLogged))
336
+    if(!APP.xmpp.sendLogs(this.statsToBeLogged))
334 337
         return;
335 338
     // Reset the stats
336 339
     this.statsToBeLogged.stats = {};
@@ -444,7 +447,7 @@ StatsCollector.prototype.processStatsReport = function () {
444 447
         var ssrc = getStatValue(now, 'ssrc');
445 448
         if(!ssrc)
446 449
             continue;
447
-        var jid = xmpp.getJidFromSSRC(ssrc);
450
+        var jid = APP.xmpp.getJidFromSSRC(ssrc);
448 451
         if (!jid && (Date.now() - now.timestamp) < 3000) {
449 452
             console.warn("No jid for ssrc: " + ssrc);
450 453
             continue;
@@ -645,7 +648,7 @@ StatsCollector.prototype.processAudioLevelReport = function ()
645 648
         }
646 649
 
647 650
         var ssrc = getStatValue(now, 'ssrc');
648
-        var jid = xmpp.getJidFromSSRC(ssrc);
651
+        var jid = APP.xmpp.getJidFromSSRC(ssrc);
649 652
         if (!jid && (Date.now() - now.timestamp) < 3000)
650 653
         {
651 654
             console.warn("No jid for ssrc: " + ssrc);
@@ -679,7 +682,7 @@ StatsCollector.prototype.processAudioLevelReport = function ()
679 682
             // but it seems to vary between 0 and around 32k.
680 683
             audioLevel = audioLevel / 32767;
681 684
             jidStats.setSsrcAudioLevel(ssrc, audioLevel);
682
-            if(jid != xmpp.myJid())
685
+            if(jid != APP.xmpp.myJid())
683 686
                 this.eventEmitter.emit("statistics.audioLevel", jid, audioLevel);
684 687
         }
685 688
 

+ 5
- 7
modules/statistics/statistics.js Zobrazit soubor

@@ -4,10 +4,8 @@
4 4
 var LocalStats = require("./LocalStatsCollector.js");
5 5
 var RTPStats = require("./RTPStatsCollector.js");
6 6
 var EventEmitter = require("events");
7
-//These lines should be uncommented when require works in app.js
8
-//var StreamEventTypes = require("../../service/RTC/StreamEventTypes.js");
9
-//var RTCBrowserType = require("../../service/RTC/RTCBrowserType");
10
-//var XMPPEvents = require("../service/xmpp/XMPPEvents");
7
+var StreamEventTypes = require("../../service/RTC/StreamEventTypes.js");
8
+var XMPPEvents = require("../../service/xmpp/XMPPEvents");
11 9
 
12 10
 var eventEmitter = new EventEmitter();
13 11
 
@@ -122,10 +120,10 @@ var statistics =
122 120
     },
123 121
 
124 122
     start: function () {
125
-        RTC.addStreamListener(onStreamCreated,
123
+        APP.RTC.addStreamListener(onStreamCreated,
126 124
             StreamEventTypes.EVENT_TYPE_LOCAL_CREATED);
127
-        xmpp.addListener(XMPPEvents.DISPOSE_CONFERENCE, onDisposeConference);
128
-        xmpp.addListener(XMPPEvents.CALL_INCOMING, function (event) {
125
+        APP.xmpp.addListener(XMPPEvents.DISPOSE_CONFERENCE, onDisposeConference);
126
+        APP.xmpp.addListener(XMPPEvents.CALL_INCOMING, function (event) {
129 127
             startRemoteStats(event.peerconnection);
130 128
         });
131 129
     }

+ 13
- 12
modules/xmpp/JingleSession.js Zobrazit soubor

@@ -3,6 +3,7 @@ var TraceablePeerConnection = require("./TraceablePeerConnection");
3 3
 var SDPDiffer = require("./SDPDiffer");
4 4
 var SDPUtil = require("./SDPUtil");
5 5
 var SDP = require("./SDP");
6
+var RTCBrowserType = require("../../service/RTC/RTCBrowserType");
6 7
 
7 8
 // Jingle stuff
8 9
 function JingleSession(me, sid, connection, service) {
@@ -105,7 +106,7 @@ JingleSession.prototype.initiate = function (peerjid, isInitiator) {
105 106
         onIceConnectionStateChange(self.sid, self);
106 107
     };
107 108
     // add any local and relayed stream
108
-    RTC.localStreams.forEach(function(stream) {
109
+    APP.RTC.localStreams.forEach(function(stream) {
109 110
         self.peerconnection.addStream(stream.getOriginalStream());
110 111
     });
111 112
     this.relayedStreams.forEach(function(stream) {
@@ -176,7 +177,7 @@ JingleSession.prototype.accept = function () {
176 177
         // FIXME: change any inactive to sendrecv or whatever they were originally
177 178
         pranswer.sdp = pranswer.sdp.replace('a=inactive', 'a=sendrecv');
178 179
     }
179
-    pranswer = simulcast.reverseTransformLocalDescription(pranswer);
180
+    pranswer = APP.simulcast.reverseTransformLocalDescription(pranswer);
180 181
     var prsdp = new SDP(pranswer.sdp);
181 182
     var accept = $iq({to: this.peerjid,
182 183
         type: 'set'})
@@ -629,7 +630,7 @@ JingleSession.prototype.createdAnswer = function (sdp, provisional) {
629 630
                         initiator: self.initiator,
630 631
                         responder: self.responder,
631 632
                         sid: self.sid });
632
-                var publicLocalDesc = simulcast.reverseTransformLocalDescription(sdp);
633
+                var publicLocalDesc = APP.simulcast.reverseTransformLocalDescription(sdp);
633 634
                 var publicLocalSDP = new SDP(publicLocalDesc.sdp);
634 635
                 publicLocalSDP.toJingle(accept, self.initiator == self.me ? 'initiator' : 'responder', ssrcs);
635 636
                 self.connection.sendIQ(accept,
@@ -1126,7 +1127,7 @@ JingleSession.prototype.setVideoMute = function (mute, callback, options) {
1126 1127
             successCallback();
1127 1128
         }
1128 1129
     } else {
1129
-        RTC.localVideo.setMute(!mute);
1130
+        APP.RTC.localVideo.setMute(!mute);
1130 1131
 
1131 1132
         this.hardMuteVideo(mute);
1132 1133
 
@@ -1137,7 +1138,7 @@ JingleSession.prototype.setVideoMute = function (mute, callback, options) {
1137 1138
 // SDP-based mute by going recvonly/sendrecv
1138 1139
 // FIXME: should probably black out the screen as well
1139 1140
 JingleSession.prototype.toggleVideoMute = function (callback) {
1140
-    this.service.setVideoMute(RTC.localVideo.isMuted(), callback);
1141
+    this.service.setVideoMute(APP.RTC.localVideo.isMuted(), callback);
1141 1142
 };
1142 1143
 
1143 1144
 JingleSession.prototype.hardMuteVideo = function (muted) {
@@ -1224,15 +1225,15 @@ JingleSession.onJingleError = function (session, error)
1224 1225
 JingleSession.onJingleFatalError = function (session, error)
1225 1226
 {
1226 1227
     this.service.sessionTerminated = true;
1227
-    connection.emuc.doLeave();
1228
-    UI.messageHandler.showError(  "Sorry",
1228
+    this.connection.emuc.doLeave();
1229
+    APP.UI.messageHandler.showError(  "Sorry",
1229 1230
         "Internal application error[setRemoteDescription]");
1230 1231
 }
1231 1232
 
1232 1233
 JingleSession.prototype.setLocalDescription = function () {
1233 1234
     // put our ssrcs into presence so other clients can identify our stream
1234 1235
     var newssrcs = [];
1235
-    var media = simulcast.parseMedia(this.peerconnection.localDescription);
1236
+    var media = APP.simulcast.parseMedia(this.peerconnection.localDescription);
1236 1237
     media.forEach(function (media) {
1237 1238
 
1238 1239
         if(Object.keys(media.sources).length > 0) {
@@ -1264,7 +1265,7 @@ JingleSession.prototype.setLocalDescription = function () {
1264 1265
     if (newssrcs.length > 0) {
1265 1266
         for (var i = 1; i <= newssrcs.length; i ++) {
1266 1267
             // Change video type to screen
1267
-            if (newssrcs[i-1].type === 'video' && desktopsharing.isUsingScreenStream()) {
1268
+            if (newssrcs[i-1].type === 'video' && APP.desktopsharing.isUsingScreenStream()) {
1268 1269
                 newssrcs[i-1].type = 'screen';
1269 1270
             }
1270 1271
             this.connection.emuc.addMediaToPresence(i,
@@ -1356,7 +1357,7 @@ JingleSession.prototype.remoteStreamAdded = function (data) {
1356 1357
     }
1357 1358
 
1358 1359
     //TODO: this code should be removed when firefox implement multistream support
1359
-    if(RTC.getBrowserType() == RTCBrowserType.RTC_BROWSER_FIREFOX)
1360
+    if(APP.RTC.getBrowserType() == RTCBrowserType.RTC_BROWSER_FIREFOX)
1360 1361
     {
1361 1362
         if((JingleSession.notReceivedSSRCs.length == 0) ||
1362 1363
             !ssrc2jid[JingleSession.notReceivedSSRCs[JingleSession.notReceivedSSRCs.length - 1]])
@@ -1376,14 +1377,14 @@ JingleSession.prototype.remoteStreamAdded = function (data) {
1376 1377
         }
1377 1378
     }
1378 1379
 
1379
-    RTC.createRemoteStream(data, this.sid, thessrc);
1380
+    APP.RTC.createRemoteStream(data, this.sid, thessrc);
1380 1381
 
1381 1382
     var isVideo = data.stream.getVideoTracks().length > 0;
1382 1383
     // an attempt to work around https://github.com/jitsi/jitmeet/issues/32
1383 1384
     if (isVideo &&
1384 1385
         data.peerjid && this.peerjid === data.peerjid &&
1385 1386
         data.stream.getVideoTracks().length === 0 &&
1386
-        RTC.localVideo.getTracks().length > 0) {
1387
+        APP.RTC.localVideo.getTracks().length > 0) {
1387 1388
         window.setTimeout(function () {
1388 1389
             sendKeyframe(self.peerconnection);
1389 1390
         }, 3000);

+ 2
- 2
modules/xmpp/SDP.js Zobrazit soubor

@@ -235,11 +235,11 @@ SDP.prototype.toJingle = function (elem, thecreator, ssrcs) {
235 235
                     var msid = null;
236 236
                     if(mline.media == "audio")
237 237
                     {
238
-                        msid = RTC.localAudio.getId();
238
+                        msid = APP.RTC.localAudio.getId();
239 239
                     }
240 240
                     else
241 241
                     {
242
-                        msid = RTC.localVideo.getId();
242
+                        msid = APP.RTC.localVideo.getId();
243 243
                     }
244 244
                     if(msid != null)
245 245
                     {

+ 7
- 7
modules/xmpp/TraceablePeerConnection.js Zobrazit soubor

@@ -105,18 +105,18 @@ if (TraceablePeerConnection.prototype.__defineGetter__ !== undefined) {
105 105
     TraceablePeerConnection.prototype.__defineGetter__('signalingState', function() { return this.peerconnection.signalingState; });
106 106
     TraceablePeerConnection.prototype.__defineGetter__('iceConnectionState', function() { return this.peerconnection.iceConnectionState; });
107 107
     TraceablePeerConnection.prototype.__defineGetter__('localDescription', function() {
108
-        var publicLocalDescription = simulcast.reverseTransformLocalDescription(this.peerconnection.localDescription);
108
+        var publicLocalDescription = APP.simulcast.reverseTransformLocalDescription(this.peerconnection.localDescription);
109 109
         return publicLocalDescription;
110 110
     });
111 111
     TraceablePeerConnection.prototype.__defineGetter__('remoteDescription', function() {
112
-        var publicRemoteDescription = simulcast.reverseTransformRemoteDescription(this.peerconnection.remoteDescription);
112
+        var publicRemoteDescription = APP.simulcast.reverseTransformRemoteDescription(this.peerconnection.remoteDescription);
113 113
         return publicRemoteDescription;
114 114
     });
115 115
 }
116 116
 
117 117
 TraceablePeerConnection.prototype.addStream = function (stream) {
118 118
     this.trace('addStream', stream.id);
119
-    simulcast.resetSender();
119
+    APP.simulcast.resetSender();
120 120
     try
121 121
     {
122 122
         this.peerconnection.addStream(stream);
@@ -130,7 +130,7 @@ TraceablePeerConnection.prototype.addStream = function (stream) {
130 130
 
131 131
 TraceablePeerConnection.prototype.removeStream = function (stream, stopStreams) {
132 132
     this.trace('removeStream', stream.id);
133
-    simulcast.resetSender();
133
+    APP.simulcast.resetSender();
134 134
     if(stopStreams) {
135 135
         stream.getAudioTracks().forEach(function (track) {
136 136
             track.stop();
@@ -149,7 +149,7 @@ TraceablePeerConnection.prototype.createDataChannel = function (label, opts) {
149 149
 
150 150
 TraceablePeerConnection.prototype.setLocalDescription = function (description, successCallback, failureCallback) {
151 151
     var self = this;
152
-    description = simulcast.transformLocalDescription(description);
152
+    description = APP.simulcast.transformLocalDescription(description);
153 153
     this.trace('setLocalDescription', dumpSDP(description));
154 154
     this.peerconnection.setLocalDescription(description,
155 155
         function () {
@@ -170,7 +170,7 @@ TraceablePeerConnection.prototype.setLocalDescription = function (description, s
170 170
 
171 171
 TraceablePeerConnection.prototype.setRemoteDescription = function (description, successCallback, failureCallback) {
172 172
     var self = this;
173
-    description = simulcast.transformRemoteDescription(description);
173
+    description = APP.simulcast.transformRemoteDescription(description);
174 174
     this.trace('setRemoteDescription', dumpSDP(description));
175 175
     this.peerconnection.setRemoteDescription(description,
176 176
         function () {
@@ -219,7 +219,7 @@ TraceablePeerConnection.prototype.createAnswer = function (successCallback, fail
219 219
     this.trace('createAnswer', JSON.stringify(constraints, null, ' '));
220 220
     this.peerconnection.createAnswer(
221 221
         function (answer) {
222
-            answer = simulcast.transformAnswer(answer);
222
+            answer = APP.simulcast.transformAnswer(answer);
223 223
             self.trace('createAnswerOnSuccess', dumpSDP(answer));
224 224
             successCallback(answer);
225 225
         },

+ 4
- 1
modules/xmpp/moderator.js Zobrazit soubor

@@ -1,11 +1,14 @@
1 1
 /* global $, $iq, config, connection, UI, messageHandler,
2 2
  roomName, sessionTerminated, Strophe, Util */
3
+var XMPPEvents = require("../../service/xmpp/XMPPEvents");
4
+
3 5
 /**
4 6
  * Contains logic responsible for enabling/disabling functionality available
5 7
  * only to moderator users.
6 8
  */
7 9
 var connection = null;
8 10
 var focusUserJid;
11
+
9 12
 function createExpBackoffTimer(step) {
10 13
     var count = 1;
11 14
     return function (reset) {
@@ -228,7 +231,7 @@ var Moderator = {
228 231
                 var waitMs = getNextErrorTimeout();
229 232
                 console.error("Focus error, retry after " + waitMs, error);
230 233
                 // Show message
231
-                UI.messageHandler.notify(
234
+                APP.UI.messageHandler.notify(
232 235
                     'Conference focus', 'disconnected',
233 236
                         Moderator.getFocusComponent() +
234 237
                         ' not available - retry in ' +

+ 6
- 6
modules/xmpp/strophe.emuc.js Zobrazit soubor

@@ -2,12 +2,12 @@
2 2
 /* a simple MUC connection plugin
3 3
  * can only handle a single MUC room
4 4
  */
5
-
6
-var bridgeIsDown = false;
7
-
5
+var XMPPEvents = require("../../service/xmpp/XMPPEvents");
8 6
 var Moderator = require("./moderator");
9 7
 var JingleSession = require("./JingleSession");
10 8
 
9
+var bridgeIsDown = false;
10
+
11 11
 module.exports = function(XMPP, eventEmitter) {
12 12
     Strophe.addConnectionPlugin('emuc', {
13 13
         connection: null,
@@ -272,20 +272,20 @@ module.exports = function(XMPP, eventEmitter) {
272 272
                     // We're either missing Jicofo/Prosody config for anonymous
273 273
                     // domains or something is wrong.
274 274
 //                    XMPP.promptLogin();
275
-                    UI.messageHandler.openReportDialog(null,
275
+                    APP.UI.messageHandler.openReportDialog(null,
276 276
                         'Oops ! We couldn`t join the conference.' +
277 277
                         ' There might be some problem with security' +
278 278
                         ' configuration. Please contact service' +
279 279
                         ' administrator.', pres);
280 280
                 } else {
281 281
                     console.warn('onPresError ', pres);
282
-                    UI.messageHandler.openReportDialog(null,
282
+                    APP.UI.messageHandler.openReportDialog(null,
283 283
                         'Oops! Something went wrong and we couldn`t connect to the conference.',
284 284
                         pres);
285 285
                 }
286 286
             } else {
287 287
                 console.warn('onPresError ', pres);
288
-                UI.messageHandler.openReportDialog(null,
288
+                APP.UI.messageHandler.openReportDialog(null,
289 289
                     'Oops! Something went wrong and we couldn`t connect to the conference.',
290 290
                     pres);
291 291
             }

+ 2
- 0
modules/xmpp/strophe.jingle.js Zobrazit soubor

@@ -1,6 +1,8 @@
1 1
 /* jshint -W117 */
2 2
 
3 3
 var JingleSession = require("./JingleSession");
4
+var XMPPEvents = require("../../service/xmpp/XMPPEvents");
5
+
4 6
 
5 7
 module.exports = function(XMPP, eventEmitter)
6 8
 {

+ 1
- 1
modules/xmpp/strophe.moderate.js Zobrazit soubor

@@ -44,7 +44,7 @@ module.exports = function (XMPP) {
44 44
             var mute = $(iq).find('mute');
45 45
             if (mute.length) {
46 46
                 var doMuteAudio = mute.text() === "true";
47
-                UI.setAudioMuted(doMuteAudio);
47
+                APP.UI.setAudioMuted(doMuteAudio);
48 48
                 XMPP.forceMuted = doMuteAudio;
49 49
             }
50 50
             return true;

+ 25
- 23
modules/xmpp/xmpp.js Zobrazit soubor

@@ -3,6 +3,9 @@ var EventEmitter = require("events");
3 3
 var Recording = require("./recording");
4 4
 var SDP = require("./SDP");
5 5
 var Pako = require("pako");
6
+var StreamEventTypes = require("../../service/RTC/StreamEventTypes");
7
+var UIEvents = require("../../service/UI/UIEvents");
8
+var XMPPEvents = require("../../service/xmpp/XMPPEvents");
6 9
 
7 10
 var eventEmitter = new EventEmitter();
8 11
 var connection = null;
@@ -14,13 +17,12 @@ function connect(jid, password, uiCredentials) {
14 17
     connection = new Strophe.Connection(bosh);
15 18
     Moderator.setConnection(connection);
16 19
 
17
-    var settings = UI.getSettings();
18
-    var email = settings.email;
19
-    var displayName = settings.displayName;
20
+    var email = uiCredentials.email;
21
+    var displayName = uiCredentials.displayName;
20 22
     if(email) {
21 23
         connection.emuc.addEmailToPresence(email);
22 24
     } else {
23
-        connection.emuc.addUserIdToPresence(settings.uid);
25
+        connection.emuc.addUserIdToPresence(uiCredentials.uid);
24 26
     }
25 27
     if(displayName) {
26 28
         connection.emuc.addDisplayNameToPresence(displayName);
@@ -29,7 +31,7 @@ function connect(jid, password, uiCredentials) {
29 31
     if (connection.disco) {
30 32
         // for chrome, add multistream cap
31 33
     }
32
-    connection.jingle.pc_constraints = RTC.getPCConstraints();
34
+    connection.jingle.pc_constraints = APP.RTC.getPCConstraints();
33 35
     if (config.useIPv6) {
34 36
         // https://code.google.com/p/webrtc/issues/detail?id=2828
35 37
         if (!connection.jingle.pc_constraints.optional)
@@ -48,7 +50,7 @@ function connect(jid, password, uiCredentials) {
48 50
             if (config.useStunTurn) {
49 51
                 connection.jingle.getStunAndTurnCredentials();
50 52
             }
51
-            UI.disableConnect();
53
+            APP.UI.disableConnect();
52 54
 
53 55
             console.info("My Jabber ID: " + connection.jid);
54 56
 
@@ -77,17 +79,17 @@ function connect(jid, password, uiCredentials) {
77 79
 function maybeDoJoin() {
78 80
     if (connection && connection.connected &&
79 81
         Strophe.getResourceFromJid(connection.jid)
80
-        && (RTC.localAudio || RTC.localVideo)) {
82
+        && (APP.RTC.localAudio || APP.RTC.localVideo)) {
81 83
         // .connected is true while connecting?
82 84
         doJoin();
83 85
     }
84 86
 }
85 87
 
86 88
 function doJoin() {
87
-    var roomName = UI.generateRoomName();
89
+    var roomName = APP.UI.generateRoomName();
88 90
 
89 91
     Moderator.allocateConferenceFocus(
90
-        roomName, UI.checkForNicknameAndJoin);
92
+        roomName, APP.UI.checkForNicknameAndJoin);
91 93
 }
92 94
 
93 95
 function initStrophePlugins()
@@ -101,9 +103,9 @@ function initStrophePlugins()
101 103
 }
102 104
 
103 105
 function registerListeners() {
104
-    RTC.addStreamListener(maybeDoJoin,
106
+    APP.RTC.addStreamListener(maybeDoJoin,
105 107
         StreamEventTypes.EVENT_TYPE_LOCAL_CREATED);
106
-    UI.addListener(UIEvents.NICKNAME_CHANGED, function (nickname) {
108
+    APP.UI.addListener(UIEvents.NICKNAME_CHANGED, function (nickname) {
107 109
         XMPP.addToPresence("displayName", nickname);
108 110
     });
109 111
 }
@@ -160,7 +162,7 @@ var XMPP = {
160 162
         connect(jid, null, uiCredentials);
161 163
     },
162 164
     promptLogin: function () {
163
-        UI.showLoginPopup(connect);
165
+        APP.UI.showLoginPopup(connect);
164 166
     },
165 167
     joinRoom: function(roomName, useNicks, nick)
166 168
     {
@@ -200,11 +202,11 @@ var XMPP = {
200 202
         if (handler && handler.peerconnection) {
201 203
             // FIXME: probably removing streams is not required and close() should
202 204
             // be enough
203
-            if (RTC.localAudio) {
204
-                handler.peerconnection.removeStream(RTC.localAudio.getOriginalStream(), onUnload);
205
+            if (APP.RTC.localAudio) {
206
+                handler.peerconnection.removeStream(APP.RTC.localAudio.getOriginalStream(), onUnload);
205 207
             }
206
-            if (RTC.localVideo) {
207
-                handler.peerconnection.removeStream(RTC.localVideo.getOriginalStream(), onUnload);
208
+            if (APP.RTC.localVideo) {
209
+                handler.peerconnection.removeStream(APP.RTC.localVideo.getOriginalStream(), onUnload);
208 210
             }
209 211
             handler.peerconnection.close();
210 212
         }
@@ -247,13 +249,13 @@ var XMPP = {
247 249
         }
248 250
     },
249 251
     setVideoMute: function (mute, callback, options) {
250
-       if(connection && RTC.localVideo && connection.jingle.activecall)
252
+       if(connection && APP.RTC.localVideo && connection.jingle.activecall)
251 253
        {
252 254
            connection.jingle.activecall.setVideoMute(mute, callback, options);
253 255
        }
254 256
     },
255 257
     setAudioMute: function (mute, callback) {
256
-        if (!(connection && RTC.localAudio)) {
258
+        if (!(connection && APP.RTC.localAudio)) {
257 259
             return false;
258 260
         }
259 261
 
@@ -265,7 +267,7 @@ var XMPP = {
265 267
             this.forceMuted = false;
266 268
         }
267 269
 
268
-        if (mute == RTC.localAudio.isMuted()) {
270
+        if (mute == APP.RTC.localAudio.isMuted()) {
269 271
             // Nothing to do
270 272
             return true;
271 273
         }
@@ -273,7 +275,7 @@ var XMPP = {
273 275
         // It is not clear what is the right way to handle multiple tracks.
274 276
         // So at least make sure that they are all muted or all unmuted and
275 277
         // that we send presence just once.
276
-        RTC.localAudio.mute();
278
+        APP.RTC.localAudio.mute();
277 279
         // isMuted is the opposite of audioEnabled
278 280
         connection.emuc.addAudioInfoToPresence(mute);
279 281
         connection.emuc.sendPresence();
@@ -303,7 +305,7 @@ var XMPP = {
303 305
                             },
304 306
                             function (error) {
305 307
                                 console.log('mute SLD error');
306
-                                UI.messageHandler.showError('Error',
308
+                                APP.UI.messageHandler.showError('Error',
307 309
                                         'Oops! Something went wrong and we failed to ' +
308 310
                                         'mute! (SLD Failure)');
309 311
                             }
@@ -311,13 +313,13 @@ var XMPP = {
311 313
                     },
312 314
                     function (error) {
313 315
                         console.log(error);
314
-                        UI.messageHandler.showError();
316
+                        APP.UI.messageHandler.showError();
315 317
                     }
316 318
                 );
317 319
             },
318 320
             function (error) {
319 321
                 console.log('muteVideo SRD error');
320
-                UI.messageHandler.showError('Error',
322
+                APP.UI.messageHandler.showError('Error',
321 323
                         'Oops! Something went wrong and we failed to stop video!' +
322 324
                         '(SRD Failure)');
323 325
 

+ 1
- 2
service/RTC/MediaStreamTypes.js Zobrazit soubor

@@ -3,5 +3,4 @@ var MediaStreamType = {
3 3
 
4 4
     AUDIO_TYPE: "Audio"
5 5
 };
6
-////These lines should be uncommented when require works in app.js
7
-//module.exports = MediaStreamType;
6
+module.exports = MediaStreamType;

+ 1
- 1
service/RTC/RTCBrowserType.js Zobrazit soubor

@@ -4,4 +4,4 @@ var RTCBrowserType = {
4 4
     RTC_BROWSER_FIREFOX: "rtc_browser.firefox"
5 5
 };
6 6
 
7
-//module.exports = RTCBrowserType;
7
+module.exports = RTCBrowserType;

+ 3
- 1
service/RTC/RTCEvents.js Zobrazit soubor

@@ -6,4 +6,6 @@ var RTCEvents = {
6 6
     SIMULCAST_LAYER_CHANGING: "rtc.simulcast_layer_changing",
7 7
     SIMULCAST_START: "rtc.simlcast_start",
8 8
     SIMULCAST_STOP: "rtc.simlcast_stop"
9
-}
9
+};
10
+
11
+module.exports = RTCEvents;

+ 1
- 2
service/RTC/StreamEventTypes.js Zobrazit soubor

@@ -10,5 +10,4 @@ var StreamEventTypes = {
10 10
     EVENT_TYPE_REMOTE_ENDED: "stream.remote_ended"
11 11
 };
12 12
 
13
-//These lines should be uncommented when require works in app.js
14
-//module.exports = StreamEventTypes;
13
+module.exports = StreamEventTypes;

+ 1
- 1
service/UI/UIEvents.js Zobrazit soubor

@@ -3,4 +3,4 @@ var UIEvents = {
3 3
     SELECTED_ENDPOINT: "UI.selected_endpoint",
4 4
     PINNED_ENDPOINT: "UI.pinned_endpoint"
5 5
 };
6
-//module.exports = UIEvents;
6
+module.exports = UIEvents;

+ 3
- 1
service/connectionquality/CQEvents.js Zobrazit soubor

@@ -2,4 +2,6 @@ var CQEvents = {
2 2
     LOCALSTATS_UPDATED: "cq.localstats_updated",
3 3
     REMOTESTATS_UPDATED: "cq.remotestats_updated",
4 4
     STOP: "cq.stop"
5
-};
5
+};
6
+
7
+module.exports = CQEvents;

+ 1
- 2
service/desktopsharing/DesktopSharingEventTypes.js Zobrazit soubor

@@ -6,5 +6,4 @@ var DesktopSharingEventTypes = {
6 6
     NEW_STREAM_CREATED: "ds.new_stream_created"
7 7
 };
8 8
 
9
-//These lines should be uncommented when require works in app.js
10
-//module.exports = NEW_STREAM_CREATED;
9
+module.exports = DesktopSharingEventTypes;

+ 1
- 1
service/xmpp/XMPPEvents.js Zobrazit soubor

@@ -23,4 +23,4 @@ var XMPPEvents = {
23 23
     CHAT_ERROR_RECEIVED: "xmpp.chat_error_received",
24 24
     ETHERPAD: "xmpp.etherpad"
25 25
 };
26
-//module.exports = XMPPEvents;
26
+module.exports = XMPPEvents;

Načítá se…
Zrušit
Uložit