Преглед на файлове

feat: Disable p2p when transcribing is enabled. (#2812)

* feat: Disable p2p when transcribing is enabled.
master
bgrozev преди 4 месеца
родител
ревизия
6abd742f04
No account linked to committer's email address
променени са 2 файла, в които са добавени 13 реда и са изтрити 1 реда
  1. 10
    1
      JitsiConference.js
  2. 3
    0
      JitsiConferenceEventManager.js

+ 10
- 1
JitsiConference.js Целия файл

2656
     });
2656
     });
2657
 };
2657
 };
2658
 
2658
 
2659
+/** Set the transcribingEnabled flag. When transcribing is enabled p2p is
2660
+ * disabled. */
2661
+JitsiConference.prototype._setTranscribingEnabled = function(enabled) {
2662
+    if (this._transcribingEnabled !== enabled) {
2663
+        this._transcribingEnabled = enabled;
2664
+        this._maybeStartOrStopP2P(true);
2665
+    }
2666
+};
2667
+
2659
 /**
2668
 /**
2660
  * Updates conference startMuted policy if needed and fires an event.
2669
  * Updates conference startMuted policy if needed and fires an event.
2661
  *
2670
  *
3495
     const peers = this.getParticipants();
3504
     const peers = this.getParticipants();
3496
     const peerCount = peers.length;
3505
     const peerCount = peers.length;
3497
     const hasBotPeer = peers.find(p => p.getBotType() === 'poltergeist' || p.hasFeature(FEATURE_JIGASI)) !== undefined;
3506
     const hasBotPeer = peers.find(p => p.getBotType() === 'poltergeist' || p.hasFeature(FEATURE_JIGASI)) !== undefined;
3498
-    const shouldBeInP2P = peerCount === 1 && !hasBotPeer && !this._hasVisitors;
3507
+    const shouldBeInP2P = peerCount === 1 && !hasBotPeer && !this._hasVisitors && !this._transcribingEnabled;
3499
 
3508
 
3500
     logger.debug(`P2P? peerCount: ${peerCount}, hasBotPeer: ${hasBotPeer} => ${shouldBeInP2P}`);
3509
     logger.debug(`P2P? peerCount: ${peerCount}, hasBotPeer: ${hasBotPeer} => ${shouldBeInP2P}`);
3501
 
3510
 

+ 3
- 0
JitsiConferenceEventManager.js Целия файл

412
                 video && (conference.isVideoMutedByFocus = true);
412
                 video && (conference.isVideoMutedByFocus = true);
413
                 conference._updateStartMutedPolicy(audio, video);
413
                 conference._updateStartMutedPolicy(audio, video);
414
             }
414
             }
415
+            if (metadata.recording && typeof metadata.recording.isTranscribingEnabled !== 'undefined') {
416
+                conference._setTranscribingEnabled(Boolean(metadata.recording.isTranscribingEnabled));
417
+            }
415
             conference.eventEmitter.emit(JitsiConferenceEvents.METADATA_UPDATED, metadata);
418
             conference.eventEmitter.emit(JitsiConferenceEvents.METADATA_UPDATED, metadata);
416
         });
419
         });
417
     }
420
     }

Loading…
Отказ
Запис