Sfoglia il codice sorgente

Changes lastN event params to be leaving and entering endpoint IDs.

dev1
damencho 8 anni fa
parent
commit
5158c4f352

+ 0
- 6
JitsiConferenceEventManager.js Vedi File

461
     const conference = this.conference;
461
     const conference = this.conference;
462
     const rtc = conference.rtc;
462
     const rtc = conference.rtc;
463
 
463
 
464
-    this.rtcForwarder
465
-        = new EventEmitterForwarder(rtc, this.conference.eventEmitter);
466
-
467
     rtc.addListener(
464
     rtc.addListener(
468
         RTCEvents.REMOTE_TRACK_ADDED,
465
         RTCEvents.REMOTE_TRACK_ADDED,
469
         conference.onRemoteTrackAdded.bind(conference));
466
         conference.onRemoteTrackAdded.bind(conference));
494
             { value: now });
491
             { value: now });
495
     });
492
     });
496
 
493
 
497
-    this.rtcForwarder.forward(RTCEvents.LASTN_ENDPOINT_CHANGED,
498
-        JitsiConferenceEvents.LAST_N_ENDPOINTS_CHANGED);
499
-
500
     rtc.addListener(
494
     rtc.addListener(
501
         RTCEvents.AVAILABLE_DEVICES_CHANGED,
495
         RTCEvents.AVAILABLE_DEVICES_CHANGED,
502
         devices => conference.room.updateDeviceAvailability(devices));
496
         devices => conference.room.updateDeviceAvailability(devices));

+ 5
- 0
JitsiConferenceEvents.js Vedi File

90
 
90
 
91
 /**
91
 /**
92
  * The Last N set is changed.
92
  * The Last N set is changed.
93
+ *
94
+ * @param {Array<string>|null} leavingEndpointIds the ids of all the endpoints
95
+ * which are leaving Last N
96
+ * @param {Array<string>|null} enteringEndpointIds the ids of all the endpoints
97
+ * which are entering Last N
93
  */
98
  */
94
 export const LAST_N_ENDPOINTS_CHANGED = 'conference.lastNEndpointsChanged';
99
 export const LAST_N_ENDPOINTS_CHANGED = 'conference.lastNEndpointsChanged';
95
 
100
 

+ 1
- 2
doc/API.md Vedi File

109
         - MESSAGE_RECEIVED - new text message received. (parameters - id(string), text(string), ts(number))
109
         - MESSAGE_RECEIVED - new text message received. (parameters - id(string), text(string), ts(number))
110
         - DISPLAY_NAME_CHANGED - user has changed his display name. (parameters - id(string), displayName(string))
110
         - DISPLAY_NAME_CHANGED - user has changed his display name. (parameters - id(string), displayName(string))
111
         - SUBJECT_CHANGED - notifies that subject of the conference has changed (parameters - subject(string))
111
         - SUBJECT_CHANGED - notifies that subject of the conference has changed (parameters - subject(string))
112
-        - LAST_N_ENDPOINTS_CHANGED - last n set was changed (parameters - array of ids of users)
113
-        - IN_LAST_N_CHANGED - passes boolean property that shows whether the local user is included in last n set of any other user or not. (parameters - boolean)
112
+        - LAST_N_ENDPOINTS_CHANGED - last n set was changed (parameters - leavingEndpointIds(array) ids of users leaving lastN, enteringEndpointIds(array) ids of users entering lastN)
114
         - CONFERENCE_JOINED - notifies the local user that he joined the conference successfully. (no parameters)
113
         - CONFERENCE_JOINED - notifies the local user that he joined the conference successfully. (no parameters)
115
         - CONFERENCE_LEFT - notifies the local user that he left the conference successfully. (no parameters)
114
         - CONFERENCE_LEFT - notifies the local user that he left the conference successfully. (no parameters)
116
         - DTMF_SUPPORT_CHANGED - notifies if at least one user supports DTMF. (parameters - supports(boolean))
115
         - DTMF_SUPPORT_CHANGED - notifies if at least one user supports DTMF. (parameters - supports(boolean))

+ 2
- 7
modules/RTC/DataChannels.js Vedi File

99
                 // The new/latest list of last-n endpoint IDs.
99
                 // The new/latest list of last-n endpoint IDs.
100
                 const lastNEndpoints = obj.lastNEndpoints;
100
                 const lastNEndpoints = obj.lastNEndpoints;
101
 
101
 
102
-                // The list of endpoint IDs which are entering the list of
103
-                // last-n at this time i.e. were not in the old list of last-n
104
-                // endpoint IDs.
105
-                const endpointsEnteringLastN = obj.endpointsEnteringLastN;
106
-
107
                 logger.info('Data channel new last-n event: ',
102
                 logger.info('Data channel new last-n event: ',
108
-                    lastNEndpoints, endpointsEnteringLastN, obj);
103
+                    lastNEndpoints, obj);
109
                 self.eventEmitter.emit(RTCEvents.LASTN_ENDPOINT_CHANGED,
104
                 self.eventEmitter.emit(RTCEvents.LASTN_ENDPOINT_CHANGED,
110
-                    lastNEndpoints, endpointsEnteringLastN, obj);
105
+                    lastNEndpoints, obj);
111
             } else if (colibriClass === 'EndpointMessage') {
106
             } else if (colibriClass === 'EndpointMessage') {
112
                 self.eventEmitter.emit(
107
                 self.eventEmitter.emit(
113
                     RTCEvents.ENDPOINT_MESSAGE_RECEIVED, obj.from,
108
                     RTCEvents.ENDPOINT_MESSAGE_RECEIVED, obj.from,

+ 32
- 9
modules/RTC/RTC.js Vedi File

2
 import DataChannels from './DataChannels';
2
 import DataChannels from './DataChannels';
3
 import { getLogger } from 'jitsi-meet-logger';
3
 import { getLogger } from 'jitsi-meet-logger';
4
 import GlobalOnErrorHandler from '../util/GlobalOnErrorHandler';
4
 import GlobalOnErrorHandler from '../util/GlobalOnErrorHandler';
5
+import * as JitsiConferenceEvents from '../../JitsiConferenceEvents';
5
 import JitsiLocalTrack from './JitsiLocalTrack.js';
6
 import JitsiLocalTrack from './JitsiLocalTrack.js';
6
 import JitsiTrackError from '../../JitsiTrackError';
7
 import JitsiTrackError from '../../JitsiTrackError';
7
 import * as JitsiTrackErrors from '../../JitsiTrackErrors';
8
 import * as JitsiTrackErrors from '../../JitsiTrackErrors';
90
         this._lastNEndpoints = null;
91
         this._lastNEndpoints = null;
91
 
92
 
92
         // The last N change listener.
93
         // The last N change listener.
93
-        this._lastNChangeListener = null;
94
+        this._lastNChangeListener = this._onLastNChanged.bind(this);
94
 
95
 
95
         // Switch audio output device on all remote audio tracks. Local audio
96
         // Switch audio output device on all remote audio tracks. Local audio
96
         // tracks handle this event by themselves.
97
         // tracks handle this event by themselves.
169
                 this._dataChannelOpenListener);
170
                 this._dataChannelOpenListener);
170
 
171
 
171
             // Add Last N change listener.
172
             // Add Last N change listener.
172
-            this._lastNChangeListener = lastNEndpoints => {
173
-                this._lastNEndpoints = lastNEndpoints;
174
-            };
175
-
176
             this.addListener(RTCEvents.LASTN_ENDPOINT_CHANGED,
173
             this.addListener(RTCEvents.LASTN_ENDPOINT_CHANGED,
177
                 this._lastNChangeListener);
174
                 this._lastNChangeListener);
178
         }
175
         }
179
     }
176
     }
180
 
177
 
178
+    /**
179
+     * Receives events when Last N had changed.
180
+     * @param {array} lastNEndpoints the new Last N endpoints.
181
+     * @private
182
+     */
183
+    _onLastNChanged(lastNEndpoints) {
184
+        const oldLastNEndpoints = this._lastNEndpoints;
185
+        let leavingLastNEndpoints = [];
186
+        let enteringLastNEndpoints = [];
187
+
188
+        this._lastNEndpoints = lastNEndpoints;
189
+
190
+        if (oldLastNEndpoints) {
191
+            leavingLastNEndpoints = oldLastNEndpoints.filter(
192
+                id => !this.isInLastN(id));
193
+
194
+            if (lastNEndpoints) {
195
+                enteringLastNEndpoints = lastNEndpoints.filter(
196
+                    id => oldLastNEndpoints.indexOf(id) === -1);
197
+            }
198
+        }
199
+
200
+        this.conference.eventEmitter.emit(
201
+            JitsiConferenceEvents.LAST_N_ENDPOINTS_CHANGED,
202
+            leavingLastNEndpoints,
203
+            enteringLastNEndpoints);
204
+    }
205
+
181
     /**
206
     /**
182
      * Should be called when current media session ends and after the
207
      * Should be called when current media session ends and after the
183
      * PeerConnection has been closed using PeerConnection.close() method.
208
      * PeerConnection has been closed using PeerConnection.close() method.
600
             this.dataChannels.closeAllChannels();
625
             this.dataChannels.closeAllChannels();
601
             this.dataChannelsOpen = false;
626
             this.dataChannelsOpen = false;
602
 
627
 
603
-            if (this._lastNChangeListener) {
604
-                this.removeListener(RTCEvents.LASTN_ENDPOINT_CHANGED,
605
-                    this._lastNChangeListener);
606
-            }
628
+            this.removeListener(RTCEvents.LASTN_ENDPOINT_CHANGED,
629
+                this._lastNChangeListener);
607
         }
630
         }
608
     }
631
     }
609
 
632
 

Loading…
Annulla
Salva