diff --git a/index.html b/index.html index c68a57b0f..3c2f79958 100644 --- a/index.html +++ b/index.html @@ -22,17 +22,18 @@ + - - + - + + - + diff --git a/libs/modules/RTC.bundle.js b/libs/modules/RTC.bundle.js index 8d1510fb7..af91415b6 100644 --- a/libs/modules/RTC.bundle.js +++ b/libs/modules/RTC.bundle.js @@ -4,6 +4,7 @@ // cache datachannels to avoid garbage collection // https://code.google.com/p/chromium/issues/detail?id=405545 var _dataChannels = []; +var eventEmitter = null; @@ -67,9 +68,7 @@ var DataChannels = console.info( "Data channel new dominant speaker event: ", dominantSpeakerEndpoint); - $(document).trigger( - 'dominantspeakerchanged', - [dominantSpeakerEndpoint]); + eventEmitter.emit(RTC.DOMINANTSPEAKER_CHANGED, dominantSpeakerEndpoint); } else if ("InLastNChangeEvent" === colibriClass) { @@ -92,7 +91,8 @@ var DataChannels = newValue = new Boolean(newValue).valueOf(); } } - UI.onLastNChanged(oldValue, newValue); + + eventEmitter.emit(RTCEvents.LASTN_CHANGED, oldValue, newValue); } else if ("LastNEndpointsChangeEvent" === colibriClass) { @@ -107,29 +107,26 @@ var DataChannels = console.log( "Data channel new last-n event: ", lastNEndpoints, endpointsEnteringLastN, obj); - $(document).trigger( - 'lastnchanged', - [lastNEndpoints, endpointsEnteringLastN, stream]); + eventEmitter.emit(RTCEvents.LASTN_ENDPOINT_CHANGED, + lastNEndpoints, endpointsEnteringLastN, obj); } else if ("SimulcastLayersChangedEvent" === colibriClass) { - $(document).trigger( - 'simulcastlayerschanged', - [obj.endpointSimulcastLayers]); + eventEmitter.emit(RTCEvents.SIMULCAST_LAYER_CHANGED, + obj.endpointSimulcastLayers); } else if ("SimulcastLayersChangingEvent" === colibriClass) { - $(document).trigger( - 'simulcastlayerschanging', - [obj.endpointSimulcastLayers]); + eventEmitter.emit(RTCEvents.SIMULCAST_LAYER_CHANGING, + obj.endpointSimulcastLayers); } else if ("StartSimulcastLayerEvent" === colibriClass) { - $(document).trigger('startsimulcastlayer', obj.simulcastLayer); + eventEmitter.emit(RTCEvents.SIMULCAST_START, obj.simulcastLayer); } else if ("StopSimulcastLayerEvent" === colibriClass) { - $(document).trigger('stopsimulcastlayer', obj.simulcastLayer); + eventEmitter.emit(RTCEvents.SIMULCAST_STOP, obj.simulcastLayer); } else { @@ -152,11 +149,12 @@ var DataChannels = * Binds "ondatachannel" event listener to given PeerConnection instance. * @param peerConnection WebRTC peer connection instance. */ - bindDataChannelListener: function (peerConnection) { + init: function (peerConnection, emitter) { if(!config.openSctp) retrun; peerConnection.ondatachannel = this.onDataChannel; + eventEmitter = emitter; // Sample code for opening new data channel from Jitsi Meet to the bridge. // Although it's not a requirement to open separate channels from both bridge @@ -407,6 +405,9 @@ var RTC = { addStreamListener: function (listener, eventType) { eventEmitter.on(eventType, listener); }, + addListener: function (type, listener) { + eventEmitter.on(type, listener); + }, removeStreamListener: function (listener, eventType) { if(!(eventType instanceof StreamEventTypes)) throw "Illegal argument"; @@ -510,7 +511,7 @@ var RTC = { } }); xmpp.addListener(XMPPEvents.CALL_INCOMING, function(event) { - DataChannels.bindDataChannelListener(event.peerconnection); + DataChannels.init(event.peerconnection, eventEmitter); }); this.rtcUtils = new RTCUtils(this); this.rtcUtils.obtainAudioAndVideoPermissions(); diff --git a/libs/modules/UI.bundle.js b/libs/modules/UI.bundle.js index 3b24eea56..48cff595c 100644 --- a/libs/modules/UI.bundle.js +++ b/libs/modules/UI.bundle.js @@ -80,7 +80,23 @@ function registerListeners() { RTC.addStreamListener(function (stream) { VideoLayout.onRemoteStreamAdded(stream); }, StreamEventTypes.EVENT_TYPE_REMOTE_CREATED); - + RTC.addListener(RTCEvents.LASTN_CHANGED, onLastNChanged); + RTC.addListener(RTCEvents.DOMINANTSPEAKER_CHANGED, function (resourceJid) { + VideoLayout.onDominantSpeakerChanged(resourceJid); + }); + RTC.addListener(RTCEvents.LASTN_ENDPOINT_CHANGED, + function (lastNEndpoints, endpointsEnteringLastN, stream) { + VideoLayout.onLastNEndpointsChanged(lastNEndpoints, + endpointsEnteringLastN, stream); + }); + RTC.addListener(RTCEvents.SIMULCAST_LAYER_CHANGED, + function (endpointSimulcastLayers) { + VideoLayout.onSimulcastLayersChanged(endpointSimulcastLayers); + }); + RTC.addListener(RTCEvents.SIMULCAST_LAYER_CHANGING, + function (endpointSimulcastLayers) { + VideoLayout.onSimulcastLayersChanging(endpointSimulcastLayers); + }); VideoLayout.init(); statistics.addAudioLevelListener(function(jid, audioLevel) @@ -156,6 +172,9 @@ function registerListeners() { VideoLayout.updateConnectionStats); connectionquality.addListener(CQEvents.STOP, VideoLayout.onStatsStop); + xmpp.addListener(XMPPEvents.AUTHENTICATION_REQUIRED, onAuthenticationRequired); + + } function bindEvents() @@ -368,21 +387,6 @@ function onMucLeft(jid) { }; -UI.getSettings = function () { - return Settings.getSettings(); -}; - -UI.toggleFilmStrip = function () { - return BottomToolbar.toggleFilmStrip(); -}; - -UI.toggleChat = function () { - return BottomToolbar.toggleChat(); -}; - -UI.toggleContactList = function () { - return BottomToolbar.toggleContactList(); -}; function onLocalRoleChange(jid, info, pres, isModerator, isExternalAuthEnabled) { @@ -468,13 +472,36 @@ function onMucRoleChanged(role, displayName) { } } -UI.onAuthenticationRequired = function (intervalCallback) { +function onAuthenticationRequired(intervalCallback) { Authentication.openAuthenticationDialog( roomName, intervalCallback, function () { Toolbar.authenticateClicked(); }); }; + +function onLastNChanged(oldValue, newValue) { + if (config.muteLocalVideoIfNotInLastN) { + setVideoMute(!newValue, { 'byUser': false }); + } +} + +UI.getSettings = function () { + return Settings.getSettings(); +}; + +UI.toggleFilmStrip = function () { + return BottomToolbar.toggleFilmStrip(); +}; + +UI.toggleChat = function () { + return BottomToolbar.toggleChat(); +}; + +UI.toggleContactList = function () { + return BottomToolbar.toggleContactList(); +}; + UI.setRecordingButtonState = function (state) { Toolbar.setRecordingButtonState(state); }; @@ -677,12 +704,6 @@ UI.setAudioMuted = function (mute) { } -UI.onLastNChanged = function (oldValue, newValue) { - if (config.muteLocalVideoIfNotInLastN) { - setVideoMute(!newValue, { 'byUser': false }); - } -} - UI.addListener = function (type, listener) { eventEmitter.on(type, listener); } @@ -4805,8 +4826,6 @@ var currentVideoHeight = null; var localVideoSrc = null; -var defaultLocalDisplayName = "Me"; - function videoactive( videoelem) { if (videoelem.attr('id').indexOf('mixedmslabel') === -1) { // ignore mixedmslabela0 and v0 @@ -6542,7 +6561,7 @@ var VideoLayout = (function (my) { /** * On dominant speaker changed event. */ - $(document).bind('dominantspeakerchanged', function (event, resourceJid) { + my.onDominantSpeakerChanged = function (resourceJid) { // We ignore local user events. if (resourceJid === xmpp.myResource()) @@ -6581,18 +6600,16 @@ var VideoLayout = (function (my) { if (video.length && video[0].currentTime > 0) VideoLayout.updateLargeVideo(RTC.getVideoSrc(video[0]), resourceJid); } - }); + }; /** * On last N change event. * - * @param event the event that notified us * @param lastNEndpoints the list of last N endpoints * @param endpointsEnteringLastN the list currently entering last N * endpoints */ - $(document).bind('lastnchanged', function ( event, - lastNEndpoints, + my.onLastNEndpointsChanged = function ( lastNEndpoints, endpointsEnteringLastN, stream) { if (lastNCount !== lastNEndpoints.length) @@ -6731,9 +6748,9 @@ var VideoLayout = (function (my) { } } - }); + }; - $(document).bind('simulcastlayerschanging', function (event, endpointSimulcastLayers) { + my.onSimulcastLayersChanging = function (endpointSimulcastLayers) { endpointSimulcastLayers.forEach(function (esl) { var resource = esl.endpoint; @@ -6782,12 +6799,12 @@ var VideoLayout = (function (my) { console.error('Could not find a stream or a session.', sid, electedStream); } }); - }); + }; /** * On simulcast layers changed event. */ - $(document).bind('simulcastlayerschanged', function (event, endpointSimulcastLayers) { + my.onSimulcastLayersChanged = function (endpointSimulcastLayers) { endpointSimulcastLayers.forEach(function (esl) { var resource = esl.endpoint; @@ -6873,7 +6890,7 @@ var VideoLayout = (function (my) { console.error('Could not find a stream or a sid.', sid, electedStream); } }); - }); + }; /** * Updates local stats diff --git a/libs/modules/simulcast.bundle.js b/libs/modules/simulcast.bundle.js index 01673b3a5..57032d4c8 100644 --- a/libs/modules/simulcast.bundle.js +++ b/libs/modules/simulcast.bundle.js @@ -1103,6 +1103,22 @@ function SimulcastManager() { } } + RTC.addListener(RTCEvents.SIMULCAST_LAYER_CHANGED, + function (endpointSimulcastLayers) { + endpointSimulcastLayers.forEach(function (esl) { + var ssrc = esl.simulcastLayer.primarySSRC; + simulcast._setReceivingVideoStream(esl.endpoint, ssrc); + }); + }); + RTC.addListener(RTCEvents.SIMULCAST_START, function (simulcastLayer) { + var ssrc = simulcastLayer.primarySSRC; + simulcast._setLocalVideoStreamEnabled(ssrc, true); + }); + RTC.addListener(RTCEvents.SIMULCAST_STOP, function (simulcastLayer) { + var ssrc = simulcastLayer.primarySSRC; + simulcast._setLocalVideoStreamEnabled(ssrc, false); + }); + } /** @@ -1237,24 +1253,6 @@ SimulcastManager.prototype.resetSender = function() { } }; -$(document).bind('simulcastlayerschanged', function (event, endpointSimulcastLayers) { - endpointSimulcastLayers.forEach(function (esl) { - var ssrc = esl.simulcastLayer.primarySSRC; - simulcast._setReceivingVideoStream(esl.endpoint, ssrc); - }); -}); - -$(document).bind('startsimulcastlayer', function (event, simulcastLayer) { - var ssrc = simulcastLayer.primarySSRC; - simulcast._setLocalVideoStreamEnabled(ssrc, true); -}); - -$(document).bind('stopsimulcastlayer', function (event, simulcastLayer) { - var ssrc = simulcastLayer.primarySSRC; - simulcast._setLocalVideoStreamEnabled(ssrc, false); -}); - - var simulcast = new SimulcastManager(); module.exports = simulcast; diff --git a/libs/modules/xmpp.bundle.js b/libs/modules/xmpp.bundle.js index c401f6ac2..2d0e1b4e3 100644 --- a/libs/modules/xmpp.bundle.js +++ b/libs/modules/xmpp.bundle.js @@ -2831,6 +2831,8 @@ var externalAuthEnabled = false; // service discovery. var sipGatewayEnabled = config.hosts.call_control !== undefined; +var eventEmitter = null; + var Moderator = { isModerator: function () { return connection && connection.emuc.isModerator(); @@ -2853,8 +2855,9 @@ var Moderator = { connection = con; }, - init: function (xmpp) { + init: function (xmpp, emitter) { this.xmppService = xmpp; + eventEmitter = emitter; }, onMucLeft: function (jid) { @@ -3013,11 +3016,13 @@ var Moderator = { self.xmppService.promptLogin(); } else { - // External authentication mode - UI.onAuthenticationRequired(function () { - Moderator.allocateConferenceFocus( - roomName, callback); - }); + + eventEmitter.emit(XMPPEvents.AUTHENTICATION_REQUIRED, // External authentication mode + function () { + Moderator.allocateConferenceFocus( + roomName, callback); + }); + } return; } diff --git a/modules/RTC/DataChannels.js b/modules/RTC/DataChannels.js index 8cb75ae90..b0d39dd22 100644 --- a/modules/RTC/DataChannels.js +++ b/modules/RTC/DataChannels.js @@ -3,6 +3,7 @@ // cache datachannels to avoid garbage collection // https://code.google.com/p/chromium/issues/detail?id=405545 var _dataChannels = []; +var eventEmitter = null; @@ -66,9 +67,7 @@ var DataChannels = console.info( "Data channel new dominant speaker event: ", dominantSpeakerEndpoint); - $(document).trigger( - 'dominantspeakerchanged', - [dominantSpeakerEndpoint]); + eventEmitter.emit(RTC.DOMINANTSPEAKER_CHANGED, dominantSpeakerEndpoint); } else if ("InLastNChangeEvent" === colibriClass) { @@ -91,7 +90,8 @@ var DataChannels = newValue = new Boolean(newValue).valueOf(); } } - UI.onLastNChanged(oldValue, newValue); + + eventEmitter.emit(RTCEvents.LASTN_CHANGED, oldValue, newValue); } else if ("LastNEndpointsChangeEvent" === colibriClass) { @@ -106,29 +106,26 @@ var DataChannels = console.log( "Data channel new last-n event: ", lastNEndpoints, endpointsEnteringLastN, obj); - $(document).trigger( - 'lastnchanged', - [lastNEndpoints, endpointsEnteringLastN, stream]); + eventEmitter.emit(RTCEvents.LASTN_ENDPOINT_CHANGED, + lastNEndpoints, endpointsEnteringLastN, obj); } else if ("SimulcastLayersChangedEvent" === colibriClass) { - $(document).trigger( - 'simulcastlayerschanged', - [obj.endpointSimulcastLayers]); + eventEmitter.emit(RTCEvents.SIMULCAST_LAYER_CHANGED, + obj.endpointSimulcastLayers); } else if ("SimulcastLayersChangingEvent" === colibriClass) { - $(document).trigger( - 'simulcastlayerschanging', - [obj.endpointSimulcastLayers]); + eventEmitter.emit(RTCEvents.SIMULCAST_LAYER_CHANGING, + obj.endpointSimulcastLayers); } else if ("StartSimulcastLayerEvent" === colibriClass) { - $(document).trigger('startsimulcastlayer', obj.simulcastLayer); + eventEmitter.emit(RTCEvents.SIMULCAST_START, obj.simulcastLayer); } else if ("StopSimulcastLayerEvent" === colibriClass) { - $(document).trigger('stopsimulcastlayer', obj.simulcastLayer); + eventEmitter.emit(RTCEvents.SIMULCAST_STOP, obj.simulcastLayer); } else { @@ -151,11 +148,12 @@ var DataChannels = * Binds "ondatachannel" event listener to given PeerConnection instance. * @param peerConnection WebRTC peer connection instance. */ - bindDataChannelListener: function (peerConnection) { + init: function (peerConnection, emitter) { if(!config.openSctp) retrun; peerConnection.ondatachannel = this.onDataChannel; + eventEmitter = emitter; // Sample code for opening new data channel from Jitsi Meet to the bridge. // Although it's not a requirement to open separate channels from both bridge diff --git a/modules/RTC/RTC.js b/modules/RTC/RTC.js index 9d0d5c7e0..e8b1525f5 100644 --- a/modules/RTC/RTC.js +++ b/modules/RTC/RTC.js @@ -18,6 +18,9 @@ var RTC = { addStreamListener: function (listener, eventType) { eventEmitter.on(eventType, listener); }, + addListener: function (type, listener) { + eventEmitter.on(type, listener); + }, removeStreamListener: function (listener, eventType) { if(!(eventType instanceof StreamEventTypes)) throw "Illegal argument"; @@ -121,7 +124,7 @@ var RTC = { } }); xmpp.addListener(XMPPEvents.CALL_INCOMING, function(event) { - DataChannels.bindDataChannelListener(event.peerconnection); + DataChannels.init(event.peerconnection, eventEmitter); }); this.rtcUtils = new RTCUtils(this); this.rtcUtils.obtainAudioAndVideoPermissions(); diff --git a/modules/UI/UI.js b/modules/UI/UI.js index 461211cee..5b257f802 100644 --- a/modules/UI/UI.js +++ b/modules/UI/UI.js @@ -79,7 +79,23 @@ function registerListeners() { RTC.addStreamListener(function (stream) { VideoLayout.onRemoteStreamAdded(stream); }, StreamEventTypes.EVENT_TYPE_REMOTE_CREATED); - + RTC.addListener(RTCEvents.LASTN_CHANGED, onLastNChanged); + RTC.addListener(RTCEvents.DOMINANTSPEAKER_CHANGED, function (resourceJid) { + VideoLayout.onDominantSpeakerChanged(resourceJid); + }); + RTC.addListener(RTCEvents.LASTN_ENDPOINT_CHANGED, + function (lastNEndpoints, endpointsEnteringLastN, stream) { + VideoLayout.onLastNEndpointsChanged(lastNEndpoints, + endpointsEnteringLastN, stream); + }); + RTC.addListener(RTCEvents.SIMULCAST_LAYER_CHANGED, + function (endpointSimulcastLayers) { + VideoLayout.onSimulcastLayersChanged(endpointSimulcastLayers); + }); + RTC.addListener(RTCEvents.SIMULCAST_LAYER_CHANGING, + function (endpointSimulcastLayers) { + VideoLayout.onSimulcastLayersChanging(endpointSimulcastLayers); + }); VideoLayout.init(); statistics.addAudioLevelListener(function(jid, audioLevel) @@ -155,6 +171,9 @@ function registerListeners() { VideoLayout.updateConnectionStats); connectionquality.addListener(CQEvents.STOP, VideoLayout.onStatsStop); + xmpp.addListener(XMPPEvents.AUTHENTICATION_REQUIRED, onAuthenticationRequired); + + } function bindEvents() @@ -367,21 +386,6 @@ function onMucLeft(jid) { }; -UI.getSettings = function () { - return Settings.getSettings(); -}; - -UI.toggleFilmStrip = function () { - return BottomToolbar.toggleFilmStrip(); -}; - -UI.toggleChat = function () { - return BottomToolbar.toggleChat(); -}; - -UI.toggleContactList = function () { - return BottomToolbar.toggleContactList(); -}; function onLocalRoleChange(jid, info, pres, isModerator, isExternalAuthEnabled) { @@ -467,13 +471,36 @@ function onMucRoleChanged(role, displayName) { } } -UI.onAuthenticationRequired = function (intervalCallback) { +function onAuthenticationRequired(intervalCallback) { Authentication.openAuthenticationDialog( roomName, intervalCallback, function () { Toolbar.authenticateClicked(); }); }; + +function onLastNChanged(oldValue, newValue) { + if (config.muteLocalVideoIfNotInLastN) { + setVideoMute(!newValue, { 'byUser': false }); + } +} + +UI.getSettings = function () { + return Settings.getSettings(); +}; + +UI.toggleFilmStrip = function () { + return BottomToolbar.toggleFilmStrip(); +}; + +UI.toggleChat = function () { + return BottomToolbar.toggleChat(); +}; + +UI.toggleContactList = function () { + return BottomToolbar.toggleContactList(); +}; + UI.setRecordingButtonState = function (state) { Toolbar.setRecordingButtonState(state); }; @@ -676,12 +703,6 @@ UI.setAudioMuted = function (mute) { } -UI.onLastNChanged = function (oldValue, newValue) { - if (config.muteLocalVideoIfNotInLastN) { - setVideoMute(!newValue, { 'byUser': false }); - } -} - UI.addListener = function (type, listener) { eventEmitter.on(type, listener); } diff --git a/modules/UI/videolayout/VideoLayout.js b/modules/UI/videolayout/VideoLayout.js index a506ef5f7..4517028b1 100644 --- a/modules/UI/videolayout/VideoLayout.js +++ b/modules/UI/videolayout/VideoLayout.js @@ -36,8 +36,6 @@ var currentVideoHeight = null; var localVideoSrc = null; -var defaultLocalDisplayName = "Me"; - function videoactive( videoelem) { if (videoelem.attr('id').indexOf('mixedmslabel') === -1) { // ignore mixedmslabela0 and v0 @@ -1773,7 +1771,7 @@ var VideoLayout = (function (my) { /** * On dominant speaker changed event. */ - $(document).bind('dominantspeakerchanged', function (event, resourceJid) { + my.onDominantSpeakerChanged = function (resourceJid) { // We ignore local user events. if (resourceJid === xmpp.myResource()) @@ -1812,18 +1810,16 @@ var VideoLayout = (function (my) { if (video.length && video[0].currentTime > 0) VideoLayout.updateLargeVideo(RTC.getVideoSrc(video[0]), resourceJid); } - }); + }; /** * On last N change event. * - * @param event the event that notified us * @param lastNEndpoints the list of last N endpoints * @param endpointsEnteringLastN the list currently entering last N * endpoints */ - $(document).bind('lastnchanged', function ( event, - lastNEndpoints, + my.onLastNEndpointsChanged = function ( lastNEndpoints, endpointsEnteringLastN, stream) { if (lastNCount !== lastNEndpoints.length) @@ -1962,9 +1958,9 @@ var VideoLayout = (function (my) { } } - }); + }; - $(document).bind('simulcastlayerschanging', function (event, endpointSimulcastLayers) { + my.onSimulcastLayersChanging = function (endpointSimulcastLayers) { endpointSimulcastLayers.forEach(function (esl) { var resource = esl.endpoint; @@ -1992,8 +1988,6 @@ var VideoLayout = (function (my) { console.info([esl, primarySSRC, msid, sid, electedStream]); - var msidParts = msid.split(' '); - var preload = (Strophe.getResourceFromJid(xmpp.getJidFromSSRC(primarySSRC)) == largeVideoState.userResourceJid); if (preload) { @@ -2013,12 +2007,12 @@ var VideoLayout = (function (my) { console.error('Could not find a stream or a session.', sid, electedStream); } }); - }); + }; /** * On simulcast layers changed event. */ - $(document).bind('simulcastlayerschanged', function (event, endpointSimulcastLayers) { + my.onSimulcastLayersChanged = function (endpointSimulcastLayers) { endpointSimulcastLayers.forEach(function (esl) { var resource = esl.endpoint; @@ -2104,7 +2098,7 @@ var VideoLayout = (function (my) { console.error('Could not find a stream or a sid.', sid, electedStream); } }); - }); + }; /** * Updates local stats diff --git a/modules/simulcast/simulcast.js b/modules/simulcast/simulcast.js index 53af2446e..72697d3fe 100644 --- a/modules/simulcast/simulcast.js +++ b/modules/simulcast/simulcast.js @@ -46,6 +46,22 @@ function SimulcastManager() { } } + RTC.addListener(RTCEvents.SIMULCAST_LAYER_CHANGED, + function (endpointSimulcastLayers) { + endpointSimulcastLayers.forEach(function (esl) { + var ssrc = esl.simulcastLayer.primarySSRC; + simulcast._setReceivingVideoStream(esl.endpoint, ssrc); + }); + }); + RTC.addListener(RTCEvents.SIMULCAST_START, function (simulcastLayer) { + var ssrc = simulcastLayer.primarySSRC; + simulcast._setLocalVideoStreamEnabled(ssrc, true); + }); + RTC.addListener(RTCEvents.SIMULCAST_STOP, function (simulcastLayer) { + var ssrc = simulcastLayer.primarySSRC; + simulcast._setLocalVideoStreamEnabled(ssrc, false); + }); + } /** @@ -180,24 +196,6 @@ SimulcastManager.prototype.resetSender = function() { } }; -$(document).bind('simulcastlayerschanged', function (event, endpointSimulcastLayers) { - endpointSimulcastLayers.forEach(function (esl) { - var ssrc = esl.simulcastLayer.primarySSRC; - simulcast._setReceivingVideoStream(esl.endpoint, ssrc); - }); -}); - -$(document).bind('startsimulcastlayer', function (event, simulcastLayer) { - var ssrc = simulcastLayer.primarySSRC; - simulcast._setLocalVideoStreamEnabled(ssrc, true); -}); - -$(document).bind('stopsimulcastlayer', function (event, simulcastLayer) { - var ssrc = simulcastLayer.primarySSRC; - simulcast._setLocalVideoStreamEnabled(ssrc, false); -}); - - var simulcast = new SimulcastManager(); module.exports = simulcast; \ No newline at end of file diff --git a/modules/xmpp/moderator.js b/modules/xmpp/moderator.js index e1707c505..f90c8ff55 100644 --- a/modules/xmpp/moderator.js +++ b/modules/xmpp/moderator.js @@ -30,6 +30,8 @@ var externalAuthEnabled = false; // service discovery. var sipGatewayEnabled = config.hosts.call_control !== undefined; +var eventEmitter = null; + var Moderator = { isModerator: function () { return connection && connection.emuc.isModerator(); @@ -52,8 +54,9 @@ var Moderator = { connection = con; }, - init: function (xmpp) { + init: function (xmpp, emitter) { this.xmppService = xmpp; + eventEmitter = emitter; }, onMucLeft: function (jid) { @@ -212,11 +215,13 @@ var Moderator = { self.xmppService.promptLogin(); } else { - // External authentication mode - UI.onAuthenticationRequired(function () { - Moderator.allocateConferenceFocus( - roomName, callback); - }); + + eventEmitter.emit(XMPPEvents.AUTHENTICATION_REQUIRED, // External authentication mode + function () { + Moderator.allocateConferenceFocus( + roomName, callback); + }); + } return; } diff --git a/service/RTC/RTCEvents.js b/service/RTC/RTCEvents.js new file mode 100644 index 000000000..2d4315db4 --- /dev/null +++ b/service/RTC/RTCEvents.js @@ -0,0 +1,9 @@ +var RTCEvents = { + LASTN_CHANGED: "rtc.lastn_changed", + DOMINANTSPEAKER_CHANGED: "rtc.dominantspeaker_changed", + LASTN_ENDPOINT_CHANGED: "rtc.lastn_endpoint_changed", + SIMULCAST_LAYER_CHANGED: "rtc.simulcast_layer_changed", + SIMULCAST_LAYER_CHANGING: "rtc.simulcast_layer_changing", + SIMULCAST_START: "rtc.simlcast_start", + SIMULCAST_STOP: "rtc.simlcast_stop" +} \ No newline at end of file diff --git a/service/xmpp/XMPPEvents.js b/service/xmpp/XMPPEvents.js index 2cb49c294..ee35e71c5 100644 --- a/service/xmpp/XMPPEvents.js +++ b/service/xmpp/XMPPEvents.js @@ -19,6 +19,7 @@ var XMPPEvents = { MESSAGE_RECEIVED: "xmpp.message_received", SENDING_CHAT_MESSAGE: "xmpp.sending_chat_message", PASSWORD_REQUIRED: "xmpp.password_required", + AUTHENTICATION_REQUIRED: "xmpp.authentication_required", CHAT_ERROR_RECEIVED: "xmpp.chat_error_received", ETHERPAD: "xmpp.etherpad" };