瀏覽代碼

properly update nickname

j8
isymchych 9 年之前
父節點
當前提交
0ec8ab69a0
共有 4 個檔案被更改,包括 50 行新增5 行删除
  1. 6
    3
      app.js
  2. 42
    1
      lib-jitsi-meet.js
  3. 1
    0
      modules/AuthHandler.js
  4. 1
    1
      modules/UI/videolayout/LocalVideo.js

+ 6
- 3
app.js 查看文件

@@ -196,7 +196,7 @@ function initConference(localTracks, connection) {
196 196
 
197 197
 
198 198
     room.on(ConferenceEvents.TRACK_ADDED, function (track) {
199
-        if (track.isLocal) { // skip local tracks
199
+        if (track.isLocal()) { // skip local tracks
200 200
             return;
201 201
         }
202 202
         console.error(
@@ -205,7 +205,7 @@ function initConference(localTracks, connection) {
205 205
         APP.UI.addRemoteStream(track);
206 206
     });
207 207
     room.on(ConferenceEvents.TRACK_REMOVED, function (track) {
208
-        if (track.isLocal) { // skip local tracks
208
+        if (track.isLocal()) { // skip local tracks
209 209
             return;
210 210
         }
211 211
 
@@ -320,7 +320,10 @@ function initConference(localTracks, connection) {
320 320
         nick = APP.UI.askForNickname();
321 321
         APP.settings.setDisplayName(nick);
322 322
     }
323
-    room.setDisplayName(nick);
323
+
324
+    if (nick) {
325
+        room.setDisplayName(nick);
326
+    }
324 327
     room.on(ConferenceEvents.DISPLAY_NAME_CHANGED, function (id, displayName) {
325 328
         APP.UI.changeDisplayName(id, displayName);
326 329
     });

+ 42
- 1
lib-jitsi-meet.js 查看文件

@@ -5,6 +5,7 @@
5 5
 var logger = require("jitsi-meet-logger").getLogger(__filename);
6 6
 var RTC = require("./modules/RTC/RTC");
7 7
 var XMPPEvents = require("./service/xmpp/XMPPEvents");
8
+var AuthenticationEvents = require("./service/authentication/AuthenticationEvents");
8 9
 var RTCEvents = require("./service/RTC/RTCEvents");
9 10
 var EventEmitter = require("events");
10 11
 var JitsiConferenceEvents = require("./JitsiConferenceEvents");
@@ -213,6 +214,9 @@ JitsiConference.prototype.removeCommand = function (name) {
213 214
  */
214 215
 JitsiConference.prototype.setDisplayName = function(name) {
215 216
     if(this.room){
217
+        // remove previously set nickname
218
+        this.room.removeFromPresence("nick");
219
+
216 220
         this.room.addToPresence("nick", {attributes: {xmlns: 'http://jabber.org/protocol/nick'}, value: name});
217 221
         this.room.sendPresence();
218 222
     }
@@ -559,6 +563,10 @@ function setupListeners(conference) {
559 563
         conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED, JitsiConferenceErrors.SETUP_FAILED);
560 564
     });
561 565
 
566
+    conference.room.addListener(AuthenticationEvents.IDENTITY_UPDATED, function (authEnabled, authIdentity) {
567
+        console.error(authEnabled, authIdentity);
568
+    });
569
+
562 570
     conference.room.addListener(XMPPEvents.MESSAGE_RECEIVED, function (jid, displayName, txt, myJid, ts) {
563 571
         var id = Strophe.getResourceFromJid(jid);
564 572
         conference.eventEmitter.emit(JitsiConferenceEvents.MESSAGE_RECEIVED, id, txt, ts);
@@ -609,7 +617,7 @@ function setupListeners(conference) {
609 617
 module.exports = JitsiConference;
610 618
 
611 619
 }).call(this,"/JitsiConference.js")
612
-},{"./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){
620
+},{"./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){
613 621
 /**
614 622
  * Enumeration with the errors for the conference.
615 623
  * @type {{string: string}}
@@ -959,9 +967,21 @@ var LibJitsiMeet = {
959 967
                 return tracks;
960 968
             });
961 969
     },
970
+    /**
971
+     * Checks if its possible to enumerate available cameras/micropones.
972
+     * @returns {boolean} true if available, false otherwise.
973
+     */
962 974
     isDeviceListAvailable: function () {
963 975
         return RTC.isDeviceListAvailable();
964 976
     },
977
+    /**
978
+     * Returns true if changing the camera / microphone device is supported and
979
+     * false if not.
980
+     * @returns {boolean} true if available, false otherwise.
981
+     */
982
+    isDeviceChangeAvailable: function () {
983
+        return RTC.isDeviceChangeAvailable();
984
+    },
965 985
     enumerateDevices: function (callback) {
966 986
         RTC.enumerateDevices(callback);
967 987
     }
@@ -2046,10 +2066,21 @@ RTC.getVideoSrc = function (element) {
2046 2066
     return RTCUtils.getVideoSrc(element);
2047 2067
 };
2048 2068
 
2069
+/**
2070
+ * Returns true if retrieving the the list of input devices is supported and
2071
+ * false if not.
2072
+ */
2049 2073
 RTC.isDeviceListAvailable = function () {
2050 2074
     return RTCUtils.isDeviceListAvailable();
2051 2075
 };
2052 2076
 
2077
+/**
2078
+ * Returns true if changing the camera / microphone device is supported and
2079
+ * false if not.
2080
+ */
2081
+RTC.isDeviceChangeAvailable = function () {
2082
+    return RTCUtils.isDeviceChangeAvailable();
2083
+}
2053 2084
 /**
2054 2085
  * Allows to receive list of available cameras/microphones.
2055 2086
  * @param {function} callback would receive array of devices as an argument
@@ -3007,6 +3038,16 @@ var RTCUtils = {
3007 3038
         }
3008 3039
         return (MediaStreamTrack && MediaStreamTrack.getSources)? true : false;
3009 3040
     },
3041
+    /**
3042
+     * Returns true if changing the camera / microphone device is supported and
3043
+     * false if not.
3044
+     */
3045
+    isDeviceChangeAvailable: function () {
3046
+        if(RTCBrowserType.isChrome() || RTCBrowserType.isOpera() ||
3047
+            RTCBrowserType.isTemasysPluginUsed())
3048
+            return true;
3049
+        return false;
3050
+    },
3010 3051
     /**
3011 3052
      * A method to handle stopping of the stream.
3012 3053
      * One point to handle the differences in various implementations.

+ 1
- 0
modules/AuthHandler.js 查看文件

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

+ 1
- 1
modules/UI/videolayout/LocalVideo.js 查看文件

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

Loading…
取消
儲存