Bläddra i källkod

ref(JitsiConference) Make methods getMediaSessions and getActiveMediaSession public.

dev1
Jaya Allamsetty 3 år sedan
förälder
incheckning
5ae19379aa

+ 5
- 9
JitsiConference.js Visa fil

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

+ 2
- 2
modules/e2ee/KeyHandler.js Visa fil

101
      * @private
101
      * @private
102
      */
102
      */
103
     _onLocalTrackAdded(track) {
103
     _onLocalTrackAdded(track) {
104
-        for (const session of this.conference._getMediaSessions()) {
104
+        for (const session of this.conference.getMediaSessions()) {
105
             this._setupSenderE2EEForTrack(session, track);
105
             this._setupSenderE2EEForTrack(session, track);
106
         }
106
         }
107
     }
107
     }
167
      */
167
      */
168
     _trackMuteChanged(track) {
168
     _trackMuteChanged(track) {
169
         if (browser.doesVideoMuteByStreamRemove() && track.isLocal() && track.isVideoTrack() && !track.isMuted()) {
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
                 this._setupSenderE2EEForTrack(session, track);
171
                 this._setupSenderE2EEForTrack(session, track);
172
             }
172
             }
173
         }
173
         }

+ 2
- 2
modules/qualitycontrol/ReceiveVideoController.js Visa fil

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

+ 1
- 1
modules/qualitycontrol/ReceiveVideoController.spec.js Visa fil

22
         this.mediaSessions = [];
22
         this.mediaSessions = [];
23
     }
23
     }
24
 
24
 
25
-    _getMediaSessions() {
25
+    getMediaSessions() {
26
         return this.mediaSessions;
26
         return this.mediaSessions;
27
     }
27
     }
28
 }
28
 }

+ 3
- 3
modules/qualitycontrol/SendVideoController.js Visa fil

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

+ 2
- 2
modules/qualitycontrol/SendVideoController.spec.js Visa fil

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

+ 12
- 2
types/auto/JitsiConference.d.ts Visa fil

255
      * @returns {Promise}
255
      * @returns {Promise}
256
      */
256
      */
257
     leave(): Promise<any>;
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
     private _registerRtcListeners;
270
     private _registerRtcListeners;
261
     private _sendBridgeVideoTypeMessage;
271
     private _sendBridgeVideoTypeMessage;
262
     /**
272
     /**

Laddar…
Avbryt
Spara