Просмотр исходного кода

Prevents firing events for the active speaker for the local user. Implements getUserID in JitsiConference.

dev1
hristoterezov 10 лет назад
Родитель
Сommit
74215b3744
2 измененных файлов: 18 добавлений и 2 удалений
  1. 9
    1
      JitsiConference.js
  2. 9
    1
      lib-jitsi-meet.js

+ 9
- 1
JitsiConference.js Просмотреть файл

191
 //    this.participants[jid] = new JitsiParticipant();
191
 //    this.participants[jid] = new JitsiParticipant();
192
 }
192
 }
193
 
193
 
194
+/**
195
+ * Returns the local user's ID
196
+ * @return {string} local user's ID
197
+ */
198
+JitsiConference.prototype.myUserId = function () {
199
+    return (this.room && this.room.myroomjid)? Strophe.getResourceFromJid(this.room.myroomjid) : null;
200
+}
201
+
194
 /**
202
 /**
195
  * Setups the listeners needed for the conference.
203
  * Setups the listeners needed for the conference.
196
  * @param conference the conference
204
  * @param conference the conference
221
 //    });
229
 //    });
222
     conference.rtc.addListener(RTCEvents.DOMINANTSPEAKER_CHANGED, function (id) {
230
     conference.rtc.addListener(RTCEvents.DOMINANTSPEAKER_CHANGED, function (id) {
223
         if(conference.lastActiveSpeaker !== id && conference.room
231
         if(conference.lastActiveSpeaker !== id && conference.room
224
-            && conference.room.myroomjid !== id) {
232
+            && conference.myUserId() !== id) {
225
             conference.lastActiveSpeaker = id;
233
             conference.lastActiveSpeaker = id;
226
             conference.eventEmitter.emit(JitsiConferenceEvents.ACTIVE_SPEAKER_CHANGED, id);
234
             conference.eventEmitter.emit(JitsiConferenceEvents.ACTIVE_SPEAKER_CHANGED, id);
227
         }
235
         }

+ 9
- 1
lib-jitsi-meet.js Просмотреть файл

192
 //    this.participants[jid] = new JitsiParticipant();
192
 //    this.participants[jid] = new JitsiParticipant();
193
 }
193
 }
194
 
194
 
195
+/**
196
+ * Returns the local user's ID
197
+ * @return {string} local user's ID
198
+ */
199
+JitsiConference.prototype.myUserId = function () {
200
+    return (this.room && this.room.myroomjid)? Strophe.getResourceFromJid(this.room.myroomjid) : null;
201
+}
202
+
195
 /**
203
 /**
196
  * Setups the listeners needed for the conference.
204
  * Setups the listeners needed for the conference.
197
  * @param conference the conference
205
  * @param conference the conference
222
 //    });
230
 //    });
223
     conference.rtc.addListener(RTCEvents.DOMINANTSPEAKER_CHANGED, function (id) {
231
     conference.rtc.addListener(RTCEvents.DOMINANTSPEAKER_CHANGED, function (id) {
224
         if(conference.lastActiveSpeaker !== id && conference.room
232
         if(conference.lastActiveSpeaker !== id && conference.room
225
-            && conference.room.myroomjid !== id) {
233
+            && conference.myUserId() !== id) {
226
             conference.lastActiveSpeaker = id;
234
             conference.lastActiveSpeaker = id;
227
             conference.eventEmitter.emit(JitsiConferenceEvents.ACTIVE_SPEAKER_CHANGED, id);
235
             conference.eventEmitter.emit(JitsiConferenceEvents.ACTIVE_SPEAKER_CHANGED, id);
228
         }
236
         }

Загрузка…
Отмена
Сохранить