properly update nickname

This commit is contained in:
isymchych 2015-12-18 15:59:38 +02:00
parent 58d1c76ab0
commit 0ec8ab69a0
4 changed files with 50 additions and 5 deletions

9
app.js
View File

@ -196,7 +196,7 @@ function initConference(localTracks, connection) {
room.on(ConferenceEvents.TRACK_ADDED, function (track) { room.on(ConferenceEvents.TRACK_ADDED, function (track) {
if (track.isLocal) { // skip local tracks if (track.isLocal()) { // skip local tracks
return; return;
} }
console.error( console.error(
@ -205,7 +205,7 @@ function initConference(localTracks, connection) {
APP.UI.addRemoteStream(track); APP.UI.addRemoteStream(track);
}); });
room.on(ConferenceEvents.TRACK_REMOVED, function (track) { room.on(ConferenceEvents.TRACK_REMOVED, function (track) {
if (track.isLocal) { // skip local tracks if (track.isLocal()) { // skip local tracks
return; return;
} }
@ -320,7 +320,10 @@ function initConference(localTracks, connection) {
nick = APP.UI.askForNickname(); nick = APP.UI.askForNickname();
APP.settings.setDisplayName(nick); APP.settings.setDisplayName(nick);
} }
room.setDisplayName(nick);
if (nick) {
room.setDisplayName(nick);
}
room.on(ConferenceEvents.DISPLAY_NAME_CHANGED, function (id, displayName) { room.on(ConferenceEvents.DISPLAY_NAME_CHANGED, function (id, displayName) {
APP.UI.changeDisplayName(id, displayName); APP.UI.changeDisplayName(id, displayName);
}); });

View File

@ -5,6 +5,7 @@
var logger = require("jitsi-meet-logger").getLogger(__filename); var logger = require("jitsi-meet-logger").getLogger(__filename);
var RTC = require("./modules/RTC/RTC"); var RTC = require("./modules/RTC/RTC");
var XMPPEvents = require("./service/xmpp/XMPPEvents"); var XMPPEvents = require("./service/xmpp/XMPPEvents");
var AuthenticationEvents = require("./service/authentication/AuthenticationEvents");
var RTCEvents = require("./service/RTC/RTCEvents"); var RTCEvents = require("./service/RTC/RTCEvents");
var EventEmitter = require("events"); var EventEmitter = require("events");
var JitsiConferenceEvents = require("./JitsiConferenceEvents"); var JitsiConferenceEvents = require("./JitsiConferenceEvents");
@ -213,6 +214,9 @@ JitsiConference.prototype.removeCommand = function (name) {
*/ */
JitsiConference.prototype.setDisplayName = function(name) { JitsiConference.prototype.setDisplayName = function(name) {
if(this.room){ if(this.room){
// remove previously set nickname
this.room.removeFromPresence("nick");
this.room.addToPresence("nick", {attributes: {xmlns: 'http://jabber.org/protocol/nick'}, value: name}); this.room.addToPresence("nick", {attributes: {xmlns: 'http://jabber.org/protocol/nick'}, value: name});
this.room.sendPresence(); this.room.sendPresence();
} }
@ -559,6 +563,10 @@ function setupListeners(conference) {
conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED, JitsiConferenceErrors.SETUP_FAILED); conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED, JitsiConferenceErrors.SETUP_FAILED);
}); });
conference.room.addListener(AuthenticationEvents.IDENTITY_UPDATED, function (authEnabled, authIdentity) {
console.error(authEnabled, authIdentity);
});
conference.room.addListener(XMPPEvents.MESSAGE_RECEIVED, function (jid, displayName, txt, myJid, ts) { conference.room.addListener(XMPPEvents.MESSAGE_RECEIVED, function (jid, displayName, txt, myJid, ts) {
var id = Strophe.getResourceFromJid(jid); var id = Strophe.getResourceFromJid(jid);
conference.eventEmitter.emit(JitsiConferenceEvents.MESSAGE_RECEIVED, id, txt, ts); conference.eventEmitter.emit(JitsiConferenceEvents.MESSAGE_RECEIVED, id, txt, ts);
@ -609,7 +617,7 @@ function setupListeners(conference) {
module.exports = JitsiConference; module.exports = JitsiConference;
}).call(this,"/JitsiConference.js") }).call(this,"/JitsiConference.js")
},{"./JitsiConferenceErrors":2,"./JitsiConferenceEvents":3,"./JitsiParticipant":8,"./JitsiTrackEvents":10,"./modules/DTMF/JitsiDTMFManager":11,"./modules/RTC/RTC":16,"./modules/statistics/statistics":24,"./service/RTC/RTCEvents":79,"./service/xmpp/XMPPEvents":85,"events":43,"jitsi-meet-logger":47}],2:[function(require,module,exports){ },{"./JitsiConferenceErrors":2,"./JitsiConferenceEvents":3,"./JitsiParticipant":8,"./JitsiTrackEvents":10,"./modules/DTMF/JitsiDTMFManager":11,"./modules/RTC/RTC":16,"./modules/statistics/statistics":24,"./service/RTC/RTCEvents":79,"./service/authentication/AuthenticationEvents":81,"./service/xmpp/XMPPEvents":85,"events":43,"jitsi-meet-logger":47}],2:[function(require,module,exports){
/** /**
* Enumeration with the errors for the conference. * Enumeration with the errors for the conference.
* @type {{string: string}} * @type {{string: string}}
@ -959,9 +967,21 @@ var LibJitsiMeet = {
return tracks; return tracks;
}); });
}, },
/**
* Checks if its possible to enumerate available cameras/micropones.
* @returns {boolean} true if available, false otherwise.
*/
isDeviceListAvailable: function () { isDeviceListAvailable: function () {
return RTC.isDeviceListAvailable(); return RTC.isDeviceListAvailable();
}, },
/**
* Returns true if changing the camera / microphone device is supported and
* false if not.
* @returns {boolean} true if available, false otherwise.
*/
isDeviceChangeAvailable: function () {
return RTC.isDeviceChangeAvailable();
},
enumerateDevices: function (callback) { enumerateDevices: function (callback) {
RTC.enumerateDevices(callback); RTC.enumerateDevices(callback);
} }
@ -2046,10 +2066,21 @@ RTC.getVideoSrc = function (element) {
return RTCUtils.getVideoSrc(element); return RTCUtils.getVideoSrc(element);
}; };
/**
* Returns true if retrieving the the list of input devices is supported and
* false if not.
*/
RTC.isDeviceListAvailable = function () { RTC.isDeviceListAvailable = function () {
return RTCUtils.isDeviceListAvailable(); return RTCUtils.isDeviceListAvailable();
}; };
/**
* Returns true if changing the camera / microphone device is supported and
* false if not.
*/
RTC.isDeviceChangeAvailable = function () {
return RTCUtils.isDeviceChangeAvailable();
}
/** /**
* Allows to receive list of available cameras/microphones. * Allows to receive list of available cameras/microphones.
* @param {function} callback would receive array of devices as an argument * @param {function} callback would receive array of devices as an argument
@ -3007,6 +3038,16 @@ var RTCUtils = {
} }
return (MediaStreamTrack && MediaStreamTrack.getSources)? true : false; return (MediaStreamTrack && MediaStreamTrack.getSources)? true : false;
}, },
/**
* Returns true if changing the camera / microphone device is supported and
* false if not.
*/
isDeviceChangeAvailable: function () {
if(RTCBrowserType.isChrome() || RTCBrowserType.isOpera() ||
RTCBrowserType.isTemasysPluginUsed())
return true;
return false;
},
/** /**
* A method to handle stopping of the stream. * A method to handle stopping of the stream.
* One point to handle the differences in various implementations. * One point to handle the differences in various implementations.

View File

@ -52,6 +52,7 @@ function doXmppAuth (room, lockPassword) {
room.room.moderator.allocateConferenceFocus(function () { room.room.moderator.allocateConferenceFocus(function () {
connection.disconnect(); connection.disconnect();
loginDialog.close(); loginDialog.close();
room.join(lockPassword);
}); });
}, function (err) { }, function (err) {

View File

@ -125,7 +125,7 @@ LocalVideo.prototype.setDisplayName = function(displayName, key) {
if (e.keyCode === 13) { if (e.keyCode === 13) {
e.preventDefault(); e.preventDefault();
$('#editDisplayName').hide(); $('#editDisplayName').hide();
self.VideoLayout.inputDisplayNameHandler(this.value); // focusout handler will save display name
} }
}); });
}); });