ソースを参照

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

dev1
theunafraid 5年前
コミット
f35c74222f
4個のファイルの変更35行の追加6行の削除
  1. 5
    0
      JitsiConferenceEventManager.js
  2. 5
    0
      JitsiConferenceEvents.js
  3. 20
    6
      modules/xmpp/xmpp.js
  4. 5
    0
      service/xmpp/XMPPEvents.js

+ 5
- 0
JitsiConferenceEventManager.js ファイルの表示

633
 
633
 
634
             conference.eventEmitter.emit(JitsiConferenceEvents.STARTED_MUTED);
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 ファイルの表示

75
  */
75
  */
76
 export const DOMINANT_SPEAKER_CHANGED = 'conference.dominantSpeaker';
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
  * Indicates that DTMF support changed.
84
  * Indicates that DTMF support changed.
80
  */
85
  */

+ 20
- 6
modules/xmpp/xmpp.js ファイルの表示

206
                     identities.forEach(identity => {
206
                     identities.forEach(identity => {
207
                         if (identity.type === 'speakerstats') {
207
                         if (identity.type === 'speakerstats') {
208
                             this.speakerStatsComponentAddress = identity.name;
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
                 .catch(error => {
223
                 .catch(error => {
217
                     const errmsg = 'Feature discovery error';
224
                     const errmsg = 'Feature discovery error';
713
 
720
 
714
     /**
721
     /**
715
      * A private message is received, message that is not addressed to the muc.
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
      * enabled and running.
724
      * enabled and running.
718
      *
725
      *
719
      * @param {string} msg - The message.
726
      * @param {string} msg - The message.
721
     _onPrivateMessage(msg) {
728
     _onPrivateMessage(msg) {
722
         const from = msg.getAttribute('from');
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
             return;
733
             return;
727
         }
734
         }
728
 
735
 
737
                 XMPPEvents.SPEAKER_STATS_RECEIVED, parsedJson.users);
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
         return true;
754
         return true;
741
     }
755
     }
742
 }
756
 }

+ 5
- 0
service/xmpp/XMPPEvents.js ファイルの表示

211
      */
211
      */
212
     SPEAKER_STATS_RECEIVED: 'xmpp.speaker_stats_received',
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
     // Designates an event indicating that we should join the conference with
219
     // Designates an event indicating that we should join the conference with
215
     // audio and/or video muted.
220
     // audio and/or video muted.
216
     START_MUTED_FROM_FOCUS: 'xmpp.start_muted_from_focus',
221
     START_MUTED_FROM_FOCUS: 'xmpp.start_muted_from_focus',

読み込み中…
キャンセル
保存