Merge pull request #323 from pstros/remove-ui-refs-from-xmpp-upstream
Remove UI refs from xmpp and RTC
This commit is contained in:
commit
03902de511
|
@ -22,7 +22,7 @@
|
|||
<script src="libs/popover.js?v=1"></script><!-- bootstrap tooltip lib -->
|
||||
<script src="libs/toastr.js?v=1"></script><!-- notifications lib -->
|
||||
<script src="interface_config.js?v=5"></script>
|
||||
<script src="libs/app.bundle.js?v=110"></script>
|
||||
<script src="libs/app.bundle.js?v=111"></script>
|
||||
<script src="analytics.js?v=1"></script><!-- google analytics plugin -->
|
||||
<link rel="stylesheet" href="css/font.css?v=7"/>
|
||||
<link rel="stylesheet" href="css/toastr.css?v=1">
|
||||
|
|
38179
libs/app.bundle.js
38179
libs/app.bundle.js
File diff suppressed because it is too large
Load Diff
|
@ -32,14 +32,7 @@ var DataChannels =
|
|||
// Sends 12 bytes binary message to the bridge
|
||||
//dataChannel.send(new ArrayBuffer(12));
|
||||
|
||||
// when the data channel becomes available, tell the bridge about video
|
||||
// selections so that it can do adaptive simulcast,
|
||||
// we want the notification to trigger even if userJid is undefined,
|
||||
// or null.
|
||||
var userJid = APP.UI.getLargeVideoJid();
|
||||
// we want the notification to trigger even if userJid is undefined,
|
||||
// or null.
|
||||
onSelectedEndpointChanged(userJid);
|
||||
eventEmitter.emit(RTCEvents.DATA_CHANNEL_OPEN);
|
||||
};
|
||||
|
||||
dataChannel.onerror = function (error) {
|
||||
|
|
|
@ -207,7 +207,10 @@ var RTC = {
|
|||
if(this.localVideo.isMuted() && this.localVideo.videoType !== type)
|
||||
{
|
||||
localCallback = function() {
|
||||
APP.xmpp.setVideoMute(false, APP.UI.setVideoMuteButtonsState);
|
||||
APP.xmpp.setVideoMute(false, function(mute) {
|
||||
eventEmitter.emit(RTCEvents.VIDEO_MUTE, mute);
|
||||
});
|
||||
|
||||
callback();
|
||||
};
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ var RTCEvents = require("../../service/RTC/RTCEvents");
|
|||
var RTCBrowserType = require("../RTC/RTCBrowserType");
|
||||
var StreamEventTypes = require("../../service/RTC/StreamEventTypes");
|
||||
var XMPPEvents = require("../../service/xmpp/XMPPEvents");
|
||||
var UIEvents = require("../../service/UI/UIEvents");
|
||||
var MemberEvents = require("../../service/members/Events");
|
||||
|
||||
var eventEmitter = new EventEmitter();
|
||||
|
@ -172,7 +173,16 @@ function registerListeners() {
|
|||
APP.RTC.addListener(RTCEvents.AVAILABLE_DEVICES_CHANGED,
|
||||
function (devices) {
|
||||
VideoLayout.setDeviceAvailabilityIcons(null, devices);
|
||||
})
|
||||
});
|
||||
APP.RTC.addListener(RTCEvents.VIDEO_MUTE, UI.setVideoMuteButtonsState);
|
||||
APP.RTC.addListener(RTCEvents.DATA_CHANNEL_OPEN, function() {
|
||||
// when the data channel becomes available, tell the bridge about video
|
||||
// selections so that it can do adaptive simulcast,
|
||||
// we want the notification to trigger even if userJid is undefined,
|
||||
// or null.
|
||||
var userJid = APP.UI.getLargeVideoJid();
|
||||
eventEmitter.emit(UIEvents.SELECTED_ENDPOINT, userJid);
|
||||
});
|
||||
APP.statistics.addAudioLevelListener(function(jid, audioLevel)
|
||||
{
|
||||
var resourceJid;
|
||||
|
@ -271,11 +281,64 @@ function registerListeners() {
|
|||
|
||||
APP.xmpp.addListener(XMPPEvents.AUDIO_MUTED, VideoLayout.onAudioMute);
|
||||
APP.xmpp.addListener(XMPPEvents.VIDEO_MUTED, VideoLayout.onVideoMute);
|
||||
APP.xmpp.addListener(XMPPEvents.AUDIO_MUTED_BY_FOCUS, function(doMuteAudio) {
|
||||
UI.setAudioMuted(doMuteAudio);
|
||||
});
|
||||
APP.members.addListener(MemberEvents.DTMF_SUPPORT_CHANGED,
|
||||
onDtmfSupportChanged);
|
||||
APP.xmpp.addListener(XMPPEvents.START_MUTED, function (audio, video) {
|
||||
APP.xmpp.addListener(XMPPEvents.START_MUTED_SETTING_CHANGED, function (audio, video) {
|
||||
SettingsMenu.setStartMuted(audio, video);
|
||||
});
|
||||
APP.xmpp.addListener(XMPPEvents.START_MUTED_FROM_FOCUS, function (audio, video) {
|
||||
UI.setInitialMuteFromFocus(audio, video);
|
||||
});
|
||||
|
||||
APP.xmpp.addListener(XMPPEvents.JINGLE_FATAL_ERROR, function (session, error) {
|
||||
UI.messageHandler.showError("dialog.sorry",
|
||||
"dialog.internalError");
|
||||
});
|
||||
|
||||
APP.xmpp.addListener(XMPPEvents.SET_LOCAL_DESCRIPTION_ERROR, function() {
|
||||
messageHandler.showError("dialog.error",
|
||||
"dialog.SLDFailure");
|
||||
});
|
||||
APP.xmpp.addListener(XMPPEvents.SET_REMOTE_DESCRIPTION_ERROR, function() {
|
||||
messageHandler.showError("dialog.error",
|
||||
"dialog.SRDFailure");
|
||||
});
|
||||
APP.xmpp.addListener(XMPPEvents.CREATE_ANSWER_ERROR, function() {
|
||||
messageHandler.showError();
|
||||
});
|
||||
APP.xmpp.addListener(XMPPEvents.PROMPT_FOR_LOGIN, function() {
|
||||
// FIXME: re-use LoginDialog which supports retries
|
||||
UI.showLoginPopup(connect);
|
||||
});
|
||||
|
||||
APP.xmpp.addListener(XMPPEvents.FOCUS_DISCONNECTED, function(focusComponent, retrySec) {
|
||||
UI.messageHandler.notify(
|
||||
null, "notify.focus",
|
||||
'disconnected', "notify.focusFail",
|
||||
{component: focusComponent, ms: retrySec});
|
||||
});
|
||||
|
||||
APP.xmpp.addListener(XMPPEvents.ROOM_JOIN_ERROR, function(pres) {
|
||||
UI.messageHandler.openReportDialog(null,
|
||||
"dialog.joinError", pres);
|
||||
});
|
||||
APP.xmpp.addListener(XMPPEvents.ROOM_CONNECT_ERROR, function(pres) {
|
||||
UI.messageHandler.openReportDialog(null,
|
||||
"dialog.connectError", pres);
|
||||
});
|
||||
|
||||
APP.xmpp.addListener(XMPPEvents.READY_TO_JOIN, function() {
|
||||
var roomName = UI.generateRoomName();
|
||||
APP.xmpp.allocateConferenceFocus(roomName, UI.checkForNicknameAndJoin);
|
||||
});
|
||||
|
||||
//NicknameHandler emits this event
|
||||
UI.addListener(UIEvents.NICKNAME_CHANGED, function (nickname) {
|
||||
APP.xmpp.addToPresence("displayName", nickname);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ function JingleSession(me, sid, connection, service, eventEmitter) {
|
|||
this.ice_config = {};
|
||||
this.drip_container = [];
|
||||
this.service = service;
|
||||
this.eventEmitter = eventEmitter;
|
||||
|
||||
this.usetrickle = true;
|
||||
this.usepranswer = false; // early transport warmup -- mind you, this might fail. depends on webrtc issue 1718
|
||||
|
@ -131,7 +132,7 @@ JingleSession.prototype.initiate = function (peerjid, isInitiator) {
|
|||
this.stopTime = new Date();
|
||||
break;
|
||||
case 'failed':
|
||||
self.eventEmitter(XMPPEvents.CONFERENCE_SETUP_FAILED);
|
||||
self.eventEmitter.emit(XMPPEvents.CONFERENCE_SETUP_FAILED);
|
||||
break;
|
||||
}
|
||||
onIceConnectionStateChange(self.sid, self);
|
||||
|
@ -1283,9 +1284,8 @@ JingleSession.onJingleFatalError = function (session, error)
|
|||
{
|
||||
this.service.sessionTerminated = true;
|
||||
this.connection.emuc.doLeave();
|
||||
APP.UI.messageHandler.showError("dialog.sorry",
|
||||
"dialog.internalError");
|
||||
this.eventEmitter.emit(XMPPEvents.CONFERENCE_SETUP_FAILED);
|
||||
this.eventEmitter.emit(XMPPEvents.JINGLE_FATAL_ERROR, session, error);
|
||||
}
|
||||
|
||||
JingleSession.prototype.setLocalDescription = function () {
|
||||
|
@ -1348,19 +1348,19 @@ function sendKeyframe(pc) {
|
|||
},
|
||||
function (error) {
|
||||
console.log('triggerKeyframe setLocalDescription failed', error);
|
||||
APP.UI.messageHandler.showError();
|
||||
eventEmitter.emit(XMPPEvents.SET_LOCAL_DESCRIPTION_ERROR);
|
||||
}
|
||||
);
|
||||
},
|
||||
function (error) {
|
||||
console.log('triggerKeyframe createAnswer failed', error);
|
||||
APP.UI.messageHandler.showError();
|
||||
eventEmitter.emit(XMPPEvents.CREATE_ANSWER_ERROR);
|
||||
}
|
||||
);
|
||||
},
|
||||
function (error) {
|
||||
console.log('triggerKeyframe setRemoteDescription failed', error);
|
||||
APP.UI.messageHandler.showError();
|
||||
eventEmitter.emit(XMPPEvents.SET_REMOTE_DESCRIPTION_ERROR);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* global $, $iq, APP, config, connection, UI, messageHandler,
|
||||
/* global $, $iq, APP, config, connection, messageHandler,
|
||||
roomName, sessionTerminated, Strophe, Util */
|
||||
var XMPPEvents = require("../../service/xmpp/XMPPEvents");
|
||||
var Settings = require("../settings/Settings");
|
||||
|
@ -333,10 +333,7 @@ var Moderator = {
|
|||
// Do not show in case of session invalid
|
||||
// which means just a retry
|
||||
if (!invalidSession) {
|
||||
APP.UI.messageHandler.notify(
|
||||
null, "notify.focus",
|
||||
'disconnected', "notify.focusFail",
|
||||
{component: focusComponent, ms: retrySec});
|
||||
eventEmitter.emit(XMPPEvents.FOCUS_DISCONNECTED, focusComponent, retrySec);
|
||||
}
|
||||
// Reset response timeout
|
||||
getNextTimeout(true);
|
||||
|
|
|
@ -155,7 +155,7 @@ module.exports = function(XMPP, eventEmitter) {
|
|||
var startMuted = $(pres).find('>startmuted');
|
||||
if (startMuted.length)
|
||||
{
|
||||
eventEmitter.emit(XMPPEvents.START_MUTED,
|
||||
eventEmitter.emit(XMPPEvents.START_MUTED_SETTING_CHANGED,
|
||||
startMuted.attr("audio") === "true", startMuted.attr("video") === "true");
|
||||
}
|
||||
|
||||
|
@ -321,19 +321,15 @@ module.exports = function(XMPP, eventEmitter) {
|
|||
// We're either missing Jicofo/Prosody config for anonymous
|
||||
// domains or something is wrong.
|
||||
// XMPP.promptLogin();
|
||||
APP.UI.messageHandler.openReportDialog(null,
|
||||
"dialog.joinError", pres);
|
||||
eventEmitter.emit(XMPPEvents.ROOM_JOIN_ERROR, pres);
|
||||
|
||||
} else {
|
||||
console.warn('onPresError ', pres);
|
||||
APP.UI.messageHandler.openReportDialog(null,
|
||||
"dialog.connectError",
|
||||
pres);
|
||||
eventEmitter.emit(XMPPEvents.ROOM_CONNECT_ERROR, pres);
|
||||
}
|
||||
} else {
|
||||
console.warn('onPresError ', pres);
|
||||
APP.UI.messageHandler.openReportDialog(null,
|
||||
"dialog.connectError",
|
||||
pres);
|
||||
eventEmitter.emit(XMPPEvents.ROOM_CONNECT_ERROR, pres);
|
||||
}
|
||||
return true;
|
||||
},
|
||||
|
|
|
@ -119,8 +119,8 @@ module.exports = function(XMPP, eventEmitter)
|
|||
{
|
||||
var audioMuted = startMuted.attr("audio");
|
||||
var videoMuted = startMuted.attr("video");
|
||||
APP.UI.setInitialMuteFromFocus((audioMuted === "true"),
|
||||
(videoMuted === "true"));
|
||||
eventEmitter.emit(XMPPEvents.START_MUTED_FROM_FOCUS,
|
||||
autioMuted === "true", videoMuted === "true");
|
||||
}
|
||||
sess = new JingleSession(
|
||||
$(iq).attr('to'), $(iq).find('jingle').attr('sid'),
|
||||
|
|
|
@ -3,7 +3,9 @@
|
|||
/**
|
||||
* Moderate connection plugin.
|
||||
*/
|
||||
module.exports = function (XMPP) {
|
||||
var XMPPEvents = require("../../service/xmpp/XMPPEvents");
|
||||
|
||||
module.exports = function (XMPP, eventEmitter) {
|
||||
Strophe.addConnectionPlugin('moderate', {
|
||||
connection: null,
|
||||
init: function (conn) {
|
||||
|
@ -44,7 +46,7 @@ module.exports = function (XMPP) {
|
|||
var mute = $(iq).find('mute');
|
||||
if (mute.length) {
|
||||
var doMuteAudio = mute.text() === "true";
|
||||
APP.UI.setAudioMuted(doMuteAudio);
|
||||
eventEmitter.emit(XMPPEvents.AUDIO_MUTED_BY_FOCUS, doMuteAudio);
|
||||
XMPP.forceMuted = doMuteAudio;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -7,7 +7,6 @@ var Settings = require("../settings/Settings");
|
|||
var Pako = require("pako");
|
||||
var StreamEventTypes = require("../../service/RTC/StreamEventTypes");
|
||||
var RTCEvents = require("../../service/RTC/RTCEvents");
|
||||
var UIEvents = require("../../service/UI/UIEvents");
|
||||
var XMPPEvents = require("../../service/xmpp/XMPPEvents");
|
||||
var retry = require('retry');
|
||||
|
||||
|
@ -163,17 +162,14 @@ function maybeDoJoin() {
|
|||
}
|
||||
|
||||
function doJoin() {
|
||||
var roomName = APP.UI.generateRoomName();
|
||||
|
||||
Moderator.allocateConferenceFocus(
|
||||
roomName, APP.UI.checkForNicknameAndJoin);
|
||||
eventEmitter.emit(XMPPEvents.READY_TO_JOIN);
|
||||
}
|
||||
|
||||
function initStrophePlugins()
|
||||
{
|
||||
require("./strophe.emuc")(XMPP, eventEmitter);
|
||||
require("./strophe.jingle")(XMPP, eventEmitter);
|
||||
require("./strophe.moderate")(XMPP);
|
||||
require("./strophe.moderate")(XMPP, eventEmitter);
|
||||
require("./strophe.util")();
|
||||
require("./strophe.rayo")();
|
||||
require("./strophe.logger")();
|
||||
|
@ -184,9 +180,6 @@ function registerListeners() {
|
|||
StreamEventTypes.EVENT_TYPE_LOCAL_CREATED);
|
||||
APP.RTC.addListener(RTCEvents.AVAILABLE_DEVICES_CHANGED, function (devices) {
|
||||
XMPP.addToPresence("devices", devices);
|
||||
})
|
||||
APP.UI.addListener(UIEvents.NICKNAME_CHANGED, function (nickname) {
|
||||
XMPP.addToPresence("displayName", nickname);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -279,8 +272,7 @@ var XMPP = {
|
|||
return Strophe.getStatusString(status);
|
||||
},
|
||||
promptLogin: function () {
|
||||
// FIXME: re-use LoginDialog which supports retries
|
||||
APP.UI.showLoginPopup(connect);
|
||||
eventEmitter.emit(XMPPEvents.PROMPT_FOR_LOGIN);
|
||||
},
|
||||
joinRoom: function(roomName, useNicks, nick)
|
||||
{
|
||||
|
@ -459,22 +451,19 @@ var XMPP = {
|
|||
},
|
||||
function (error) {
|
||||
console.log('mute SLD error');
|
||||
APP.UI.messageHandler.showError("dialog.error",
|
||||
"dialog.SLDFailure");
|
||||
eventEmitter.emit(XMPPEvents.SET_LOCAL_DESCRIPTION_ERROR);
|
||||
}
|
||||
);
|
||||
},
|
||||
function (error) {
|
||||
console.log(error);
|
||||
APP.UI.messageHandler.showError();
|
||||
eventEmitter.emit(XMPPEvents.CREATE_ANSWER_ERROR);
|
||||
}
|
||||
);
|
||||
},
|
||||
function (error) {
|
||||
console.log('muteVideo SRD error');
|
||||
APP.UI.messageHandler.showError("dialog.error",
|
||||
"dialog.SRDFailure");
|
||||
|
||||
eventEmitter.emit(XMPPEvents.SET_REMOTE_DESCRIPTION_ERROR);
|
||||
}
|
||||
);
|
||||
},
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
var RTCEvents = {
|
||||
RTC_READY: "rtc.ready",
|
||||
DATA_CHANNEL_OPEN: "rtc.data_channel_open",
|
||||
LASTN_CHANGED: "rtc.lastn_changed",
|
||||
DOMINANTSPEAKER_CHANGED: "rtc.dominantspeaker_changed",
|
||||
LASTN_ENDPOINT_CHANGED: "rtc.lastn_endpoint_changed",
|
||||
|
|
|
@ -28,10 +28,22 @@ var XMPPEvents = {
|
|||
CHAT_ERROR_RECEIVED: "xmpp.chat_error_received",
|
||||
ETHERPAD: "xmpp.etherpad",
|
||||
DEVICE_AVAILABLE: "xmpp.device_available",
|
||||
START_MUTED: "xmpp.start_muted",
|
||||
PEERCONNECTION_READY: "xmpp.peerconnection_ready",
|
||||
CONFERENCE_SETUP_FAILED: "xmpp.conference_setup_failed",
|
||||
AUDIO_MUTED: "xmpp.audio_muted",
|
||||
VIDEO_MUTED: "xmpp.video_muted"
|
||||
VIDEO_MUTED: "xmpp.video_muted",
|
||||
AUDIO_MUTED_BY_FOCUS: "xmpp.audio_muted_by_focus",
|
||||
START_MUTED_SETTING_CHANGED: "xmpp.start_muted_setting_changed",
|
||||
START_MUTED_FROM_FOCUS: "xmpp.start_muted_from_focus",
|
||||
SET_LOCAL_DESCRIPTION_ERROR: 'xmpp.set_local_description_error',
|
||||
SET_REMOTE_DESCRIPTION_ERROR: 'xmpp.set_remote_description_error',
|
||||
CREATE_ANSWER_ERROR: 'xmpp.create_answer_error',
|
||||
JINGLE_FATAL_ERROR: 'xmpp.jingle_fatal_error',
|
||||
PROMPT_FOR_LOGIN: 'xmpp.prompt_for_login',
|
||||
FOCUS_DISCONNECTED: 'xmpp.focus_disconnected',
|
||||
ROOM_JOIN_ERROR: 'xmpp.room_join_error',
|
||||
ROOM_CONNECT_ERROR: 'xmpp.room_connect_error',
|
||||
// xmpp is connected and obtained user media
|
||||
READY_TO_JOIN: 'xmpp.ready_to_join'
|
||||
};
|
||||
module.exports = XMPPEvents;
|
Loading…
Reference in New Issue