Sfoglia il codice sorgente

ref(JitsiConference) Make methods getMediaSessions and getActiveMediaSession public.

dev1
Jaya Allamsetty 3 anni fa
parent
commit
5ae19379aa

+ 5
- 9
JitsiConference.js Vedi File

@@ -730,9 +730,8 @@ JitsiConference.prototype.leave = async function() {
730 730
  * Returns the currently active media session if any.
731 731
  *
732 732
  * @returns {JingleSessionPC|undefined}
733
- * @private
734 733
  */
735
-JitsiConference.prototype._getActiveMediaSession = function() {
734
+JitsiConference.prototype.getActiveMediaSession = function() {
736 735
     return this.isP2PActive() ? this.p2pJingleSession : this.jvbJingleSession;
737 736
 };
738 737
 
@@ -740,9 +739,8 @@ JitsiConference.prototype._getActiveMediaSession = function() {
740 739
  * Returns an array containing all media sessions existing in this conference.
741 740
  *
742 741
  * @returns {Array<JingleSessionPC>}
743
- * @private
744 742
  */
745
-JitsiConference.prototype._getMediaSessions = function() {
743
+JitsiConference.prototype.getMediaSessions = function() {
746 744
     const sessions = [];
747 745
 
748 746
     this.jvbJingleSession && sessions.push(this.jvbJingleSession);
@@ -1275,7 +1273,7 @@ JitsiConference.prototype.replaceTrack = function(oldTrack, newTrack) {
1275 1273
 
1276 1274
                 // we do not want to send presence update during setEffect switching, which does remove and then add
1277 1275
                 && !(oldTrack?._setEffectInProgress || newTrack?._setEffectInProgress)) {
1278
-                this._updateRoomPresence(this._getActiveMediaSession());
1276
+                this._updateRoomPresence(this.getActiveMediaSession());
1279 1277
             }
1280 1278
 
1281 1279
             if (newTrack !== null && (this.isMutedByFocus || this.isVideoMutedByFocus)) {
@@ -1911,7 +1909,7 @@ JitsiConference.prototype.onMemberLeft = function(jid) {
1911 1909
     }
1912 1910
 
1913 1911
     const participant = this.participants[id];
1914
-    const mediaSessions = this._getMediaSessions();
1912
+    const mediaSessions = this.getMediaSessions();
1915 1913
     let tracksToBeRemoved = [];
1916 1914
 
1917 1915
     for (const session of mediaSessions) {
@@ -3325,9 +3323,7 @@ JitsiConference.prototype._setP2PStatus = function(newStatus) {
3325 3323
         JitsiConferenceEvents.P2P_STATUS,
3326 3324
         this,
3327 3325
         this.p2p);
3328
-    this.eventEmitter.emit(
3329
-        JitsiConferenceEvents._MEDIA_SESSION_ACTIVE_CHANGED,
3330
-        this._getActiveMediaSession());
3326
+    this.eventEmitter.emit(JitsiConferenceEvents._MEDIA_SESSION_ACTIVE_CHANGED, this.getActiveMediaSession());
3331 3327
 
3332 3328
     // Refresh connection interrupted/restored
3333 3329
     this.eventEmitter.emit(

+ 2
- 2
modules/e2ee/KeyHandler.js Vedi File

@@ -101,7 +101,7 @@ export class KeyHandler extends Listenable {
101 101
      * @private
102 102
      */
103 103
     _onLocalTrackAdded(track) {
104
-        for (const session of this.conference._getMediaSessions()) {
104
+        for (const session of this.conference.getMediaSessions()) {
105 105
             this._setupSenderE2EEForTrack(session, track);
106 106
         }
107 107
     }
@@ -167,7 +167,7 @@ export class KeyHandler extends Listenable {
167 167
      */
168 168
     _trackMuteChanged(track) {
169 169
         if (browser.doesVideoMuteByStreamRemove() && track.isLocal() && track.isVideoTrack() && !track.isMuted()) {
170
-            for (const session of this.conference._getMediaSessions()) {
170
+            for (const session of this.conference.getMediaSessions()) {
171 171
                 this._setupSenderE2EEForTrack(session, track);
172 172
             }
173 173
         }

+ 2
- 2
modules/qualitycontrol/ReceiveVideoController.js Vedi File

@@ -285,7 +285,7 @@ export class ReceiveVideoController {
285 285
     setPreferredReceiveMaxFrameHeight(maxFrameHeight) {
286 286
         this._maxFrameHeight = maxFrameHeight;
287 287
 
288
-        for (const session of this._conference._getMediaSessions()) {
288
+        for (const session of this._conference.getMediaSessions()) {
289 289
             if (session.isP2P || !this._receiverVideoConstraints) {
290 290
                 maxFrameHeight && session.setReceiverVideoConstraint(maxFrameHeight);
291 291
             } else {
@@ -328,7 +328,7 @@ export class ReceiveVideoController {
328 328
             this._selectedEndpoints = constraints.selectedEndpoints ?? this._selectedEndpoints;
329 329
             this._rtc.setNewReceiverVideoConstraints(constraints);
330 330
 
331
-            const p2pSession = this._conference._getMediaSessions().find(session => session.isP2P);
331
+            const p2pSession = this._conference.getMediaSessions().find(session => session.isP2P);
332 332
 
333 333
             if (p2pSession) {
334 334
                 let maxFrameHeight = Object.values(constraints.constraints)[0]?.maxHeight;

+ 1
- 1
modules/qualitycontrol/ReceiveVideoController.spec.js Vedi File

@@ -22,7 +22,7 @@ class MockConference extends Listenable {
22 22
         this.mediaSessions = [];
23 23
     }
24 24
 
25
-    _getMediaSessions() {
25
+    getMediaSessions() {
26 26
         return this.mediaSessions;
27 27
     }
28 28
 }

+ 3
- 3
modules/qualitycontrol/SendVideoController.js Vedi File

@@ -50,7 +50,7 @@ export class SendVideoController {
50 50
         mediaSession.addListener(
51 51
             MediaSessionEvents.REMOTE_VIDEO_CONSTRAINTS_CHANGED,
52 52
             session => {
53
-                if (session === this.conference._getActiveMediaSession()) {
53
+                if (session === this.conference.getActiveMediaSession()) {
54 54
                     this._propagateSendMaxFrameHeight();
55 55
                 }
56 56
             });
@@ -68,7 +68,7 @@ export class SendVideoController {
68 68
         const promises = [];
69 69
 
70 70
         if (sendMaxFrameHeight >= 0) {
71
-            for (const session of this.conference._getMediaSessions()) {
71
+            for (const session of this.conference.getMediaSessions()) {
72 72
                 promises.push(session.setSenderVideoConstraint(sendMaxFrameHeight));
73 73
             }
74 74
         }
@@ -83,7 +83,7 @@ export class SendVideoController {
83 83
      * @returns {number|undefined}
84 84
      */
85 85
     selectSendMaxFrameHeight() {
86
-        const activeMediaSession = this.conference._getActiveMediaSession();
86
+        const activeMediaSession = this.conference.getActiveMediaSession();
87 87
         const remoteRecvMaxFrameHeight = activeMediaSession
88 88
             ? activeMediaSession.isP2P
89 89
                 ? activeMediaSession.getRemoteRecvMaxFrameHeight()

+ 2
- 2
modules/qualitycontrol/SendVideoController.spec.js Vedi File

@@ -74,11 +74,11 @@ class MockConference extends Listenable {
74 74
         this.eventEmitter.emit(JitsiConferenceEvents._MEDIA_SESSION_ACTIVE_CHANGED, this.activeMediaSession);
75 75
     }
76 76
 
77
-    _getActiveMediaSession() {
77
+    getActiveMediaSession() {
78 78
         return this.activeMediaSession;
79 79
     }
80 80
 
81
-    _getMediaSessions() {
81
+    getMediaSessions() {
82 82
         return this.mediaSessions;
83 83
     }
84 84
 }

+ 12
- 2
types/auto/JitsiConference.d.ts Vedi File

@@ -255,8 +255,18 @@ declare class JitsiConference {
255 255
      * @returns {Promise}
256 256
      */
257 257
     leave(): Promise<any>;
258
-    private _getActiveMediaSession;
259
-    private _getMediaSessions;
258
+    /**
259
+     * Returns the currently active media session if any.
260
+     *
261
+     * @returns {JingleSessionPC|undefined}
262
+     */
263
+    getActiveMediaSession(): any | undefined;
264
+    /**
265
+     * Returns an array containing all media sessions existing in this conference.
266
+     *
267
+     * @returns {Array<JingleSessionPC>}
268
+     */
269
+    getMediaSessions(): Array<any>;
260 270
     private _registerRtcListeners;
261 271
     private _sendBridgeVideoTypeMessage;
262 272
     /**

Loading…
Annulla
Salva