|
|
@@ -84,6 +84,10 @@ function ColibriFocus(connection, bridgejid) {
|
|
84
|
84
|
this.wait = true;
|
|
85
|
85
|
|
|
86
|
86
|
this.recordingEnabled = false;
|
|
|
87
|
+
|
|
|
88
|
+ // stores information about the endpoints (i.e. display names) to
|
|
|
89
|
+ // be sent to the videobridge.
|
|
|
90
|
+ this.endpointsInfo = null;
|
|
87
|
91
|
}
|
|
88
|
92
|
|
|
89
|
93
|
// creates a conferences with an initial set of peers
|
|
|
@@ -176,7 +180,7 @@ ColibriFocus.prototype.makeConference = function (peers) {
|
|
176
|
180
|
// the new recording state, according to the IQ.
|
|
177
|
181
|
ColibriFocus.prototype.setRecording = function(state, token, callback) {
|
|
178
|
182
|
var self = this;
|
|
179
|
|
- var elem = $iq({to: this.bridgejid, type: 'get'});
|
|
|
183
|
+ var elem = $iq({to: this.bridgejid, type: 'set'});
|
|
180
|
184
|
elem.c('conference', {
|
|
181
|
185
|
xmlns: 'http://jitsi.org/protocol/colibri',
|
|
182
|
186
|
id: this.confid
|
|
|
@@ -199,6 +203,74 @@ ColibriFocus.prototype.setRecording = function(state, token, callback) {
|
|
199
|
203
|
);
|
|
200
|
204
|
};
|
|
201
|
205
|
|
|
|
206
|
+/*
|
|
|
207
|
+ * Updates the display name for an endpoint with a specific jid.
|
|
|
208
|
+ * jid: the jid associated with the endpoint.
|
|
|
209
|
+ * displayName: the new display name for the endpoint.
|
|
|
210
|
+ */
|
|
|
211
|
+ColibriFocus.prototype.setEndpointDisplayName = function(jid, displayName) {
|
|
|
212
|
+ var endpointId = jid.substr(1 + jid.lastIndexOf('/'));
|
|
|
213
|
+ var update = false;
|
|
|
214
|
+
|
|
|
215
|
+ if (this.endpointsInfo === null) {
|
|
|
216
|
+ this.endpointsInfo = {};
|
|
|
217
|
+ }
|
|
|
218
|
+
|
|
|
219
|
+ var endpointInfo = this.endpointsInfo[endpointId];
|
|
|
220
|
+ if ('undefined' === typeof endpointInfo) {
|
|
|
221
|
+ endpointInfo = this.endpointsInfo[endpointId] = {};
|
|
|
222
|
+ }
|
|
|
223
|
+
|
|
|
224
|
+ if (endpointInfo['displayname'] !== displayName) {
|
|
|
225
|
+ endpointInfo['displayname'] = displayName;
|
|
|
226
|
+ update = true;
|
|
|
227
|
+ }
|
|
|
228
|
+
|
|
|
229
|
+ if (update) {
|
|
|
230
|
+ this.updateEndpoints();
|
|
|
231
|
+ }
|
|
|
232
|
+};
|
|
|
233
|
+
|
|
|
234
|
+/*
|
|
|
235
|
+ * Sends a colibri message to the bridge that contains the
|
|
|
236
|
+ * current endpoints and their display names.
|
|
|
237
|
+ */
|
|
|
238
|
+ColibriFocus.prototype.updateEndpoints = function() {
|
|
|
239
|
+ if (this.confid === null
|
|
|
240
|
+ || this.endpointsInfo === null) {
|
|
|
241
|
+ return;
|
|
|
242
|
+ }
|
|
|
243
|
+
|
|
|
244
|
+ if (this.confid === 0) {
|
|
|
245
|
+ // the colibri conference is currently initiating
|
|
|
246
|
+ var self = this;
|
|
|
247
|
+ window.setTimeout(function() { self.updateEndpoints()}, 1000);
|
|
|
248
|
+ return;
|
|
|
249
|
+ }
|
|
|
250
|
+
|
|
|
251
|
+ var elem = $iq({to: this.bridgejid, type: 'set'});
|
|
|
252
|
+ elem.c('conference', {
|
|
|
253
|
+ xmlns: 'http://jitsi.org/protocol/colibri',
|
|
|
254
|
+ id: this.confid
|
|
|
255
|
+ });
|
|
|
256
|
+
|
|
|
257
|
+ for (var id in this.endpointsInfo) {
|
|
|
258
|
+ elem.c('endpoint');
|
|
|
259
|
+ elem.attrs({ id: id,
|
|
|
260
|
+ displayname: this.endpointsInfo[id]['displayname']
|
|
|
261
|
+ });
|
|
|
262
|
+ elem.up();
|
|
|
263
|
+ }
|
|
|
264
|
+
|
|
|
265
|
+ //elem.up(); //conference
|
|
|
266
|
+
|
|
|
267
|
+ this.connection.sendIQ(
|
|
|
268
|
+ elem,
|
|
|
269
|
+ function (result) {},
|
|
|
270
|
+ function (error) { console.warn(error); }
|
|
|
271
|
+ );
|
|
|
272
|
+};
|
|
|
273
|
+
|
|
202
|
274
|
ColibriFocus.prototype._makeConference = function () {
|
|
203
|
275
|
var self = this;
|
|
204
|
276
|
var elem = $iq({ to: this.bridgejid, type: 'get' });
|
|
|
@@ -235,6 +307,17 @@ ColibriFocus.prototype._makeConference = function () {
|
|
235
|
307
|
}
|
|
236
|
308
|
elem.up(); // end of content
|
|
237
|
309
|
});
|
|
|
310
|
+
|
|
|
311
|
+ if (this.endpointsInfo !== null) {
|
|
|
312
|
+ for (var id in this.endpointsInfo) {
|
|
|
313
|
+ elem.c('endpoint');
|
|
|
314
|
+ elem.attrs({ id: id,
|
|
|
315
|
+ displayname: this.endpointsInfo[id]['displayname']
|
|
|
316
|
+ });
|
|
|
317
|
+ elem.up();
|
|
|
318
|
+ }
|
|
|
319
|
+ }
|
|
|
320
|
+
|
|
238
|
321
|
/*
|
|
239
|
322
|
var localSDP = new SDP(this.peerconnection.localDescription.sdp);
|
|
240
|
323
|
localSDP.media.forEach(function (media, channel) {
|