瀏覽代碼

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

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

5
 var logger = require("jitsi-meet-logger").getLogger(__filename);
5
 var logger = require("jitsi-meet-logger").getLogger(__filename);
6
 var RTC = require("./modules/RTC/RTC");
6
 var RTC = require("./modules/RTC/RTC");
7
 var XMPPEvents = require("./service/xmpp/XMPPEvents");
7
 var XMPPEvents = require("./service/xmpp/XMPPEvents");
8
+var AuthenticationEvents = require("./service/authentication/AuthenticationEvents");
8
 var RTCEvents = require("./service/RTC/RTCEvents");
9
 var RTCEvents = require("./service/RTC/RTCEvents");
9
 var EventEmitter = require("events");
10
 var EventEmitter = require("events");
10
 var JitsiConferenceEvents = require("./JitsiConferenceEvents");
11
 var JitsiConferenceEvents = require("./JitsiConferenceEvents");
213
  */
214
  */
214
 JitsiConference.prototype.setDisplayName = function(name) {
215
 JitsiConference.prototype.setDisplayName = function(name) {
215
     if(this.room){
216
     if(this.room){
217
+        // remove previously set nickname
218
+        this.room.removeFromPresence("nick");
219
+
216
         this.room.addToPresence("nick", {attributes: {xmlns: 'http://jabber.org/protocol/nick'}, value: name});
220
         this.room.addToPresence("nick", {attributes: {xmlns: 'http://jabber.org/protocol/nick'}, value: name});
217
         this.room.sendPresence();
221
         this.room.sendPresence();
218
     }
222
     }
559
         conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED, JitsiConferenceErrors.SETUP_FAILED);
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
     conference.room.addListener(XMPPEvents.MESSAGE_RECEIVED, function (jid, displayName, txt, myJid, ts) {
570
     conference.room.addListener(XMPPEvents.MESSAGE_RECEIVED, function (jid, displayName, txt, myJid, ts) {
563
         var id = Strophe.getResourceFromJid(jid);
571
         var id = Strophe.getResourceFromJid(jid);
564
         conference.eventEmitter.emit(JitsiConferenceEvents.MESSAGE_RECEIVED, id, txt, ts);
572
         conference.eventEmitter.emit(JitsiConferenceEvents.MESSAGE_RECEIVED, id, txt, ts);
609
 module.exports = JitsiConference;
617
 module.exports = JitsiConference;
610
 
618
 
611
 }).call(this,"/JitsiConference.js")
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
  * Enumeration with the errors for the conference.
622
  * Enumeration with the errors for the conference.
615
  * @type {{string: string}}
623
  * @type {{string: string}}
959
                 return tracks;
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
     isDeviceListAvailable: function () {
974
     isDeviceListAvailable: function () {
963
         return RTC.isDeviceListAvailable();
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
     enumerateDevices: function (callback) {
985
     enumerateDevices: function (callback) {
966
         RTC.enumerateDevices(callback);
986
         RTC.enumerateDevices(callback);
967
     }
987
     }
2046
     return RTCUtils.getVideoSrc(element);
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
 RTC.isDeviceListAvailable = function () {
2073
 RTC.isDeviceListAvailable = function () {
2050
     return RTCUtils.isDeviceListAvailable();
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
  * Allows to receive list of available cameras/microphones.
2085
  * Allows to receive list of available cameras/microphones.
2055
  * @param {function} callback would receive array of devices as an argument
2086
  * @param {function} callback would receive array of devices as an argument
3007
         }
3038
         }
3008
         return (MediaStreamTrack && MediaStreamTrack.getSources)? true : false;
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
      * A method to handle stopping of the stream.
3052
      * A method to handle stopping of the stream.
3012
      * One point to handle the differences in various implementations.
3053
      * One point to handle the differences in various implementations.

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

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

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

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

Loading…
取消
儲存