Documents some of the XMPP events. Renames some of them.

This commit is contained in:
Boris Grozev 2015-08-17 15:35:07 -05:00
parent d5258e6197
commit 332aafbe20
4 changed files with 70 additions and 26 deletions

View File

@ -260,14 +260,17 @@ function registerListeners() {
APP.xmpp.addListener(XMPPEvents.ETHERPAD, initEtherpad);
APP.xmpp.addListener(XMPPEvents.AUTHENTICATION_REQUIRED,
onAuthenticationRequired);
APP.xmpp.addListener(XMPPEvents.VIDEO_TYPE, onPeerVideoTypeChanged);
APP.xmpp.addListener(XMPPEvents.PARTICIPANT_VIDEO_TYPE_CHANGED,
onPeerVideoTypeChanged);
APP.xmpp.addListener(XMPPEvents.DEVICE_AVAILABLE,
function (resource, devices) {
VideoLayout.setDeviceAvailabilityIcons(resource, devices);
});
APP.xmpp.addListener(XMPPEvents.AUDIO_MUTED, VideoLayout.onAudioMute);
APP.xmpp.addListener(XMPPEvents.VIDEO_MUTED, VideoLayout.onVideoMute);
APP.xmpp.addListener(XMPPEvents.PARTICIPANT_AUDIO_MUTED,
VideoLayout.onAudioMute);
APP.xmpp.addListener(XMPPEvents.PARTICIPANT_VIDEO_MUTED,
VideoLayout.onVideoMute);
APP.xmpp.addListener(XMPPEvents.AUDIO_MUTED_BY_FOCUS, function (doMuteAudio) {
UI.setAudioMuted(doMuteAudio);
});

View File

@ -1355,10 +1355,11 @@ JingleSessionPC.prototype.setLocalDescription = function () {
}
// an attempt to work around https://github.com/jitsi/jitmeet/issues/32
// TODO: is this hack (along with the XMPPEvent-s used only for it) still needed
// now that we announce an SSRC for receive-only streams?
function sendKeyframe(pc) {
console.log('sendkeyframe', pc.iceConnectionState);
if (pc.iceConnectionState !== 'connected') return; // safe...
var self = this;
pc.setRemoteDescription(
pc.remoteDescription,
function () {
@ -1431,6 +1432,8 @@ JingleSessionPC.prototype.remoteStreamAdded = function (data, times) {
var isVideo = data.stream.getVideoTracks().length > 0;
// an attempt to work around https://github.com/jitsi/jitmeet/issues/32
// TODO: is this hack still needed now that we announce an SSRC for
// receive-only streams?
if (isVideo &&
data.peerjid && this.peerjid === data.peerjid &&
data.stream.getVideoTracks().length === 0 &&

View File

@ -138,14 +138,14 @@ module.exports = function(XMPP, eventEmitter) {
// Parse audio info tag.
var audioMuted = $(pres).find('>audiomuted');
if (audioMuted.length) {
eventEmitter.emit(XMPPEvents.AUDIO_MUTED,
eventEmitter.emit(XMPPEvents.PARTICIPANT_AUDIO_MUTED,
from, (audioMuted.text() === "true"));
}
// Parse video info tag.
var videoMuted = $(pres).find('>videomuted');
if (videoMuted.length) {
eventEmitter.emit(XMPPEvents.VIDEO_MUTED,
eventEmitter.emit(XMPPEvents.PARTICIPANT_VIDEO_MUTED,
from, (videoMuted.text() === "true"));
}
@ -180,7 +180,7 @@ module.exports = function(XMPP, eventEmitter) {
{
if (videoType.text().length)
{
eventEmitter.emit(XMPPEvents.VIDEO_TYPE,
eventEmitter.emit(XMPPEvents.PARTICIPANT_VIDEO_TYPE_CHANGED,
Strophe.getResourceFromJid(from), videoType.text());
}
}

View File

@ -1,47 +1,85 @@
var XMPPEvents = {
// Designates an event indicating that the connection to the XMPP server
// failed.
CONNECTION_FAILED: "xmpp.connection.failed",
// Indicates an interrupted connection event.
// Designates an event indicating that the media (ICE) connection was
// interrupted. This should go to the RTC module.
CONNECTION_INTERRUPTED: "xmpp.connection.interrupted",
// Indicates a restored connection event.
// Designates an event indicating that the media (ICE) connection was
// restored. This should go to the RTC module.
CONNECTION_RESTORED: "xmpp.connection.restored",
CONFERENCE_CREATED: "xmpp.conferenceCreated.jingle",
// Designates an event indicating that an offer (e.g. Jingle
// session-initiate) was received.
CALL_INCOMING: "xmpp.callincoming.jingle",
DISPOSE_CONFERENCE: "xmpp.dispose_conference",
GRACEFUL_SHUTDOWN: "xmpp.graceful_shutdown",
// Designates an event indicating that we were kicked from the XMPP MUC.
KICKED: "xmpp.kicked",
BRIDGE_DOWN: "xmpp.bridge_down",
// Designates an event indicating that the userID for a specific JID has
// changed.
USER_ID_CHANGED: "xmpp.user_id_changed",
// We joined the MUC
// Designates an event indicating that we have joined the XMPP MUC.
MUC_JOINED: "xmpp.muc_joined",
// A member joined the MUC
// Designates an event indicating that a participant joined the XMPP MUC.
MUC_MEMBER_JOINED: "xmpp.muc_member_joined",
// A member left the MUC
// Designates an event indicating that a participant left the XMPP MUC.
MUC_MEMBER_LEFT: "xmpp.muc_member_left",
// Designates an event indicating that the MUC role of a participant has
// changed.
MUC_ROLE_CHANGED: "xmpp.muc_role_changed",
// Designates an event indicating that the XMPP MUC was destroyed.
MUC_DESTROYED: "xmpp.muc_destroyed",
// Designates an event indicating that the display name of a participant
// has changed.
DISPLAY_NAME_CHANGED: "xmpp.display_name_changed",
// Designates an event indicating that we received statistics from a
// participant in the MUC.
REMOTE_STATS: "xmpp.remote_stats",
// Designates an event indicating that our role in the XMPP MUC has changed.
LOCAL_ROLE_CHANGED: "xmpp.localrole_changed",
PRESENCE_STATUS: "xmpp.presence_status",
RESERVATION_ERROR: "xmpp.room_reservation_error",
// Designates an event indicating that the subject of the XMPP MUC has
// changed.
SUBJECT_CHANGED: "xmpp.subject_changed",
// Designates an event indicating that an XMPP message in the MUC was
// received.
MESSAGE_RECEIVED: "xmpp.message_received",
// Designates an event indicating that we sent an XMPP message to the MUC.
SENDING_CHAT_MESSAGE: "xmpp.sending_chat_message",
// Designates an event indicating that the video type (e.g. 'camera' or
// 'screen') for a participant has changed.
PARTICIPANT_VIDEO_TYPE_CHANGED: "xmpp.video_type",
// Designates an event indicating that a participant in the XMPP MUC has
// advertised that they have audio muted (or unmuted).
PARTICIPANT_AUDIO_MUTED: "xmpp.audio_muted",
// Designates an event indicating that a participant in the XMPP MUC has
// advertised that they have video muted (or unmuted).
PARTICIPANT_VIDEO_MUTED: "xmpp.video_muted",
// Designates an event indicating that the focus has asked us to mute our
// audio.
AUDIO_MUTED_BY_FOCUS: "xmpp.audio_muted_by_focus",
// Designates an event indicating that a moderator in the room changed the
// "start muted" settings for the conference.
START_MUTED_SETTING_CHANGED: "xmpp.start_muted_setting_changed",
// Designates an event indicating that we should join the conference with
// audio and/or video muted.
START_MUTED_FROM_FOCUS: "xmpp.start_muted_from_focus",
PEERCONNECTION_READY: "xmpp.peerconnection_ready",
CONFERENCE_SETUP_FAILED: "xmpp.conference_setup_failed",
PASSWORD_REQUIRED: "xmpp.password_required",
AUTHENTICATION_REQUIRED: "xmpp.authentication_required",
CHAT_ERROR_RECEIVED: "xmpp.chat_error_received",
ETHERPAD: "xmpp.etherpad",
DEVICE_AVAILABLE: "xmpp.device_available",
VIDEO_TYPE: "xmpp.video_type",
PEERCONNECTION_READY: "xmpp.peerconnection_ready",
CONFERENCE_SETUP_FAILED: "xmpp.conference_setup_failed",
AUDIO_MUTED: "xmpp.audio_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",
BRIDGE_DOWN: "xmpp.bridge_down",
PRESENCE_STATUS: "xmpp.presence_status",
RESERVATION_ERROR: "xmpp.room_reservation_error",
DISPOSE_CONFERENCE: "xmpp.dispose_conference",
GRACEFUL_SHUTDOWN: "xmpp.graceful_shutdown",
// TODO: only used in a hack, should probably be removed.
SET_LOCAL_DESCRIPTION_ERROR: 'xmpp.set_local_description_error',
// TODO: only used in a hack, should probably be removed.
SET_REMOTE_DESCRIPTION_ERROR: 'xmpp.set_remote_description_error',
// TODO: only used in a hack, should probably be removed.
CREATE_ANSWER_ERROR: 'xmpp.create_answer_error',
JINGLE_FATAL_ERROR: 'xmpp.jingle_fatal_error',
PROMPT_FOR_LOGIN: 'xmpp.prompt_for_login',