|
@@ -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;
|