|
@@ -1,3 +1,5 @@
|
|
1
|
+import _ from 'lodash';
|
|
2
|
+
|
1
|
3
|
import JitsiMeetJS from '../base/lib-jitsi-meet';
|
2
|
4
|
|
3
|
5
|
declare var APP: Object;
|
|
@@ -27,7 +29,7 @@ const statsEmitter = {
|
27
|
29
|
const { connectionQuality } = JitsiMeetJS.events;
|
28
|
30
|
|
29
|
31
|
conference.on(connectionQuality.LOCAL_STATS_UPDATED,
|
30
|
|
- stats => this._onStatsUpdated(stats));
|
|
32
|
+ stats => this._onStatsUpdated(conference.myUserId(), stats));
|
31
|
33
|
|
32
|
34
|
conference.on(connectionQuality.REMOTE_STATS_UPDATED,
|
33
|
35
|
(id, stats) => this._emitStatsUpdate(id, stats));
|
|
@@ -100,15 +102,15 @@ const statsEmitter = {
|
100
|
102
|
* also update listeners of remote user stats of changes related to their
|
101
|
103
|
* stats.
|
102
|
104
|
*
|
|
105
|
+ * @param {string} currentUserId - The user id for the local user.
|
103
|
106
|
* @param {Object} stats - Connection stats for the local user as provided
|
104
|
107
|
* by the library.
|
105
|
108
|
* @returns {void}
|
106
|
109
|
*/
|
107
|
|
- _onStatsUpdated(stats) {
|
|
110
|
+ _onStatsUpdated(currentUserId, stats) {
|
108
|
111
|
const allUserFramerates = stats.framerate;
|
109
|
112
|
const allUserResolutions = stats.resolution;
|
110
|
113
|
|
111
|
|
- const currentUserId = APP.conference.getMyUserId();
|
112
|
114
|
const currentUserFramerate = allUserFramerates[currentUserId];
|
113
|
115
|
const currentUserResolution = allUserResolutions[currentUserId];
|
114
|
116
|
|
|
@@ -121,26 +123,30 @@ const statsEmitter = {
|
121
|
123
|
|
122
|
124
|
this._emitStatsUpdate(currentUserId, stats);
|
123
|
125
|
|
124
|
|
- Object.keys(allUserFramerates)
|
|
126
|
+ // Get all the unique user ids from the framerate and resolution stats
|
|
127
|
+ // and update remote user stats as needed.
|
|
128
|
+ const framerateUserIds = Object.keys(allUserFramerates);
|
|
129
|
+ const resolutionUserIds = Object.keys(allUserResolutions);
|
|
130
|
+
|
|
131
|
+ _.union(framerateUserIds, resolutionUserIds)
|
125
|
132
|
.filter(id => id !== currentUserId)
|
126
|
133
|
.forEach(id => {
|
|
134
|
+ const remoteUserStats = {};
|
|
135
|
+
|
127
|
136
|
const framerate = allUserFramerates[id];
|
128
|
137
|
|
129
|
138
|
if (framerate) {
|
130
|
|
- this._emitStatsUpdate(id, { framerate });
|
|
139
|
+ remoteUserStats.framerate = framerate;
|
131
|
140
|
}
|
132
|
|
- });
|
133
|
141
|
|
134
|
|
- Object.keys(allUserResolutions)
|
135
|
|
- .filter(id => id !== currentUserId)
|
136
|
|
- .forEach(id => {
|
137
|
142
|
const resolution = allUserResolutions[id];
|
138
|
143
|
|
139
|
144
|
if (resolution) {
|
140
|
|
- this._emitStatsUpdate(id, { resolution });
|
|
145
|
+ remoteUserStats.resolution = resolution;
|
141
|
146
|
}
|
142
|
|
- });
|
143
|
147
|
|
|
148
|
+ this._emitStatsUpdate(id, remoteUserStats);
|
|
149
|
+ });
|
144
|
150
|
}
|
145
|
151
|
};
|
146
|
152
|
|