Pārlūkot izejas kodu

use JS API; UI module refactoring

master
isymchych 9 gadus atpakaļ
vecāks
revīzija
59f98205c7

+ 5
- 2
Makefile Parādīt failu

@@ -8,10 +8,13 @@ DEPLOY_DIR = libs
8 8
 BROWSERIFY_FLAGS = -d
9 9
 OUTPUT_DIR = .
10 10
 
11
-all: compile uglify deploy clean
11
+all: update-deps compile uglify deploy clean
12
+
13
+update-deps:
14
+	$(NPM) update
12 15
 
13 16
 compile:
14
-	$(NPM) update && $(BROWSERIFY) $(BROWSERIFY_FLAGS) -e app.js -s APP | $(EXORCIST) $(OUTPUT_DIR)/app.bundle.js.map > $(OUTPUT_DIR)/app.bundle.js
17
+	$(BROWSERIFY) $(BROWSERIFY_FLAGS) -e app.js -s APP | $(EXORCIST) $(OUTPUT_DIR)/app.bundle.js.map > $(OUTPUT_DIR)/app.bundle.js
15 18
 
16 19
 clean:
17 20
 	rm -f $(OUTPUT_DIR)/app.bundle.*

+ 127
- 16
app.js Parādīt failu

@@ -1,4 +1,5 @@
1 1
 /* jshint -W117 */
2
+/* global JitsiMeetJS */
2 3
 /* application specific logic */
3 4
 
4 5
 require("jquery");
@@ -12,18 +13,42 @@ window.toastr = require("toastr");
12 13
 require("jQuery-Impromptu");
13 14
 require("autosize");
14 15
 
15
-var APP =
16
-{
16
+function createConference(connection, room) {
17
+    var localTracks = [];
18
+    var remoteTracks = {};
19
+
20
+    return {
21
+        muteAudio: function (mute) {
22
+
23
+        },
24
+
25
+        muteVideo: function (mute) {
26
+
27
+        },
28
+
29
+        toggleAudioMuted: function () {
30
+            APP.UI.setAudioMuted(muted);
31
+        },
32
+
33
+        toggleVideoMuted: function () {
34
+            APP.UI.setVideoMuted(muted);
35
+        }
36
+    };
37
+}
38
+
39
+var APP = {
17 40
     init: function () {
41
+        this.JitsiMeetJS = JitsiMeetJS;
42
+        this.JitsiMeetJS.init();
43
+        this.conference = null;
44
+
18 45
         this.UI = require("./modules/UI/UI");
19 46
         this.API = require("./modules/API/API");
20 47
         this.connectionquality =
21 48
             require("./modules/connectionquality/connectionquality");
22 49
         this.statistics = require("./modules/statistics/statistics");
23
-        this.RTC = require("./modules/RTC/RTC");
24 50
         this.desktopsharing =
25 51
             require("./modules/desktopsharing/desktopsharing");
26
-        this.xmpp = require("./modules/xmpp/xmpp");
27 52
         this.keyboardshortcut =
28 53
             require("./modules/keyboardshortcut/keyboardshortcut");
29 54
         this.translation = require("./modules/translation/translation");
@@ -34,15 +59,101 @@ var APP =
34 59
     }
35 60
 };
36 61
 
37
-function init() {
62
+function connect() {
63
+    var connection = new APP.JitsiMeetJS.JitsiConnection(null, null, {
64
+        hosts: config.hosts,
65
+        bosh: config.bosh,
66
+        clientNode: config.clientNode
67
+    });
68
+
69
+    var events = APP.JitsiMeetJS.events.connection;
70
+
71
+    return new Promise(function (resolve, reject) {
72
+        var onConnectionSuccess = function () {
73
+            console.log('CONNECTED');
74
+            resolve(connection);
75
+        };
76
+
77
+        var onConnectionFailed = function () {
78
+            console.error('CONNECTION FAILED');
79
+            reject();
80
+        };
81
+
82
+        var onDisconnect = function () {
83
+            console.log('DISCONNECT');
84
+            connection.removeEventListener(
85
+                events.CONNECTION_ESTABLISHED, onConnectionSuccess
86
+            );
87
+            connection.removeEventListener(
88
+                events.CONNECTION_FAILED, onConnectionFailed
89
+            );
90
+            connection.removeEventListener(
91
+                events.CONNECTION_DISCONNECTED, onDisconnect
92
+            );
93
+        };
94
+
95
+        connection.addEventListener(
96
+            events.CONNECTION_ESTABLISHED, onConnectionSuccess
97
+        );
98
+        connection.addEventListener(
99
+            events.CONNECTION_FAILED, onConnectionFailed
100
+        );
101
+        connection.addEventListener(
102
+            events.CONNECTION_DISCONNECTED, onDisconnect
103
+        );
104
+
105
+        connection.connect();
106
+    }).catch(function (errType, msg) {
107
+        // TODO handle OTHER_ERROR only
108
+        UI.notifyConnectionFailed(msg);
109
+
110
+        // rethrow
111
+        throw new Error(errType);
112
+    });
113
+}
38 114
 
39
-    APP.desktopsharing.init();
40
-    APP.RTC.start();
41
-    APP.xmpp.start();
42
-    APP.statistics.start();
43
-    APP.connectionquality.init();
44
-    APP.keyboardshortcut.init();
45
-    APP.members.start();
115
+var ConferenceEvents = APP.JitsiMeetJS.events.conference;
116
+function initConference(connection, roomName) {
117
+    var room = connection.initJitsiConference(roomName, {
118
+        openSctp: config.openSctp,
119
+        disableAudioLevels: config.disableAudioLevels
120
+    });
121
+
122
+    room.on(ConferenceEvents.IN_LAST_N_CHANGED, function (inLastN) {
123
+        if (config.muteLocalVideoIfNotInLastN) {
124
+            // TODO mute or unmute if required
125
+            // mark video on UI
126
+            // UI.markVideoMuted(true/false);
127
+        }
128
+    });
129
+
130
+    room.on(
131
+        ConferenceEvents.ACTIVE_SPEAKER_CHANGED,
132
+        function (id) {
133
+            APP.UI.markDominantSpiker(id);
134
+        }
135
+    );
136
+    room.on(
137
+        ConferenceEvents.LAST_N_ENDPOINTS_CHANGED,
138
+        function (ids) {
139
+            APP.UI.handleLastNEndpoints(ids);
140
+        }
141
+    );
142
+
143
+    return initConference(connection, room);
144
+}
145
+
146
+function init() {
147
+    connect().then(function (connection) {
148
+        return initConference(connection, UI.generateRoomName());
149
+    }).then(function (conference) {
150
+        APP.conference = conference;
151
+        APP.desktopsharing.init();
152
+        APP.statistics.start();
153
+        APP.connectionquality.init();
154
+        APP.keyboardshortcut.init();
155
+        APP.members.start();
156
+    });
46 157
 }
47 158
 
48 159
 /**
@@ -90,11 +201,12 @@ $(document).ready(function () {
90 201
 
91 202
     APP.translation.init();
92 203
 
93
-    if(APP.API.isEnabled())
204
+    if(APP.API.isEnabled()) {
94 205
         APP.API.init();
206
+    }
95 207
 
96
-    APP.UI.start(obtainConfigAndInit);
97
-
208
+    APP.UI.start();
209
+    obtainConfigAndInit();
98 210
 });
99 211
 
100 212
 $(window).bind('beforeunload', function () {
@@ -103,4 +215,3 @@ $(window).bind('beforeunload', function () {
103 215
 });
104 216
 
105 217
 module.exports = APP;
106
-

+ 1
- 0
index.html Parādīt failu

@@ -14,6 +14,7 @@
14 14
     <script src="https://api.callstats.io/static/callstats.min.js"></script>
15 15
     <script src="config.js?v=15"></script><!-- adapt to your needs, i.e. set hosts and bosh path -->
16 16
     <script src="interface_config.js?v=6"></script>
17
+    <script src="libs/lib-jitsi-meet.js?v=139"></script>
17 18
     <script src="libs/app.bundle.min.js?v=139"></script>
18 19
     <script src="analytics.js?v=1"></script><!-- google analytics plugin -->
19 20
     <!--

+ 2
- 2
modules/API/API.js Parādīt failu

@@ -23,8 +23,8 @@ var commands = {};
23 23
 function initCommands() {
24 24
     commands = {
25 25
         displayName: APP.UI.inputDisplayNameHandler,
26
-        toggleAudio: APP.UI.toggleAudio,
27
-        toggleVideo: APP.UI.toggleVideo,
26
+        toggleAudio: APP.conference.toggleAudioMuted,
27
+        toggleVideo: APP.conference.toggleVideoMuted,
28 28
         toggleFilmStrip: APP.UI.toggleFilmStrip,
29 29
         toggleChat: APP.UI.toggleChat,
30 30
         toggleContactList: APP.UI.toggleContactList

+ 94
- 201
modules/UI/UI.js Parādīt failu

@@ -26,10 +26,6 @@ var JitsiPopover = require("./util/JitsiPopover");
26 26
 var CQEvents = require("../../service/connectionquality/CQEvents");
27 27
 var DesktopSharingEventTypes
28 28
     = require("../../service/desktopsharing/DesktopSharingEventTypes");
29
-var MediaStreamType = require("../../service/RTC/MediaStreamTypes");
30
-var RTCEvents = require("../../service/RTC/RTCEvents");
31
-var RTCBrowserType = require("../RTC/RTCBrowserType");
32
-var StreamEventTypes = require("../../service/RTC/StreamEventTypes");
33 29
 var XMPPEvents = require("../../service/xmpp/XMPPEvents");
34 30
 var StatisticsEvents = require("../../service/statistics/Events");
35 31
 var UIEvents = require("../../service/UI/UIEvents");
@@ -86,11 +82,6 @@ function promptDisplayName() {
86 82
     );
87 83
 }
88 84
 
89
-function notifyForInitialMute() {
90
-    messageHandler.notify(null, "notify.mutedTitle", "connected",
91
-        "notify.muted", null, {timeOut: 120000});
92
-}
93
-
94 85
 function setupPrezi() {
95 86
     $("#reloadPresentationLink").click(function() {
96 87
         Prezi.reloadPresentation();
@@ -110,38 +101,6 @@ function setupToolbars() {
110 101
     BottomToolbar.init(eventEmitter);
111 102
 }
112 103
 
113
-function streamHandler(stream, isMuted) {
114
-    switch (stream.type) {
115
-        case MediaStreamType.AUDIO_TYPE:
116
-            VideoLayout.changeLocalAudio(stream, isMuted);
117
-            break;
118
-        case MediaStreamType.VIDEO_TYPE:
119
-            VideoLayout.changeLocalVideo(stream, isMuted);
120
-            break;
121
-        default:
122
-            console.error("Unknown stream type: " + stream.type);
123
-            break;
124
-    }
125
-}
126
-
127
-function onXmppConnectionFailed(stropheErrorMsg) {
128
-
129
-    var title = APP.translation.generateTranslationHTML(
130
-        "dialog.error");
131
-
132
-    var message;
133
-    if (stropheErrorMsg) {
134
-        message = APP.translation.generateTranslationHTML(
135
-            "dialog.connectErrorWithMsg", {msg: stropheErrorMsg});
136
-    } else {
137
-        message = APP.translation.generateTranslationHTML(
138
-            "dialog.connectError");
139
-    }
140
-
141
-    messageHandler.openDialog(
142
-        title, message, true, {}, function (e, v, m, f) { return false; });
143
-}
144
-
145 104
 function onDisposeConference(unload) {
146 105
     Toolbar.showAuthenticateButton(false);
147 106
 }
@@ -153,74 +112,6 @@ function onDisplayNameChanged(jid, displayName) {
153 112
 }
154 113
 
155 114
 function registerListeners() {
156
-    APP.RTC.addStreamListener(streamHandler,
157
-        StreamEventTypes.EVENT_TYPE_LOCAL_CREATED);
158
-    APP.RTC.addStreamListener(streamHandler,
159
-        StreamEventTypes.EVENT_TYPE_LOCAL_CHANGED);
160
-    APP.RTC.addStreamListener(function (stream) {
161
-        VideoLayout.onRemoteStreamAdded(stream);
162
-    }, StreamEventTypes.EVENT_TYPE_REMOTE_CREATED);
163
-    APP.RTC.addListener(RTCEvents.LASTN_CHANGED, onLastNChanged);
164
-    APP.RTC.addListener(RTCEvents.DOMINANTSPEAKER_CHANGED,
165
-        function (resourceJid) {
166
-        VideoLayout.onDominantSpeakerChanged(resourceJid);
167
-    });
168
-    APP.RTC.addListener(RTCEvents.LASTN_ENDPOINT_CHANGED,
169
-        function (lastNEndpoints, endpointsEnteringLastN, stream) {
170
-            VideoLayout.onLastNEndpointsChanged(lastNEndpoints,
171
-                endpointsEnteringLastN, stream);
172
-        });
173
-    APP.RTC.addListener(RTCEvents.AVAILABLE_DEVICES_CHANGED,
174
-        function (devices) {
175
-            VideoLayout.setDeviceAvailabilityIcons(null, devices);
176
-        });
177
-    APP.RTC.addListener(RTCEvents.VIDEO_MUTE, UI.setVideoMuteButtonsState);
178
-    APP.RTC.addListener(RTCEvents.DATA_CHANNEL_OPEN, function () {
179
-        // when the data channel becomes available, tell the bridge about video
180
-        // selections so that it can do adaptive simulcast,
181
-        // we want the notification to trigger even if userJid is undefined,
182
-        // or null.
183
-        var userResource = APP.UI.getLargeVideoResource();
184
-        eventEmitter.emit(UIEvents.SELECTED_ENDPOINT, userResource);
185
-    });
186
-    APP.statistics.addListener(StatisticsEvents.AUDIO_LEVEL,
187
-        function(jid, audioLevel) {
188
-        var resourceJid;
189
-        if(jid === APP.statistics.LOCAL_JID) {
190
-            resourceJid = AudioLevels.LOCAL_LEVEL;
191
-            if(APP.RTC.localAudio.isMuted()) {
192
-                audioLevel = 0;
193
-            }
194
-        } else {
195
-            resourceJid = Strophe.getResourceFromJid(jid);
196
-        }
197
-
198
-        AudioLevels.updateAudioLevel(resourceJid, audioLevel,
199
-            UI.getLargeVideoResource());
200
-    });
201
-    APP.desktopsharing.addListener(
202
-        DesktopSharingEventTypes.INIT,
203
-        ToolbarToggler.showToolbar);
204
-    APP.desktopsharing.addListener(
205
-        DesktopSharingEventTypes.SWITCHING_DONE,
206
-        Toolbar.changeDesktopSharingButtonState);
207
-    APP.desktopsharing.addListener(
208
-        DesktopSharingEventTypes.FIREFOX_EXTENSION_NEEDED,
209
-        function (url) {
210
-            APP.UI.messageHandler.openMessageDialog(
211
-                "dialog.extensionRequired",
212
-                null,
213
-                null,
214
-                APP.translation.generateTranslationHTML(
215
-                    "dialog.firefoxExtensionPrompt", {url: url}));
216
-        });
217
-    APP.connectionquality.addListener(CQEvents.LOCALSTATS_UPDATED,
218
-        VideoLayout.updateLocalConnectionStats);
219
-    APP.connectionquality.addListener(CQEvents.REMOTESTATS_UPDATED,
220
-        VideoLayout.updateConnectionStats);
221
-    APP.connectionquality.addListener(CQEvents.STOP,
222
-        VideoLayout.onStatsStop);
223
-    APP.xmpp.addListener(XMPPEvents.CONNECTION_FAILED, onXmppConnectionFailed);
224 115
     APP.xmpp.addListener(XMPPEvents.DISPOSE_CONFERENCE, onDisposeConference);
225 116
     APP.xmpp.addListener(XMPPEvents.GRACEFUL_SHUTDOWN, function () {
226 117
         messageHandler.openMessageDialog(
@@ -287,17 +178,11 @@ function registerListeners() {
287 178
         VideoLayout.onAudioMute);
288 179
     APP.xmpp.addListener(XMPPEvents.PARTICIPANT_VIDEO_MUTED,
289 180
         VideoLayout.onVideoMute);
290
-    APP.xmpp.addListener(XMPPEvents.AUDIO_MUTED_BY_FOCUS, function (doMuteAudio) {
291
-        UI.setAudioMuted(doMuteAudio);
292
-    });
293 181
     APP.members.addListener(MemberEvents.DTMF_SUPPORT_CHANGED,
294 182
         onDtmfSupportChanged);
295 183
     APP.xmpp.addListener(XMPPEvents.START_MUTED_SETTING_CHANGED, function (audio, video) {
296 184
         SettingsMenu.setStartMuted(audio, video);
297 185
     });
298
-    APP.xmpp.addListener(XMPPEvents.START_MUTED_FROM_FOCUS, function (audio, video) {
299
-        UI.setInitialMuteFromFocus(audio, video);
300
-    });
301 186
 
302 187
     APP.xmpp.addListener(XMPPEvents.JINGLE_FATAL_ERROR, function (session, error) {
303 188
         UI.messageHandler.showError("dialog.sorry",
@@ -357,22 +242,6 @@ function registerListeners() {
357 242
     }
358 243
 }
359 244
 
360
-
361
-/**
362
- * Mutes/unmutes the local video.
363
- *
364
- * @param mute <tt>true</tt> to mute the local video; otherwise, <tt>false</tt>
365
- * @param options an object which specifies optional arguments such as the
366
- * <tt>boolean</tt> key <tt>byUser</tt> with default value <tt>true</tt> which
367
- * specifies whether the method was initiated in response to a user command (in
368
- * contrast to an automatic decision taken by the application logic)
369
- */
370
-function setVideoMute(mute, options) {
371
-    APP.RTC.setVideoMute(mute,
372
-        UI.setVideoMuteButtonsState,
373
-        options);
374
-}
375
-
376 245
 function onResize() {
377 246
     Chat.resizeChat();
378 247
     VideoLayout.resizeLargeVideoContainer();
@@ -388,7 +257,7 @@ function bindEvents() {
388 257
     $(window).resize(onResize);
389 258
 }
390 259
 
391
-UI.start = function (init) {
260
+UI.start = function () {
392 261
     document.title = interfaceConfig.APP_NAME;
393 262
     var setupWelcomePage = null;
394 263
     if(config.enableWelcomePage && window.location.pathname == "/" &&
@@ -457,8 +326,6 @@ UI.start = function (init) {
457 326
         }
458 327
     }
459 328
 
460
-    init();
461
-
462 329
     if (!interfaceConfig.filmStripOnly) {
463 330
         toastr.options = {
464 331
             "closeButton": true,
@@ -489,6 +356,26 @@ UI.start = function (init) {
489 356
 
490 357
 };
491 358
 
359
+
360
+UI.addLocalStream = function (stream, isMuted) {
361
+    switch (stream.type) {
362
+    case 'audio':
363
+        VideoLayout.changeLocalAudio(stream, isMuted);
364
+        break;
365
+    case 'video':
366
+        VideoLayout.changeLocalVideo(stream, isMuted);
367
+        break;
368
+    default:
369
+        console.error("Unknown stream type: " + stream.type);
370
+        break;
371
+    }
372
+};
373
+
374
+
375
+UI.addRemoteStream = function (stream) {
376
+    VideoLayout.onRemoteStreamAdded(stream);
377
+};
378
+
492 379
 function chatAddError(errorMessage, originalText) {
493 380
     return Chat.chatAddError(errorMessage, originalText);
494 381
 }
@@ -665,13 +552,6 @@ function onAuthenticationRequired(intervalCallback) {
665 552
 }
666 553
 
667 554
 
668
-function onLastNChanged(oldValue, newValue) {
669
-    if (config.muteLocalVideoIfNotInLastN) {
670
-        setVideoMute(!newValue, { 'byUser': false });
671
-    }
672
-}
673
-
674
-
675 555
 UI.toggleSmileys = function () {
676 556
     Chat.toggleSmileys();
677 557
 };
@@ -696,10 +576,6 @@ UI.inputDisplayNameHandler = function (value) {
696 576
     VideoLayout.inputDisplayNameHandler(value);
697 577
 };
698 578
 
699
-UI.getLargeVideoResource = function () {
700
-    return VideoLayout.getLargeVideoResource();
701
-};
702
-
703 579
 /**
704 580
  * Return the type of the remote video.
705 581
  * @param jid the jid for the remote video
@@ -814,51 +690,16 @@ UI.getRoomName = function () {
814 690
     return roomName;
815 691
 };
816 692
 
817
-UI.setInitialMuteFromFocus = function (muteAudio, muteVideo) {
818
-    if (muteAudio || muteVideo)
819
-        notifyForInitialMute();
820
-    if (muteAudio)
821
-        UI.setAudioMuted(true);
822
-    if (muteVideo)
823
-        UI.setVideoMute(true);
824
-};
825
-
826
-/**
827
- * Mutes/unmutes the local video.
828
- */
829
-UI.toggleVideo = function () {
830
-    setVideoMute(!APP.RTC.localVideo.isMuted());
831
-};
832
-
833
-/**
834
- * Mutes / unmutes audio for the local participant.
835
- */
836
-UI.toggleAudio = function() {
837
-    UI.setAudioMuted(!APP.RTC.localAudio.isMuted());
838
-};
839
-
840 693
 /**
841 694
  * Sets muted audio state for the local participant.
842 695
  */
843
-UI.setAudioMuted = function (mute, earlyMute) {
844
-    var audioMute = null;
845
-    if (earlyMute)
846
-        audioMute = function (mute, cb) {
847
-            return APP.xmpp.sendAudioInfoPresence(mute, cb);
848
-        };
849
-    else
850
-        audioMute = function (mute, cb) {
851
-            return APP.xmpp.setAudioMute(mute, cb);
852
-        };
853
-    if (!audioMute(mute, function () {
854
-            VideoLayout.showLocalAudioIndicator(mute);
696
+UI.setAudioMuted = function (mute) {
697
+    VideoLayout.showLocalAudioIndicator(mute);
698
+    UIUtil.buttonClick("#toolbar_button_mute", "icon-microphone icon-mic-disabled");
699
+};
855 700
 
856
-            UIUtil.buttonClick("#toolbar_button_mute", "icon-microphone icon-mic-disabled");
857
-        })) {
858
-        // We still click the button.
859
-        UIUtil.buttonClick("#toolbar_button_mute", "icon-microphone icon-mic-disabled");
860
-        return;
861
-    }
701
+UI.setVideoMuted = function (muted) {
702
+    $('#toolbar_button_camera').toggleClass("icon-camera-disabled", muted);
862 703
 };
863 704
 
864 705
 UI.addListener = function (type, listener) {
@@ -882,27 +723,79 @@ UI.dockToolbar = function (isDock) {
882 723
     return ToolbarToggler.dockToolbar(isDock);
883 724
 };
884 725
 
885
-UI.setVideoMuteButtonsState = function (mute) {
886
-    var video = $('#toolbar_button_camera');
887
-    var communicativeClass = "icon-camera";
888
-    var muteClass = "icon-camera icon-camera-disabled";
726
+UI.userAvatarChanged = function (resourceJid, thumbUrl, contactListUrl) {
727
+    VideoLayout.userAvatarChanged(resourceJid, thumbUrl);
728
+    ContactList.userAvatarChanged(resourceJid, contactListUrl);
729
+    if(resourceJid === APP.xmpp.myResource()) {
730
+        SettingsMenu.changeAvatar(thumbUrl);
731
+    }
732
+};
733
+
734
+UI.notifyConnectionFailed = function (stropheErrorMsg) {
735
+    var title = APP.translation.generateTranslationHTML(
736
+        "dialog.error");
889 737
 
890
-    if (mute) {
891
-        video.removeClass(communicativeClass);
892
-        video.addClass(muteClass);
738
+    var message;
739
+    if (stropheErrorMsg) {
740
+        message = APP.translation.generateTranslationHTML(
741
+            "dialog.connectErrorWithMsg", {msg: stropheErrorMsg});
893 742
     } else {
894
-        video.removeClass(muteClass);
895
-        video.addClass(communicativeClass);
743
+        message = APP.translation.generateTranslationHTML(
744
+            "dialog.connectError");
896 745
     }
746
+
747
+    messageHandler.openDialog(
748
+        title, message, true, {}, function (e, v, m, f) { return false; }
749
+    );
897 750
 };
898 751
 
899
-UI.userAvatarChanged = function (resourceJid, thumbUrl, contactListUrl) {
900
-    VideoLayout.userAvatarChanged(resourceJid, thumbUrl);
901
-    ContactList.userAvatarChanged(resourceJid, contactListUrl);
902
-    if(resourceJid === APP.xmpp.myResource())
903
-        SettingsMenu.changeAvatar(thumbUrl);
752
+UI.notifyFirefoxExtensionRequired = function (url) {
753
+    messageHandler.openMessageDialog(
754
+        "dialog.extensionRequired",
755
+        null,
756
+        null,
757
+        APP.translation.generateTranslationHTML(
758
+            "dialog.firefoxExtensionPrompt", {url: url}
759
+        )
760
+    );
761
+};
762
+
763
+UI.notifyInitiallyMuted = function () {
764
+    messageHandler.notify(
765
+        null, "notify.mutedTitle", "connected", "notify.muted", null, {timeOut: 120000}
766
+    );
767
+};
768
+
769
+UI.markDominantSpiker = function (id) {
770
+    VideoLayout.onDominantSpeakerChanged(id);
771
+};
772
+
773
+UI.handleLastNEndpoints = function (ids) {
774
+    VideoLayout.onLastNEndpointsChanged(ids, []);
775
+};
776
+
777
+UI.setAudioLevel = function (targetJid, lvl) {
778
+    AudioLevels.updateAudioLevel(
779
+        targetJid, lvl, VideoLayout.getLargeVideoResource()
780
+    );
781
+};
782
+
783
+UI.showToolbar = ToolbarToggler.showToolbar;
784
+
785
+UI.updateDesktopSharingButtons = function () {
786
+    Toolbar.changeDesktopSharingButtonState();
787
+};
788
+
789
+UI.hideStats = function () {
790
+    VideoLayout.hideStats();
904 791
 };
905 792
 
906
-UI.setVideoMute = setVideoMute;
793
+UI.updateLocalStats = function (percent, stats) {
794
+    VideoLayout.updateLocalConnectionStats(percent, stats);
795
+};
796
+
797
+UI.updateRemoteStats = function (jid, percent, stats) {
798
+    VideoLayout.updateConnectionStats(jid, percent, stats);
799
+};
907 800
 
908 801
 module.exports = UI;

+ 2
- 2
modules/UI/toolbars/Toolbar.js Parādīt failu

@@ -25,7 +25,7 @@ var buttonHandlers = {
25 25
         } else {
26 26
             AnalyticsAdapter.sendEvent('toolbar.audio.muted');
27 27
         }
28
-        return APP.UI.toggleAudio();
28
+        return APP.conference.toggleAudioMuted();
29 29
     },
30 30
     "toolbar_button_camera": function () {
31 31
         if (APP.RTC.localVideo.isMuted()) {
@@ -33,7 +33,7 @@ var buttonHandlers = {
33 33
         } else {
34 34
             AnalyticsAdapter.sendEvent('toolbar.video.disabled');
35 35
         }
36
-        return APP.UI.toggleVideo();
36
+        return APP.conference.toggleVideoMuted();
37 37
     },
38 38
     /*"toolbar_button_authentication": function () {
39 39
         return Toolbar.authenticateClicked();

+ 9
- 10
modules/UI/videolayout/VideoLayout.js Parādīt failu

@@ -56,8 +56,9 @@ var VideoLayout = (function (my) {
56 56
     };
57 57
 
58 58
     my.changeLocalAudio = function(stream, isMuted) {
59
-        if (isMuted)
60
-            APP.UI.setAudioMuted(true, true);
59
+        if (isMuted) { // FIXME remove this?
60
+            APP.conference.muteAudio(true);
61
+        }
61 62
         APP.RTC.attachMediaStream($('#localAudio'), stream.getOriginalStream());
62 63
         var localAudio = document.getElementById('localAudio');
63 64
         // Writing volume not allowed in IE
@@ -177,7 +178,7 @@ var VideoLayout = (function (my) {
177 178
         console.info("electLastVisibleVideo: " + jid);
178 179
         return jid;
179 180
     };
180
-    
181
+
181 182
     my.onRemoteStreamAdded = function (stream) {
182 183
         if (stream.peerjid) {
183 184
             VideoLayout.ensurePeerContainerExists(stream.peerjid);
@@ -277,9 +278,9 @@ var VideoLayout = (function (my) {
277 278
     /**
278 279
      * Checks if container for participant identified by given peerJid exists
279 280
      * in the document and creates it eventually.
280
-     * 
281
+     *
281 282
      * @param peerJid peer Jid to check.
282
-     * 
283
+     *
283 284
      * @return Returns <tt>true</tt> if the peer container exists,
284 285
      * <tt>false</tt> - otherwise
285 286
      */
@@ -652,9 +653,7 @@ var VideoLayout = (function (my) {
652 653
      * @param endpointsEnteringLastN the list currently entering last N
653 654
      * endpoints
654 655
      */
655
-    my.onLastNEndpointsChanged = function (lastNEndpoints,
656
-                                           endpointsEnteringLastN,
657
-                                           stream) {
656
+    my.onLastNEndpointsChanged = function (lastNEndpoints, endpointsEnteringLastN) {
658 657
         if (lastNCount !== lastNEndpoints.length)
659 658
             lastNCount = lastNEndpoints.length;
660 659
 
@@ -847,7 +846,7 @@ var VideoLayout = (function (my) {
847 846
     /**
848 847
      * Hides all the indicators
849 848
      */
850
-    my.onStatsStop = function () {
849
+    my.hideStats = function () {
851 850
         for(var video in remoteVideos) {
852 851
             remoteVideos[video].hideIndicator();
853 852
         }
@@ -879,7 +878,7 @@ var VideoLayout = (function (my) {
879 878
 
880 879
         VideoLayout.resizeThumbnails();
881 880
     };
882
-    
881
+
883 882
     my.onVideoTypeChanged = function (resourceJid, newVideoType) {
884 883
         if (remoteVideoTypes[resourceJid] === newVideoType) {
885 884
             return;

+ 4
- 4
modules/keyboardshortcut/keyboardshortcut.js Parādīt failu

@@ -21,20 +21,20 @@ function initShortcutHandlers() {
21 21
         77: {
22 22
             character: "M",
23 23
             id: "mutePopover",
24
-            function: APP.UI.toggleAudio
24
+            function: APP.conference.toggleAudioMuted
25 25
         },
26 26
         84: {
27 27
             character: "T",
28 28
             function: function() {
29 29
                 if(!APP.RTC.localAudio.isMuted()) {
30
-                    APP.UI.toggleAudio();
30
+                    APP.conference.toggleAudioMuted();
31 31
                 }
32 32
             }
33 33
         },
34 34
         86: {
35 35
             character: "V",
36 36
             id: "toggleVideoPopover",
37
-            function: APP.UI.toggleVideo
37
+            function: APP.conference.toggleVideoMuted
38 38
         }
39 39
     };
40 40
 }
@@ -68,7 +68,7 @@ var KeyboardShortcut = {
68 68
                 $(":focus").is("textarea"))) {
69 69
                 if(e.which === "T".charCodeAt(0)) {
70 70
                     if(APP.RTC.localAudio.isMuted()) {
71
-                        APP.UI.toggleAudio();
71
+                        APP.conference.toggleAudioMuted();
72 72
                     }
73 73
                 }
74 74
             }

+ 2
- 3
modules/xmpp/strophe.moderate.js Parādīt failu

@@ -1,5 +1,4 @@
1
-/* global $, $iq, config, connection, focusMucJid, forceMuted,
2
-   setAudioMuted, Strophe */
1
+/* global $, $iq, config, connection, focusMucJid, forceMuted, Strophe */
3 2
 /**
4 3
  * Moderate connection plugin.
5 4
  */
@@ -58,4 +57,4 @@ module.exports = function (XMPP, eventEmitter) {
58 57
             this.connection.emuc.kick(jid);
59 58
         }
60 59
     });
61
-};
60
+};

Notiek ielāde…
Atcelt
Saglabāt