Merge branch 'lib-replace-remaining-events' of git://github.com/isymchych/jitsi-meet into isymchych-lib-replace-remaining-events

This commit is contained in:
hristoterezov 2016-01-25 15:48:11 -06:00
commit 20b8ade35d
12 changed files with 5777 additions and 5550 deletions

View File

@ -5,6 +5,7 @@ var RTC = require("./modules/RTC/RTC");
var XMPPEvents = require("./service/xmpp/XMPPEvents");
var AuthenticationEvents = require("./service/authentication/AuthenticationEvents");
var RTCEvents = require("./service/RTC/RTCEvents");
var DSEvents = require("./service/desktopsharing/DesktopSharingEventTypes");
var EventEmitter = require("events");
var JitsiConferenceEvents = require("./JitsiConferenceEvents");
var JitsiConferenceErrors = require("./JitsiConferenceErrors");
@ -57,6 +58,10 @@ function JitsiConference(options) {
this.startAudioMuted = false;
this.startVideoMuted = false;
this.startMutedPolicy = {audio: false, video: false};
this.availableDevices = {
audio: undefined,
video: undefined
};
}
/**
@ -801,6 +806,24 @@ function setupListeners(conference) {
conference.room.addListener(XMPPEvents.BRIDGE_DOWN, function () {
conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED, JitsiConferenceErrors.VIDEOBRIDGE_NOT_AVAILABLE);
});
conference.room.addListener(XMPPEvents.RESERVATION_ERROR, function (code, msg) {
conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED, JitsiConferenceErrors.RESERVATION_ERROR, code, msg);
});
conference.room.addListener(XMPPEvents.GRACEFUL_SHUTDOWN, function () {
conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED, JitsiConferenceErrors.GRACEFUL_SHUTDOWN);
});
conference.room.addListener(XMPPEvents.JINGLE_FATAL_ERROR, function () {
conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED, JitsiConferenceErrors.JINGLE_FATAL_ERROR);
});
conference.room.addListener(XMPPEvents.MUC_DESTROYED, function (reason) {
conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED, JitsiConferenceErrors.CONFERENCE_DESTROYED, reason);
});
conference.room.addListener(XMPPEvents.CHAT_ERROR_RECEIVED, function (err, msg) {
conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED, JitsiConferenceErrors.CHAT_ERROR, err, msg);
});
conference.room.addListener(XMPPEvents.FOCUS_DISCONNECTED, function (focus, retrySec) {
conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED, JitsiConferenceErrors.FOCUS_DISCONNECTED, focus, retrySec);
});
// FIXME
// conference.room.addListener(XMPPEvents.MUC_JOINED, function () {
// conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_LEFT);
@ -852,6 +875,20 @@ function setupListeners(conference) {
conference.eventEmitter.emit(JitsiConferenceEvents.MESSAGE_RECEIVED, id, txt, ts);
});
conference.room.addListener(XMPPEvents.PRESENCE_STATUS, function (jid, status) {
var id = Strophe.getResourceFromJid(jid);
var participant = conference.getParticipantById(id);
if (!participant || participant._status === status) {
return;
}
participant._status = status;
conference.eventEmitter.emit(JitsiConferenceEvents.USER_STATUS_CHANGED, id, status);
});
conference.rtc.addListener(DSEvents.FIREFOX_EXTENSION_NEEDED, function (url) {
conference.eventEmitter.emit(JitsiConferenceEvents.FIREFOX_EXTENSION_NEEDED, url);
});
conference.rtc.addListener(RTCEvents.DOMINANTSPEAKER_CHANGED, function (id) {
if(conference.lastDominantSpeaker !== id && conference.room) {
conference.lastDominantSpeaker = id;
@ -929,6 +966,50 @@ function setupListeners(conference) {
}
});
conference.rtc.addListener(RTCEvents.AVAILABLE_DEVICES_CHANGED, function (devices) {
conference.room.updateDeviceAvailability(devices);
});
conference.room.addPresenceListener("devices", function (data, from) {
var isAudioAvailable = false;
var isVideoAvailable = false;
data.children.forEach(function (config) {
if (config.tagName === 'audio') {
isAudioAvailable = config.value === 'true';
}
if (config.tagName === 'video') {
isVideoAvailable = config.value === 'true';
}
});
var availableDevices;
if (conference.myUserId() === from) {
availableDevices = conference.availableDevices;
} else {
var participant = conference.getParticipantById(from);
if (!participant) {
return;
}
availableDevices = participant._availableDevices;
}
var updated = false;
if (availableDevices.audio !== isAudioAvailable) {
updated = true;
availableDevices.audio = isAudioAvailable;
}
if (availableDevices.video !== isVideoAvailable) {
updated = true;
availableDevices.video = isVideoAvailable;
}
if (updated) {
conference.eventEmitter.emit(JitsiConferenceEvents.AVAILABLE_DEVICES_CHANGED, from, availableDevices);
}
});
if(conference.statistics) {
//FIXME: Maybe remove event should not be associated with the conference.
conference.statistics.addAudioLevelListener(function (ssrc, level) {
@ -943,10 +1024,6 @@ function setupListeners(conference) {
function () {
conference.statistics.dispose();
});
// FIXME: Maybe we should move this.
// RTC.addListener(RTCEvents.AVAILABLE_DEVICES_CHANGED, function (devices) {
// conference.room.updateDeviceAvailability(devices);
// });
conference.room.addListener(XMPPEvents.PEERCONNECTION_READY,
function (session) {

View File

@ -27,7 +27,31 @@ var JitsiConferenceErrors = {
/**
* Indicates that there is no available videobridge.
*/
VIDEOBRIDGE_NOT_AVAILABLE: "conference.videobridgeNotAvailable"
VIDEOBRIDGE_NOT_AVAILABLE: "conference.videobridgeNotAvailable",
/**
* Indicates that reservation system returned error.
*/
RESERVATION_ERROR: "conference.reservationError",
/**
* Indicates that graceful shutdown happened.
*/
GRACEFUL_SHUTDOWN: "conference.gracefulShutdown",
/**
* Indicates that jingle fatal error happened.
*/
JINGLE_FATAL_ERROR: "conference.jingleFatalError",
/**
* Indicates that conference has been destroyed.
*/
CONFERENCE_DESTROYED: "conference.destroyed",
/**
* Indicates that chat error occured.
*/
CHAT_ERROR: "conference.chatError",
/**
* Indicates that focus error happened.
*/
FOCUS_DISCONNECTED: "conference.focusDisconnected"
/**
* Many more errors TBD here.
*/

View File

@ -27,6 +27,10 @@ var JitsiConferenceEvents = {
* User role changed.
*/
USER_ROLE_CHANGED: "conference.roleChanged",
/**
* User status changed.
*/
USER_STATUS_CHANGED: "conference.statusChanged",
/**
* New text message was received.
*/
@ -103,7 +107,16 @@ var JitsiConferenceEvents = {
/**
* Indicates that phone number changed.
*/
PHONE_NUMBER_CHANGED: "conference.phoneNumberChanged"
PHONE_NUMBER_CHANGED: "conference.phoneNumberChanged",
/**
* Indicates that to proceed with screen sharing
* browser extension must be installed first.
*/
FIREFOX_EXTENSION_NEEDED: "conference.firefoxExtensionRequired",
/**
* Indicates that available devices changed.
*/
AVAILABLE_DEVICES_CHANGED: "conference.availableDevicesChanged"
};
module.exports = JitsiConferenceEvents;

View File

@ -11,6 +11,11 @@ function JitsiParticipant(jid, conference, displayName){
this._supportsDTMF = false;
this._tracks = [];
this._role = 'none';
this._status = null;
this._availableDevices = {
audio: undefined,
video: undefined
};
}
/**
@ -48,6 +53,13 @@ JitsiParticipant.prototype.getDisplayName = function() {
return this._displayName;
};
/**
* @returns {String} The status of the participant.
*/
JitsiParticipant.prototype.getStatus = function () {
return this._status;
};
/**
* @returns {Boolean} Whether this participant is a moderator or not.
*/

View File

@ -89,10 +89,13 @@ JitsiMeetJS.setLogLevel(JitsiMeetJS.logLevels.ERROR);
- CONFERENCE_LEFT - notifies the local user that he left the conference successfully. (no parameters)
- DTMF_SUPPORT_CHANGED - notifies if at least one user supports DTMF. (parameters - supports(boolean))
- USER_ROLE_CHANGED - notifies that role of some user changed. (parameters - id(string), role(string))
- USER_STATUS_CHANGED - notifies that status of some user changed. (parameters - id(string), status(string))
- CONFERENCE_FAILED - notifies that user failed to join the conference. (parameters - errorCode(JitsiMeetJS.errors.conference))
- KICKED - notifies that user has been kicked from the conference.
- START_MUTED_POLICY_CHANGED - notifies that all new participants will join with muted audio/video stream (parameters - JS object with 2 properties - audio(boolean), video(boolean))
- STARTED_MUTED - notifies that the local user has started muted
- FIREFOX_EXTENSION_NEEDED - notifies that browser extension must be installed to proceed with screen sharing (parameters - extension url(string))
- AVAILABLE_DEVICES_CHANGED - notifies that available participant devices changed (camera or microphone was added or removed) (parameters - id(string), devices(JS object with 2 properties - audio(boolean), video(boolean)))
2. connection
- CONNECTION_FAILED - indicates that the server connection failed.
@ -111,6 +114,12 @@ JitsiMeetJS.setLogLevel(JitsiMeetJS.logLevels.ERROR);
- PASSWORD_REQUIRED - that error can be passed when the connection to the conference failed. You should try to join the conference with password.
- PASSWORD_NOT_SUPPORTED - indicates that conference cannot be locked
- VIDEOBRIDGE_NOT_AVAILABLE - video bridge issues.
- RESERVATION_ERROR - error in reservation system
- GRACEFUL_SHUTDOWN - graceful shutdown
- JINGLE_FATAL_ERROR - error in jingle
- CONFERENCE_DESTROYED - conference has been destroyed
- CHAT_ERROR - chat error happened
- FOCUS_DISCONNECTED - focus error happened
2. connection
- PASSWORD_REQUIRED - passed when the connection to the server failed. You should try to authenticate with password.
- CONNECTION_ERROR - indicates connection failures.

File diff suppressed because it is too large Load Diff

32
lib-jitsi-meet.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -217,4 +217,3 @@ DataChannels.prototype._some = function (callback, thisArg) {
}
module.exports = DataChannels;

View File

@ -6,8 +6,6 @@ var JitsiTrack = require("./JitsiTrack");
var JitsiLocalTrack = require("./JitsiLocalTrack.js");
var DataChannels = require("./DataChannels");
var JitsiRemoteTrack = require("./JitsiRemoteTrack.js");
var DesktopSharingEventTypes
= require("../../service/desktopsharing/DesktopSharingEventTypes");
var MediaStreamType = require("../../service/RTC/MediaStreamTypes");
var RTCEvents = require("../../service/RTC/RTCEvents.js");

View File

@ -333,12 +333,9 @@ ChatRoom.prototype.onPresence = function (pres) {
}
}
if(!member.isFocus)
this.eventEmitter.emit(XMPPEvents.USER_ID_CHANGED, from, member.id);
// Trigger status message update
if (member.status) {
this.eventEmitter.emit(XMPPEvents.PRESENCE_STATUS, from, member);
this.eventEmitter.emit(XMPPEvents.PRESENCE_STATUS, from, member.status);
}
if(jibri)

View File

@ -53,9 +53,6 @@ function initStrophePlugins(XMPP)
// broadcastLocalVideoType,
// StreamEventTypes.EVENT_TYPE_LOCAL_CHANGED
// );
// RTC.addListener(RTCEvents.AVAILABLE_DEVICES_CHANGED, function (devices) {
// XMPP.addToPresence("devices", devices);
// });
//}
function XMPP(options) {

View File

@ -13,11 +13,6 @@ var XMPPEvents = {
CALL_INCOMING: "xmpp.callincoming.jingle",
// Designates an event indicating that we were kicked from the XMPP MUC.
KICKED: "xmpp.kicked",
// Designates an event indicating that the userID for a specific JID has
// changed.
// Note: currently this event fires every time we receive presence from
// someone (regardless of whether or not the "userID" changed).
USER_ID_CHANGED: "xmpp.user_id_changed",
// Designates an event indicating that we have joined the XMPP MUC.
MUC_JOINED: "xmpp.muc_joined",
// Designates an event indicating that a participant joined the XMPP MUC.
@ -62,11 +57,6 @@ var XMPPEvents = {
// 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",
// Designates an event indicating that a remote participant's available
// devices (whether he supports a audio and/or video) changed.
// Note: currently this event fires every time we receive presence from
// someone (regardless of whether or not the devices changed).
DEVICE_AVAILABLE: "xmpp.device_available",
PEERCONNECTION_READY: "xmpp.peerconnection_ready",