瀏覽代碼

ref(peer conn status): moves hasRtcMutedVideoTrack

dev1
paweldomas 8 年之前
父節點
當前提交
51922b2623
共有 3 個文件被更改,包括 26 次插入18 次删除
  1. 15
    0
      JitsiParticipant.js
  2. 10
    0
      modules/RTC/JitsiTrack.js
  3. 1
    18
      modules/connectivity/ParticipantConnectionStatus.js

+ 15
- 0
JitsiParticipant.js 查看文件

49
         return this._properties[name];
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
      * Updates participant's connection status.
68
      * Updates participant's connection status.
54
      * @param {boolean} isActive true if the user's connection is fine or false
69
      * @param {boolean} isActive true if the user's connection is fine or false

+ 10
- 0
modules/RTC/JitsiTrack.js 查看文件

141
     return this.getType() === MediaType.AUDIO;
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
  * Check if this is videotrack.
155
  * Check if this is videotrack.
146
  */
156
  */

+ 1
- 18
modules/connectivity/ParticipantConnectionStatus.js 查看文件

117
     }.bind(this));
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
  * Handles RTCEvents.ENDPOINT_CONN_STATUS_CHANGED triggered when we receive
121
  * Handles RTCEvents.ENDPOINT_CONN_STATUS_CHANGED triggered when we receive
139
  * notification over the data channel from the bridge about endpoint's
122
  * notification over the data channel from the bridge about endpoint's
155
         if (isActive
138
         if (isActive
156
                 && RTCBrowserType.isVideoMuteOnConnInterruptedSupported()
139
                 && RTCBrowserType.isVideoMuteOnConnInterruptedSupported()
157
                 && participant
140
                 && participant
158
-                && hasRtcMutedVideoTrack(participant)
141
+                && participant.hasAnyVideoTrackWebRTCMuted()
159
                 && !participant.isVideoMuted()) {
142
                 && !participant.isVideoMuted()) {
160
             logger.debug(
143
             logger.debug(
161
                 'Ignoring RTCEvents.ENDPOINT_CONN_STATUS_CHANGED -'
144
                 'Ignoring RTCEvents.ENDPOINT_CONN_STATUS_CHANGED -'

Loading…
取消
儲存