Kaynağa Gözat

ref(peer conn status): moves hasRtcMutedVideoTrack

dev1
paweldomas 8 yıl önce
ebeveyn
işleme
51922b2623

+ 15
- 0
JitsiParticipant.js Dosyayı Görüntüle

@@ -49,6 +49,21 @@ export default class JitsiParticipant {
49 49
         return this._properties[name];
50 50
     }
51 51
 
52
+    /**
53
+     * Checks whether this <tt>JitsiParticipant</tt> has any video tracks which
54
+     * are muted according to their underlying WebRTC <tt>MediaStreamTrack</tt>
55
+     * muted status.
56
+     * @return {boolean} <tt>true</tt> if this <tt>participant</tt> contains any
57
+     * video <tt>JitsiTrack</tt>s which are muted as defined in
58
+     * {@link JitsiTrack.isWebRTCTrackMuted}.
59
+     */
60
+    hasAnyVideoTrackWebRTCMuted() {
61
+        return this.getTracks().some(function(jitsiTrack) {
62
+            return jitsiTrack.getType() === MediaType.VIDEO
63
+                && jitsiTrack.isWebRTCTrackMuted();
64
+        });
65
+    }
66
+
52 67
     /**
53 68
      * Updates participant's connection status.
54 69
      * @param {boolean} isActive true if the user's connection is fine or false

+ 10
- 0
modules/RTC/JitsiTrack.js Dosyayı Görüntüle

@@ -141,6 +141,16 @@ JitsiTrack.prototype.isAudioTrack = function () {
141 141
     return this.getType() === MediaType.AUDIO;
142 142
 };
143 143
 
144
+/**
145
+ * Checks whether the underlying WebRTC <tt>MediaStreamTrack</tt> is muted
146
+ * according to it's 'muted' field status.
147
+ * @return {boolean} <tt>true</tt> if the underlying <tt>MediaStreamTrack</tt>
148
+ * is muted or <tt>false</tt> otherwise.
149
+ */
150
+JitsiTrack.prototype.isWebRTCTrackMuted = function () {
151
+    return this.track && this.track.muted;
152
+};
153
+
144 154
 /**
145 155
  * Check if this is videotrack.
146 156
  */

+ 1
- 18
modules/connectivity/ParticipantConnectionStatus.js Dosyayı Görüntüle

@@ -117,23 +117,6 @@ ParticipantConnectionStatus.prototype.dispose = function () {
117 117
     }.bind(this));
118 118
 };
119 119
 
120
-/**
121
- * Checks whether given <tt>JitsiParticipant</tt> has any muted video
122
- * <tt>MediaStreamTrack</tt>s.
123
- *
124
- * @param {JitsiParticipant} participant to be checked for muted video tracks
125
- *
126
- * @return {boolean} <tt>true</tt> if given <tt>participant</tt> contains any
127
- * video <tt>MediaStreamTrack</tt>s muted according to their 'muted' field.
128
- */
129
-var hasRtcMutedVideoTrack = function (participant) {
130
-    return participant.getTracks().some(function(jitsiTrack) {
131
-        var rtcTrack = jitsiTrack.getTrack();
132
-        return jitsiTrack.getType() === MediaType.VIDEO
133
-            && rtcTrack && rtcTrack.muted === true;
134
-    });
135
-};
136
-
137 120
 /**
138 121
  * Handles RTCEvents.ENDPOINT_CONN_STATUS_CHANGED triggered when we receive
139 122
  * notification over the data channel from the bridge about endpoint's
@@ -155,7 +138,7 @@ ParticipantConnectionStatus.prototype.onEndpointConnStatusChanged
155 138
         if (isActive
156 139
                 && RTCBrowserType.isVideoMuteOnConnInterruptedSupported()
157 140
                 && participant
158
-                && hasRtcMutedVideoTrack(participant)
141
+                && participant.hasAnyVideoTrackWebRTCMuted()
159 142
                 && !participant.isVideoMuted()) {
160 143
             logger.debug(
161 144
                 'Ignoring RTCEvents.ENDPOINT_CONN_STATUS_CHANGED -'

Loading…
İptal
Kaydet