Merge pull request #434 from isymchych/lib-jitsi-meet

Improve lib-jitsi-meet usability
This commit is contained in:
hristoterezov 2015-12-15 12:21:48 +11:00
commit 7e5599421f
5 changed files with 918 additions and 534 deletions

View File

@ -316,9 +316,12 @@ JitsiConference.prototype.getParticipantById = function(id) {
JitsiConference.prototype.onMemberJoined = function (jid, email, nick) {
var id = Strophe.getResourceFromJid(jid);
if (id === 'focus') {
return;
}
var participant = new JitsiParticipant(id, this, nick);
this.eventEmitter.emit(JitsiConferenceEvents.USER_JOINED, id);
this.participants[id] = participant;
this.eventEmitter.emit(JitsiConferenceEvents.USER_JOINED, id, participant);
this.xmpp.connection.disco.info(
jid, "node", function(iq) {
participant._supportsDTMF = $(iq).find(
@ -330,8 +333,9 @@ JitsiConference.prototype.onMemberJoined = function (jid, email, nick) {
JitsiConference.prototype.onMemberLeft = function (jid) {
var id = Strophe.getResourceFromJid(jid);
var participant = this.participants[id];
delete this.participants[id];
this.eventEmitter.emit(JitsiConferenceEvents.USER_LEFT, id);
this.eventEmitter.emit(JitsiConferenceEvents.USER_LEFT, id, participant);
};
JitsiConference.prototype.onUserRoleChanged = function (jid, role) {
@ -495,6 +499,11 @@ function setupListeners(conference) {
conference.eventEmitter.emit(JitsiConferenceEvents.SETUP_FAILED);
});
conference.room.addListener(XMPPEvents.MESSAGE_RECEIVED, function (jid, displayName, txt, myJid, ts) {
var id = Strophe.getResourceFromJid(jid);
conference.eventEmitter.emit(JitsiConferenceEvents.MESSAGE_RECEIVED, id, txt, ts);
});
conference.rtc.addListener(RTCEvents.DOMINANTSPEAKER_CHANGED, function (id) {
if(conference.lastActiveSpeaker !== id && conference.room) {
conference.lastActiveSpeaker = id;

View File

@ -65,13 +65,13 @@ JitsiMeetJS.setLogLevel(JitsiMeetJS.logLevels.ERROR);
For example if you want to use the conference event that is fired when somebody leave conference you can use the following code - ```JitsiMeetJS.events.conference.USER_LEFT```.
We support the following events:
1. conference
- TRACK_ADDED - remote stream received. (parameters - JitsiTrack)
- TRACK_REMOVED - remote stream removed. (parameters - JitsiTrack)
- TRACK_ADDED - stream received. (parameters - JitsiTrack)
- TRACK_REMOVED - stream removed. (parameters - JitsiTrack)
- TRACK_MUTE_CHANGED - JitsiTrack was muted or unmuted. (parameters - JitsiTrack)
- ACTIVE_SPEAKER_CHANGED - the active speaker is changed. (parameters - id(string))
- USER_JOINED - new user joined a conference. (parameters - id(string))
- USER_LEFT - a participant left conference. (parameters - id(string))
- MESSAGE_RECEIVED - new text message received. (parameters - id(string), text(string))
- USER_JOINED - new user joined a conference. (parameters - id(string), user(JitsiParticipant))
- USER_LEFT - a participant left conference. (parameters - id(string), user(JitsiParticipant))
- MESSAGE_RECEIVED - new text message received. (parameters - id(string), text(string), ts(number))
- DISPLAY_NAME_CHANGED - user has changed his display name. (parameters - id(string), displayName(string))
- LAST_N_ENDPOINTS_CHANGED - last n set was changed (parameters - array of ids of users)
- IN_LAST_N_CHANGED - passes boolean property that shows whether the local user is included in last n set of any other user or not. (parameters - boolean)

File diff suppressed because it is too large Load Diff

View File

@ -14,6 +14,7 @@ function JitsiLocalTrack(stream, videoType,
this.dontFireRemoveEvent = false;
this.resolution = resolution;
this.startMuted = false;
this.isLocal = true;
var self = this;
JitsiTrack.call(this, null, stream,
function () {

View File

@ -22,6 +22,7 @@ function JitsiRemoteTrack(RTC, data, sid, ssrc) {
this.videoType = data.videoType;
this.ssrc = ssrc;
this.muted = false;
this.isLocal = false;
if((this.type === JitsiTrack.AUDIO && data.audiomuted)
|| (this.type === JitsiTrack.VIDEO && data.videomuted)) {
this.muted = true;
@ -47,7 +48,7 @@ JitsiRemoteTrack.prototype.setMute = function (value) {
*/
JitsiRemoteTrack.prototype.isMuted = function () {
return this.muted;
}
};
/**
* Returns the participant id which owns the track.
@ -62,7 +63,7 @@ JitsiRemoteTrack.prototype.getParticipantId = function() {
*/
JitsiRemoteTrack.prototype.isLocal = function () {
return false;
}
};
delete JitsiRemoteTrack.prototype.stop;