Explorar el Código

feat: add config property for P2P test mode

P2P test mode disables automatic switching to P2P when there are 2
participants in the room.
dev1
paweldomas hace 8 años
padre
commit
2c82013f97
Se han modificado 1 ficheros con 14 adiciones y 2 borrados
  1. 14
    2
      JitsiConference.js

+ 14
- 2
JitsiConference.js Ver fichero

313
         || typeof this.options.config.p2p === 'undefined';
313
         || typeof this.options.config.p2p === 'undefined';
314
 };
314
 };
315
 
315
 
316
+/**
317
+ * When in P2P test mode, the conference will not automatically switch to P2P
318
+ * when there 2 participants.
319
+ * @return {boolean}
320
+ */
321
+JitsiConference.prototype.isP2PTestModeEnabled = function() {
322
+    return Boolean(this.options.config.testing
323
+        && this.options.config.testing.p2pTestMode);
324
+};
325
+
316
 /**
326
 /**
317
  * Leaves the conference.
327
  * Leaves the conference.
318
  * @returns {Promise}
328
  * @returns {Promise}
1317
                     reasonMsg: 'P2P not supported',
1327
                     reasonMsg: 'P2P not supported',
1318
                     errorMsg: 'This client does not support P2P connections'
1328
                     errorMsg: 'This client does not support P2P connections'
1319
                 });
1329
                 });
1320
-        } else if (!this.isP2PEnabled()) {
1330
+        } else if (!this.isP2PEnabled() && !this.isP2PTestModeEnabled()) {
1321
             this._rejectIncomingCall(
1331
             this._rejectIncomingCall(
1322
                 jingleSession, {
1332
                 jingleSession, {
1323
                     reasonTag: 'decline',
1333
                     reasonTag: 'decline',
2317
  * @private
2327
  * @private
2318
  */
2328
  */
2319
 JitsiConference.prototype._maybeStartOrStopP2P = function(userLeftEvent) {
2329
 JitsiConference.prototype._maybeStartOrStopP2P = function(userLeftEvent) {
2320
-    if (!RTCBrowserType.isP2PSupported() || !this.isP2PEnabled()) {
2330
+    if (!RTCBrowserType.isP2PSupported()
2331
+        || !this.isP2PEnabled()
2332
+        || this.isP2PTestModeEnabled()) {
2321
         logger.info('Auto P2P disabled');
2333
         logger.info('Auto P2P disabled');
2322
 
2334
 
2323
         return;
2335
         return;

Loading…
Cancelar
Guardar