Browse Source

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

master
hristoterezov 10 years ago
parent
commit
9eb2873cfa
57 changed files with 11851 additions and 13194 deletions
  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 View File

1
 BROWSERIFY = browserify
1
 BROWSERIFY = browserify
2
 GLOBAL_FLAGS = -e
2
 GLOBAL_FLAGS = -e
3
-MODULE_DIR = modules
4
-MODULE_SUBDIRS = $(wildcard $(MODULE_DIR)/*/)
5
-MODULES = $(MODULE_SUBDIRS:$(MODULE_DIR)/%/=%)
6
 OUTPUT_DIR = .
3
 OUTPUT_DIR = .
7
-DEPLOY_DIR = libs/modules
4
+DEPLOY_DIR = libs
8
 
5
 
9
 all: compile deploy clean
6
 all: compile deploy clean
10
 
7
 
11
 compile:FLAGS = $(GLOBAL_FLAGS)
8
 compile:FLAGS = $(GLOBAL_FLAGS)
12
-compile:$(MODULES)
9
+compile: app
13
 
10
 
14
 debug: compile-debug deploy clean
11
 debug: compile-debug deploy clean
15
 
12
 
16
 compile-debug:FLAGS = -d $(GLOBAL_FLAGS)
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
 clean:
19
 clean:
23
 	@rm -f $(OUTPUT_DIR)/*.bundle.js
20
 	@rm -f $(OUTPUT_DIR)/*.bundle.js

+ 33
- 13
app.js View File

1
 /* jshint -W117 */
1
 /* jshint -W117 */
2
 /* application specific logic */
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
 function init() {
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
 $(document).ready(function () {
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
 $(window).bind('beforeunload', function () {
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 View File

19
     <script src="libs/popover.js?v=1"></script><!-- bootstrap tooltip lib -->
19
     <script src="libs/popover.js?v=1"></script><!-- bootstrap tooltip lib -->
20
     <script src="libs/toastr.js?v=1"></script><!-- notifications lib -->
20
     <script src="libs/toastr.js?v=1"></script><!-- notifications lib -->
21
     <script src="interface_config.js?v=5"></script>
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
     <script src="analytics.js?v=1"></script><!-- google analytics plugin -->
24
     <script src="analytics.js?v=1"></script><!-- google analytics plugin -->
42
     <link rel="stylesheet" href="css/font.css?v=6"/>
25
     <link rel="stylesheet" href="css/font.css?v=6"/>

libs/app.bundle.js
File diff suppressed because it is too large
View File


+ 0
- 234
libs/modules/API.bundle.js View File

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
File diff suppressed because it is too large
View File


+ 0
- 7569
libs/modules/UI.bundle.js
File diff suppressed because it is too large
View File


+ 0
- 438
libs/modules/connectionquality.bundle.js View File

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 View File

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 View File

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
File diff suppressed because it is too large
View File


+ 0
- 1265
libs/modules/statistics.bundle.js
File diff suppressed because it is too large
View File


+ 13
- 13
modules/API/API.js View File

4
  * applications that embed Jitsi Meet
4
  * applications that embed Jitsi Meet
5
  */
5
  */
6
 
6
 
7
-
7
+var XMPPEvents = require("../../service/xmpp/XMPPEvents");
8
 
8
 
9
 /**
9
 /**
10
  * List of the available commands.
10
  * List of the available commands.
17
  */
17
  */
18
 var commands =
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
 }
135
 }
136
 
136
 
137
 function setupListeners() {
137
 function setupListeners() {
138
-    xmpp.addListener(XMPPEvents.MUC_ENTER, function (from) {
138
+    APP.xmpp.addListener(XMPPEvents.MUC_ENTER, function (from) {
139
         API.triggerEvent("participantJoined", {jid: from});
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
         if (from != myjid)
142
         if (from != myjid)
143
             API.triggerEvent("incomingMessage",
143
             API.triggerEvent("incomingMessage",
144
                 {"from": from, "nick": nick, "message": txt});
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
         API.triggerEvent("participantLeft", {jid: jid});
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
         name = displayName[jid];
150
         name = displayName[jid];
151
         if(!name || name != newDisplayName) {
151
         if(!name || name != newDisplayName) {
152
             API.triggerEvent("displayNameChange", {jid: jid, displayname: newDisplayName});
152
             API.triggerEvent("displayNameChange", {jid: jid, displayname: newDisplayName});
153
             displayName[jid] = newDisplayName;
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 View File

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

+ 1
- 1
modules/RTC/LocalStream.js View File

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

+ 2
- 3
modules/RTC/MediaStream.js View File

1
 ////These lines should be uncommented when require works in app.js
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
  * Creates a MediaStream object for the given data, session id and ssrc.
6
  * Creates a MediaStream object for the given data, session id and ssrc.

+ 16
- 13
modules/RTC/RTC.js View File

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

+ 3
- 4
modules/RTC/RTCUtils.js View File

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
 function setResolutionConstraints(constraints, resolution, isAndroid)
3
 function setResolutionConstraints(constraints, resolution, isAndroid)
5
 {
4
 {
236
 
235
 
237
             // We currently do not support FF, as it doesn't have multistream support.
236
             // We currently do not support FF, as it doesn't have multistream support.
238
             && !isFF) {
237
             && !isFF) {
239
-            simulcast.getUserMedia(constraints, function (stream) {
238
+            APP.simulcast.getUserMedia(constraints, function (stream) {
240
                     console.log('onUserMediaSuccess');
239
                     console.log('onUserMediaSuccess');
241
                     success_callback(stream);
240
                     success_callback(stream);
242
                 },
241
                 },
292
                 cb,
291
                 cb,
293
                 function (error) {
292
                 function (error) {
294
                     console.error('failed to obtain audio/video stream - stop', error);
293
                     console.error('failed to obtain audio/video stream - stop', error);
295
-                    UI.messageHandler.showError("Error",
294
+                    APP.UI.messageHandler.showError("Error",
296
                             "Failed to obtain permissions to use the local microphone" +
295
                             "Failed to obtain permissions to use the local microphone" +
297
                             "and/or camera.");
296
                             "and/or camera.");
298
                 }
297
                 }

+ 96
- 97
modules/UI/UI.js View File

20
 var Authentication  = require("./authentication/Authentication");
20
 var Authentication  = require("./authentication/Authentication");
21
 var UIUtil = require("./util/UIUtil");
21
 var UIUtil = require("./util/UIUtil");
22
 var NicknameHandler = require("./util/NicknameHandler");
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
 var eventEmitter = new EventEmitter();
30
 var eventEmitter = new EventEmitter();
25
 var roomName = null;
31
 var roomName = null;
73
 }
79
 }
74
 
80
 
75
 function registerListeners() {
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
         VideoLayout.onRemoteStreamAdded(stream);
86
         VideoLayout.onRemoteStreamAdded(stream);
81
     }, StreamEventTypes.EVENT_TYPE_REMOTE_CREATED);
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
         VideoLayout.onDominantSpeakerChanged(resourceJid);
90
         VideoLayout.onDominantSpeakerChanged(resourceJid);
85
     });
91
     });
86
-    RTC.addListener(RTCEvents.LASTN_ENDPOINT_CHANGED,
92
+    APP.RTC.addListener(RTCEvents.LASTN_ENDPOINT_CHANGED,
87
         function (lastNEndpoints, endpointsEnteringLastN, stream) {
93
         function (lastNEndpoints, endpointsEnteringLastN, stream) {
88
             VideoLayout.onLastNEndpointsChanged(lastNEndpoints,
94
             VideoLayout.onLastNEndpointsChanged(lastNEndpoints,
89
                 endpointsEnteringLastN, stream);
95
                 endpointsEnteringLastN, stream);
90
         });
96
         });
91
-    RTC.addListener(RTCEvents.SIMULCAST_LAYER_CHANGED,
97
+    APP.RTC.addListener(RTCEvents.SIMULCAST_LAYER_CHANGED,
92
         function (endpointSimulcastLayers) {
98
         function (endpointSimulcastLayers) {
93
            VideoLayout.onSimulcastLayersChanged(endpointSimulcastLayers);
99
            VideoLayout.onSimulcastLayersChanged(endpointSimulcastLayers);
94
         });
100
         });
95
-    RTC.addListener(RTCEvents.SIMULCAST_LAYER_CHANGING,
101
+    APP.RTC.addListener(RTCEvents.SIMULCAST_LAYER_CHANGING,
96
         function (endpointSimulcastLayers) {
102
         function (endpointSimulcastLayers) {
97
             VideoLayout.onSimulcastLayersChanging(endpointSimulcastLayers);
103
             VideoLayout.onSimulcastLayersChanging(endpointSimulcastLayers);
98
         });
104
         });
99
     VideoLayout.init(eventEmitter);
105
     VideoLayout.init(eventEmitter);
100
 
106
 
101
-    statistics.addAudioLevelListener(function(jid, audioLevel)
107
+    APP.statistics.addAudioLevelListener(function(jid, audioLevel)
102
     {
108
     {
103
         var resourceJid;
109
         var resourceJid;
104
-        if(jid === statistics.LOCAL_JID)
110
+        if(jid === APP.statistics.LOCAL_JID)
105
         {
111
         {
106
             resourceJid = AudioLevels.LOCAL_LEVEL;
112
             resourceJid = AudioLevels.LOCAL_LEVEL;
107
-            if(RTC.localAudio.isMuted())
113
+            if(APP.RTC.localAudio.isMuted())
108
             {
114
             {
109
                 audioLevel = 0;
115
                 audioLevel = 0;
110
             }
116
             }
117
         AudioLevels.updateAudioLevel(resourceJid, audioLevel,
123
         AudioLevels.updateAudioLevel(resourceJid, audioLevel,
118
             UI.getLargeVideoState().userResourceJid);
124
             UI.getLargeVideoState().userResourceJid);
119
     });
125
     });
120
-    desktopsharing.addListener(function () {
126
+    APP.desktopsharing.addListener(function () {
121
         ToolbarToggler.showDesktopSharingButton();
127
         ToolbarToggler.showDesktopSharingButton();
122
     }, DesktopSharingEventTypes.INIT);
128
     }, DesktopSharingEventTypes.INIT);
123
-    desktopsharing.addListener(
129
+    APP.desktopsharing.addListener(
124
         Toolbar.changeDesktopSharingButtonState,
130
         Toolbar.changeDesktopSharingButtonState,
125
         DesktopSharingEventTypes.SWITCHING_DONE);
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
         messageHandler.openMessageDialog("Session Terminated",
140
         messageHandler.openMessageDialog("Session Terminated",
129
             "Ouch! You have been kicked out of the meet!");
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
         messageHandler.showError("Error",
144
         messageHandler.showError("Error",
133
             "Jitsi Videobridge is currently unavailable. Please try again later!");
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
         for(stream in changedStreams)
151
         for(stream in changedStreams)
138
         {
152
         {
139
             // might need to update the direction if participant just went from sendrecv to recvonly
153
             // might need to update the direction if participant just went from sendrecv to recvonly
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
 function bindEvents()
217
 function bindEvents()
180
 {
218
 {
181
     /**
219
     /**
194
     });
232
     });
195
 }
233
 }
196
 
234
 
197
-UI.start = function () {
235
+UI.start = function (init) {
198
     document.title = interfaceConfig.APP_NAME;
236
     document.title = interfaceConfig.APP_NAME;
199
     if(config.enableWelcomePage && window.location.pathname == "/" &&
237
     if(config.enableWelcomePage && window.location.pathname == "/" &&
200
         (!window.localStorage.welcomePageDisabled || window.localStorage.welcomePageDisabled == "false"))
238
         (!window.localStorage.welcomePageDisabled || window.localStorage.welcomePageDisabled == "false"))
314
 
352
 
315
 };
353
 };
316
 
354
 
317
-UI.toggleSmileys = function () {
318
-    Chat.toggleSmileys();
319
-};
320
-
321
 function chatAddError(errorMessage, originalText)
355
 function chatAddError(errorMessage, originalText)
322
 {
356
 {
323
     return Chat.chatAddError(errorMessage, originalText);
357
     return Chat.chatAddError(errorMessage, originalText);
347
 
381
 
348
     // Show authenticate button if needed
382
     // Show authenticate button if needed
349
     Toolbar.showAuthenticateButton(
383
     Toolbar.showAuthenticateButton(
350
-            xmpp.isExternalAuthEnabled() && !xmpp.isModerator());
384
+            APP.xmpp.isExternalAuthEnabled() && !APP.xmpp.isModerator());
351
 
385
 
352
     var displayName = !config.displayJids
386
     var displayName = !config.displayJids
353
         ? info.displayName : Strophe.getResourceFromJid(jid);
387
         ? info.displayName : Strophe.getResourceFromJid(jid);
485
     }
519
     }
486
 }
520
 }
487
 
521
 
522
+
523
+UI.toggleSmileys = function () {
524
+    Chat.toggleSmileys();
525
+};
526
+
488
 UI.getSettings = function () {
527
 UI.getSettings = function () {
489
     return Settings.getSettings();
528
     return Settings.getSettings();
490
 };
529
 };
501
     return BottomToolbar.toggleContactList();
540
     return BottomToolbar.toggleContactList();
502
 };
541
 };
503
 
542
 
504
-UI.setRecordingButtonState = function (state) {
505
-    Toolbar.setRecordingButtonState(state);
506
-};
507
-
508
 UI.inputDisplayNameHandler = function (value) {
543
 UI.inputDisplayNameHandler = function (value) {
509
     VideoLayout.inputDisplayNameHandler(value);
544
     VideoLayout.inputDisplayNameHandler(value);
510
 };
545
 };
515
     return VideoLayout.getLargeVideoState();
550
     return VideoLayout.getLargeVideoState();
516
 };
551
 };
517
 
552
 
518
-UI.showLocalAudioIndicator = function (mute) {
519
-    VideoLayout.showLocalAudioIndicator(mute);
520
-};
521
-
522
 UI.generateRoomName = function() {
553
 UI.generateRoomName = function() {
523
     if(roomName)
554
     if(roomName)
524
         return roomName;
555
         return roomName;
560
     return VideoLayout.connectionIndicators[id].showMore();
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
 UI.getCreadentials = function () {
594
 UI.getCreadentials = function () {
595
+    var settings = this.getSettings();
572
     return {
596
     return {
573
         bosh: document.getElementById('boshURL').value,
597
         bosh: document.getElementById('boshURL').value,
574
         password: document.getElementById('password').value,
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
     if (config.useNicks) {
642
     if (config.useNicks) {
616
         nick = window.prompt('Your nickname (optional)');
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
 function dump(elem, filename) {
649
 function dump(elem, filename) {
623
     elem = elem.parentNode;
650
     elem = elem.parentNode;
624
     elem.download = filename || 'meetlog.json';
651
     elem.download = filename || 'meetlog.json';
625
     elem.href = 'data:application/json;charset=utf-8,\n';
652
     elem.href = 'data:application/json;charset=utf-8,\n';
626
-    var data = xmpp.populateData();
653
+    var data = APP.xmpp.populateData();
627
     var metadata = {};
654
     var metadata = {};
628
     metadata.time = new Date();
655
     metadata.time = new Date();
629
     metadata.url = window.location.href;
656
     metadata.url = window.location.href;
630
     metadata.ua = navigator.userAgent;
657
     metadata.ua = navigator.userAgent;
631
-    var log = xmpp.getLogger();
658
+    var log = APP.xmpp.getLogger();
632
     if (log) {
659
     if (log) {
633
         metadata.xmpp = log;
660
         metadata.xmpp = log;
634
     }
661
     }
639
 
666
 
640
 UI.getRoomName = function () {
667
 UI.getRoomName = function () {
641
     return roomName;
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
  * Mutes/unmutes the local video.
672
  * Mutes/unmutes the local video.
675
 UI.toggleVideo = function () {
674
 UI.toggleVideo = function () {
676
     UIUtil.buttonClick("#video", "icon-camera icon-camera-disabled");
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
  * Mutes / unmutes audio for the local participant.
681
  * Mutes / unmutes audio for the local participant.
683
  */
682
  */
684
 UI.toggleAudio = function() {
683
 UI.toggleAudio = function() {
685
-    UI.setAudioMuted(!RTC.localAudio.isMuted());
684
+    UI.setAudioMuted(!APP.RTC.localAudio.isMuted());
686
 };
685
 };
687
 
686
 
688
 /**
687
 /**
690
  */
689
  */
691
 UI.setAudioMuted = function (mute) {
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
         UIUtil.buttonClick("#mute", "icon-microphone icon-mic-disabled");
695
         UIUtil.buttonClick("#mute", "icon-microphone icon-mic-disabled");
697
     }))
696
     }))

+ 4
- 4
modules/UI/audio_levels/AudioLevels.js View File

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

+ 1
- 1
modules/UI/authentication/Authentication.js View File

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

+ 8
- 7
modules/UI/avatar/Avatar.js View File

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

+ 2
- 2
modules/UI/etherpad/Etherpad.js View File

1
-/* global $, config, dockToolbar,
1
+/* global $, config,
2
    setLargeVideoVisible, Util */
2
    setLargeVideoVisible, Util */
3
 
3
 
4
 var VideoLayout = require("../videolayout/VideoLayout");
4
 var VideoLayout = require("../videolayout/VideoLayout");
30
  * Shares the Etherpad name with other participants.
30
  * Shares the Etherpad name with other participants.
31
  */
31
  */
32
 function shareEtherpad() {
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 View File

31
      * to load.
31
      * to load.
32
      */
32
      */
33
     openPreziDialog: function() {
33
     openPreziDialog: function() {
34
-        var myprezi = xmpp.getPrezi();
34
+        var myprezi = APP.xmpp.getPrezi();
35
         if (myprezi) {
35
         if (myprezi) {
36
             messageHandler.openTwoButtonDialog("Remove Prezi",
36
             messageHandler.openTwoButtonDialog("Remove Prezi",
37
                 "Are you sure you would like to remove your Prezi?",
37
                 "Are you sure you would like to remove your Prezi?",
196
 
196
 
197
     preziPlayer.on(PreziPlayer.EVENT_CURRENT_STEP, function(event) {
197
     preziPlayer.on(PreziPlayer.EVENT_CURRENT_STEP, function(event) {
198
         console.log("event value", event.value);
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
     $("#" + elementId).css( 'background-image',
202
     $("#" + elementId).css( 'background-image',

+ 4
- 3
modules/UI/side_pannels/chat/Chat.js View File

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

+ 1
- 1
modules/UI/side_pannels/chat/Commands.js View File

34
 function processTopic(commandArguments)
34
 function processTopic(commandArguments)
35
 {
35
 {
36
     var topic = UIUtil.escapeHtml(commandArguments);
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 View File

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

+ 2
- 2
modules/UI/side_pannels/settings/SettingsMenu.js View File

11
 
11
 
12
         if(newDisplayName) {
12
         if(newDisplayName) {
13
             var displayName = Settings.setDisplayName(newDisplayName);
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
         var email = Settings.setEmail(newEmail);
19
         var email = Settings.setEmail(newEmail);
20
 
20
 
21
 
21
 

+ 9
- 9
modules/UI/toolbars/Toolbar.js View File

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

+ 2
- 2
modules/UI/toolbars/ToolbarToggler.js View File

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

+ 2
- 0
modules/UI/util/NicknameHandler.js View File

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

+ 2
- 2
modules/UI/videolayout/ConnectionIndicator.js View File

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

+ 82
- 84
modules/UI/videolayout/VideoLayout.js View File

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

+ 6
- 4
modules/connectionquality/connectionquality.js View File

1
 var EventEmitter = require("events");
1
 var EventEmitter = require("events");
2
 var eventEmitter = new EventEmitter();
2
 var eventEmitter = new EventEmitter();
3
+var CQEvents = require("../../service/connectionquality/CQEvents");
4
+var XMPPEvents = require("../../service/xmpp/XMPPEvents");
3
 
5
 
4
 /**
6
 /**
5
  * local stats
7
  * local stats
32
  * Sends statistics to other participants
34
  * Sends statistics to other participants
33
  */
35
  */
34
 function sendStats() {
36
 function sendStats() {
35
-    xmpp.addToPresence("connectionQuality", convertToMUCStats(stats));
37
+    APP.xmpp.addToPresence("connectionQuality", convertToMUCStats(stats));
36
 }
38
 }
37
 
39
 
38
 /**
40
 /**
72
 
74
 
73
 var ConnectionQuality = {
75
 var ConnectionQuality = {
74
     init: function () {
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 View File

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

+ 10
- 10
modules/keyboardshortcut/keyboardshortcut.js View File

3
     67: {
3
     67: {
4
         character: "C",
4
         character: "C",
5
         id: "toggleChatPopover",
5
         id: "toggleChatPopover",
6
-        function: UI.toggleChat
6
+        function: APP.UI.toggleChat
7
     },
7
     },
8
     70: {
8
     70: {
9
         character: "F",
9
         character: "F",
10
         id: "filmstripPopover",
10
         id: "filmstripPopover",
11
-        function: UI.toggleFilmStrip
11
+        function: APP.UI.toggleFilmStrip
12
     },
12
     },
13
     77: {
13
     77: {
14
         character: "M",
14
         character: "M",
15
         id: "mutePopover",
15
         id: "mutePopover",
16
-        function: UI.toggleAudio
16
+        function: APP.UI.toggleAudio
17
     },
17
     },
18
     84: {
18
     84: {
19
         character: "T",
19
         character: "T",
20
         function: function() {
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
     86: {
26
     86: {
27
         character: "V",
27
         character: "V",
28
         id: "toggleVideoPopover",
28
         id: "toggleVideoPopover",
29
-        function: UI.toggleVideo
29
+        function: APP.UI.toggleVideo
30
     }
30
     }
31
 };
31
 };
32
 
32
 
43
                 }
43
                 }
44
                 else if (keycode >= "0".charCodeAt(0) &&
44
                 else if (keycode >= "0".charCodeAt(0) &&
45
                     keycode <= "9".charCodeAt(0)) {
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
                 //esc while the smileys are visible hides them
48
                 //esc while the smileys are visible hides them
49
             } else if (keycode === 27 && $('#smileysContainer').is(':visible')) {
49
             } else if (keycode === 27 && $('#smileysContainer').is(':visible')) {
50
-                UI.toggleSmileys();
50
+                APP.UI.toggleSmileys();
51
             }
51
             }
52
         };
52
         };
53
 
53
 
56
                 $(":focus").is("input[type=password]") ||
56
                 $(":focus").is("input[type=password]") ||
57
                 $(":focus").is("textarea"))) {
57
                 $(":focus").is("textarea"))) {
58
                 if(e.which === "T".charCodeAt(0)) {
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 View File

1
 var SimulcastLogger = require("./SimulcastLogger");
1
 var SimulcastLogger = require("./SimulcastLogger");
2
 var SimulcastUtils = require("./SimulcastUtils");
2
 var SimulcastUtils = require("./SimulcastUtils");
3
+var MediaStreamType = require("../../service/RTC/MediaStreamTypes");
3
 
4
 
4
 function SimulcastReceiver() {
5
 function SimulcastReceiver() {
5
     this.simulcastUtils = new SimulcastUtils();
6
     this.simulcastUtils = new SimulcastUtils();
161
     // low quality (that the sender always streams).
162
     // low quality (that the sender always streams).
162
     if(!ssrc)
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
         var remoteStream = remoteStreamObject.getOriginalStream();
166
         var remoteStream = remoteStreamObject.getOriginalStream();
166
         var tracks = remoteStream.getVideoTracks();
167
         var tracks = remoteStream.getVideoTracks();
167
         if (tracks) {
168
         if (tracks) {
184
 {
185
 {
185
     var sid, electedStream;
186
     var sid, electedStream;
186
     var i, j, k;
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
         var remoteStream = remoteStreamObject.getOriginalStream();
192
         var remoteStream = remoteStreamObject.getOriginalStream();
192
         var tracks = remoteStream.getVideoTracks();
193
         var tracks = remoteStream.getVideoTracks();
193
         if (tracks) {
194
         if (tracks) {
207
     }
208
     }
208
     else
209
     else
209
     {
210
     {
210
-        console.debug(RTC.remoteStreams, jid, ssrc);
211
+        console.debug(APP.RTC.remoteStreams, jid, ssrc);
211
     }
212
     }
212
 
213
 
213
     return {
214
     return {

+ 2
- 2
modules/simulcast/SimulcastSender.js View File

32
     return (this.displayedLocalVideoStream != null)
32
     return (this.displayedLocalVideoStream != null)
33
         ? this.displayedLocalVideoStream
33
         ? this.displayedLocalVideoStream
34
         // in case we have no simulcast at all, i.e. we didn't perform the GUM
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
 function NativeSimulcastSender() {
38
 function NativeSimulcastSender() {
47
 
47
 
48
 NativeSimulcastSender.prototype.reset = function () {
48
 NativeSimulcastSender.prototype.reset = function () {
49
     this._localExplosionMap = {};
49
     this._localExplosionMap = {};
50
-    this._isUsingScreenStream = desktopsharing.isUsingScreenStream();
50
+    this._isUsingScreenStream = APP.desktopsharing.isUsingScreenStream();
51
 };
51
 };
52
 
52
 
53
 NativeSimulcastSender.prototype._cacheLocalVideoSources = function (lines) {
53
 NativeSimulcastSender.prototype._cacheLocalVideoSources = function (lines) {

+ 4
- 3
modules/simulcast/simulcast.js View File

6
 var NativeSimulcastSender = SimulcastSender["native"];
6
 var NativeSimulcastSender = SimulcastSender["native"];
7
 var SimulcastReceiver = require("./SimulcastReceiver");
7
 var SimulcastReceiver = require("./SimulcastReceiver");
8
 var SimulcastUtils = require("./SimulcastUtils");
8
 var SimulcastUtils = require("./SimulcastUtils");
9
+var RTCEvents = require("../../service/RTC/RTCEvents");
9
 
10
 
10
 
11
 
11
 /**
12
 /**
46
         }
47
         }
47
 
48
 
48
     }
49
     }
49
-    RTC.addListener(RTCEvents.SIMULCAST_LAYER_CHANGED,
50
+    APP.RTC.addListener(RTCEvents.SIMULCAST_LAYER_CHANGED,
50
         function (endpointSimulcastLayers) {
51
         function (endpointSimulcastLayers) {
51
             endpointSimulcastLayers.forEach(function (esl) {
52
             endpointSimulcastLayers.forEach(function (esl) {
52
                 var ssrc = esl.simulcastLayer.primarySSRC;
53
                 var ssrc = esl.simulcastLayer.primarySSRC;
53
                 simulcast._setReceivingVideoStream(esl.endpoint, ssrc);
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
         var ssrc = simulcastLayer.primarySSRC;
58
         var ssrc = simulcastLayer.primarySSRC;
58
         simulcast._setLocalVideoStreamEnabled(ssrc, true);
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
         var ssrc = simulcastLayer.primarySSRC;
62
         var ssrc = simulcastLayer.primarySSRC;
62
         simulcast._setLocalVideoStreamEnabled(ssrc, false);
63
         simulcast._setLocalVideoStreamEnabled(ssrc, false);
63
     });
64
     });

+ 10
- 7
modules/statistics/RTPStatsCollector.js View File

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

+ 5
- 7
modules/statistics/statistics.js View File

4
 var LocalStats = require("./LocalStatsCollector.js");
4
 var LocalStats = require("./LocalStatsCollector.js");
5
 var RTPStats = require("./RTPStatsCollector.js");
5
 var RTPStats = require("./RTPStatsCollector.js");
6
 var EventEmitter = require("events");
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
 var eventEmitter = new EventEmitter();
10
 var eventEmitter = new EventEmitter();
13
 
11
 
122
     },
120
     },
123
 
121
 
124
     start: function () {
122
     start: function () {
125
-        RTC.addStreamListener(onStreamCreated,
123
+        APP.RTC.addStreamListener(onStreamCreated,
126
             StreamEventTypes.EVENT_TYPE_LOCAL_CREATED);
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
             startRemoteStats(event.peerconnection);
127
             startRemoteStats(event.peerconnection);
130
         });
128
         });
131
     }
129
     }

+ 13
- 12
modules/xmpp/JingleSession.js View File

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

+ 2
- 2
modules/xmpp/SDP.js View File

235
                     var msid = null;
235
                     var msid = null;
236
                     if(mline.media == "audio")
236
                     if(mline.media == "audio")
237
                     {
237
                     {
238
-                        msid = RTC.localAudio.getId();
238
+                        msid = APP.RTC.localAudio.getId();
239
                     }
239
                     }
240
                     else
240
                     else
241
                     {
241
                     {
242
-                        msid = RTC.localVideo.getId();
242
+                        msid = APP.RTC.localVideo.getId();
243
                     }
243
                     }
244
                     if(msid != null)
244
                     if(msid != null)
245
                     {
245
                     {

+ 7
- 7
modules/xmpp/TraceablePeerConnection.js View File

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

+ 4
- 1
modules/xmpp/moderator.js View File

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

+ 6
- 6
modules/xmpp/strophe.emuc.js View File

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

+ 2
- 0
modules/xmpp/strophe.jingle.js View File

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

+ 1
- 1
modules/xmpp/strophe.moderate.js View File

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

+ 25
- 23
modules/xmpp/xmpp.js View File

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

+ 1
- 2
service/RTC/MediaStreamTypes.js View File

3
 
3
 
4
     AUDIO_TYPE: "Audio"
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 View File

4
     RTC_BROWSER_FIREFOX: "rtc_browser.firefox"
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 View File

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

+ 1
- 2
service/RTC/StreamEventTypes.js View File

10
     EVENT_TYPE_REMOTE_ENDED: "stream.remote_ended"
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 View File

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

+ 3
- 1
service/connectionquality/CQEvents.js View File

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

+ 1
- 2
service/desktopsharing/DesktopSharingEventTypes.js View File

6
     NEW_STREAM_CREATED: "ds.new_stream_created"
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 View File

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

Loading…
Cancel
Save