Procházet zdrojové kódy

Add conference duration timer, get conference started timestamp (#1014)

dev1
theunafraid před 5 roky
rodič
revize
f35c74222f

+ 5
- 0
JitsiConferenceEventManager.js Zobrazit soubor

@@ -633,6 +633,11 @@ JitsiConferenceEventManager.prototype.setupXMPPListeners = function() {
633 633
 
634 634
             conference.eventEmitter.emit(JitsiConferenceEvents.STARTED_MUTED);
635 635
         });
636
+
637
+    this._addConferenceXMPPListener(XMPPEvents.CONFERENCE_TIMESTAMP_RECEIVED,
638
+        createdTimestamp => {
639
+            conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_CREATED_TIMESTAMP, createdTimestamp);
640
+        });
636 641
 };
637 642
 
638 643
 /**

+ 5
- 0
JitsiConferenceEvents.js Zobrazit soubor

@@ -75,6 +75,11 @@ export const DISPLAY_NAME_CHANGED = 'conference.displayNameChanged';
75 75
  */
76 76
 export const DOMINANT_SPEAKER_CHANGED = 'conference.dominantSpeaker';
77 77
 
78
+/**
79
+ * UTC conference timestamp when first participant joined.
80
+ */
81
+export const CONFERENCE_CREATED_TIMESTAMP = 'conference.createdTimestamp';
82
+
78 83
 /**
79 84
  * Indicates that DTMF support changed.
80 85
  */

+ 20
- 6
modules/xmpp/xmpp.js Zobrazit soubor

@@ -206,12 +206,19 @@ export default class XMPP extends Listenable {
206 206
                     identities.forEach(identity => {
207 207
                         if (identity.type === 'speakerstats') {
208 208
                             this.speakerStatsComponentAddress = identity.name;
209
+                        }
209 210
 
210
-                            this.connection.addHandler(
211
-                                this._onPrivateMessage.bind(this), null,
212
-                                'message', null, null);
211
+                        if (identity.type === 'conference_duration') {
212
+                            this.conferenceDurationComponentAddress = identity.name;
213 213
                         }
214 214
                     });
215
+
216
+                    if (this.speakerStatsComponentAddress
217
+                        || this.conferenceDurationComponentAddress) {
218
+                        this.connection.addHandler(
219
+                            this._onPrivateMessage.bind(this), null,
220
+                            'message', null, null);
221
+                    }
215 222
                 })
216 223
                 .catch(error => {
217 224
                     const errmsg = 'Feature discovery error';
@@ -713,7 +720,7 @@ export default class XMPP extends Listenable {
713 720
 
714 721
     /**
715 722
      * A private message is received, message that is not addressed to the muc.
716
-     * We expect private message coming from speaker stats component if it is
723
+     * We expect private message coming from plugins component if it is
717 724
      * enabled and running.
718 725
      *
719 726
      * @param {string} msg - The message.
@@ -721,8 +728,8 @@ export default class XMPP extends Listenable {
721 728
     _onPrivateMessage(msg) {
722 729
         const from = msg.getAttribute('from');
723 730
 
724
-        if (!this.speakerStatsComponentAddress
725
-            || from !== this.speakerStatsComponentAddress) {
731
+        if (!(from === this.speakerStatsComponentAddress
732
+            || from === this.conferenceDurationComponentAddress)) {
726 733
             return;
727 734
         }
728 735
 
@@ -737,6 +744,13 @@ export default class XMPP extends Listenable {
737 744
                 XMPPEvents.SPEAKER_STATS_RECEIVED, parsedJson.users);
738 745
         }
739 746
 
747
+        if (parsedJson
748
+            && parsedJson[JITSI_MEET_MUC_TYPE] === 'conference_duration'
749
+            && parsedJson.created_timestamp) {
750
+            this.eventEmitter.emit(
751
+                XMPPEvents.CONFERENCE_TIMESTAMP_RECEIVED, parsedJson.created_timestamp);
752
+        }
753
+
740 754
         return true;
741 755
     }
742 756
 }

+ 5
- 0
service/xmpp/XMPPEvents.js Zobrazit soubor

@@ -211,6 +211,11 @@ const XMPPEvents = {
211 211
      */
212 212
     SPEAKER_STATS_RECEIVED: 'xmpp.speaker_stats_received',
213 213
 
214
+    /**
215
+     * Event fired when conference creation timestamp is received.
216
+     */
217
+    CONFERENCE_TIMESTAMP_RECEIVED: 'xmpp.conference_timestamp_received',
218
+
214 219
     // Designates an event indicating that we should join the conference with
215 220
     // audio and/or video muted.
216 221
     START_MUTED_FROM_FOCUS: 'xmpp.start_muted_from_focus',

Načítá se…
Zrušit
Uložit