Add events for data chanel.

This commit is contained in:
hristoterezov 2015-01-27 11:56:22 +02:00
parent af50bd5b94
commit bc2d72638b
13 changed files with 209 additions and 158 deletions

View File

@ -22,17 +22,18 @@
<script src="service/RTC/RTCBrowserType.js?v=1"></script>
<script src="service/RTC/StreamEventTypes.js?v=2"></script>
<script src="service/RTC/MediaStreamTypes.js?v=1"></script>
<script src="service/RTC/RTCEvents.js?v=1"></script>
<script src="service/xmpp/XMPPEvents.js?v=1"></script>
<script src="service/connectionquality/CQEvents.js?v=1"></script>
<script src="service/UI/UIEvents.js?v=1"></script>
<script src="service/desktopsharing/DesktopSharingEventTypes.js?v=1"></script>
<script src="libs/modules/simulcast.bundle.js?v=5"></script>
<script src="libs/modules/connectionquality.bundle.js?v=3"></script>
<script src="libs/modules/UI.bundle.js?v=12"></script>
<script src="libs/modules/UI.bundle.js?v=13"></script>
<script src="libs/modules/statistics.bundle.js?v=5"></script>
<script src="libs/modules/RTC.bundle.js?v=7"></script>
<script src="libs/modules/RTC.bundle.js?v=8"></script>
<script src="libs/modules/simulcast.bundle.js?v=6"></script>
<script src="libs/modules/desktopsharing.bundle.js?v=3"></script><!-- desktop sharing -->
<script src="libs/modules/xmpp.bundle.js?v=7"></script>
<script src="libs/modules/xmpp.bundle.js?v=8"></script>
<script src="libs/modules/keyboardshortcut.bundle.js?v=2"></script>
<script src="app.js?v=30"></script><!-- application logic -->
<script src="libs/modules/API.bundle.js?v=2"></script>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

9
service/RTC/RTCEvents.js Normal file
View File

@ -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"
}

View File

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