|
|
@@ -147,12 +147,24 @@ MiddlewareRegistry.register(store => next => action => {
|
|
147
|
147
|
* with the specified {@code mediaType} is to be retrieved.
|
|
148
|
148
|
* @param {MEDIA_TYPE} mediaType - The {@code MEDIA_TYPE} of the local track to
|
|
149
|
149
|
* be retrieved from the specified {@code store}.
|
|
|
150
|
+ * @param {boolean} [includePending] - Indicates whether a local track is to be
|
|
|
151
|
+ * returned if it is still pending. A local track is pending if
|
|
|
152
|
+ * {@code getUserMedia} is still executing to create it and, consequently, its
|
|
|
153
|
+ * {@code jitsiTrack} property is {@code undefined}. By default a pending local
|
|
|
154
|
+ * track is not returned.
|
|
150
|
155
|
* @private
|
|
151
|
156
|
* @returns {Track} The local {@code Track} associated with the specified
|
|
152
|
157
|
* {@code mediaType} in the specified {@code store}.
|
|
153
|
158
|
*/
|
|
154
|
|
-function _getLocalTrack({ getState }, mediaType: MEDIA_TYPE) {
|
|
155
|
|
- return getLocalTrack(getState()['features/base/tracks'], mediaType);
|
|
|
159
|
+function _getLocalTrack(
|
|
|
160
|
+ { getState }: { getState: Function },
|
|
|
161
|
+ mediaType: MEDIA_TYPE,
|
|
|
162
|
+ includePending: boolean = false) {
|
|
|
163
|
+ return (
|
|
|
164
|
+ getLocalTrack(
|
|
|
165
|
+ getState()['features/base/tracks'],
|
|
|
166
|
+ mediaType,
|
|
|
167
|
+ includePending));
|
|
156
|
168
|
}
|
|
157
|
169
|
|
|
158
|
170
|
/**
|
|
|
@@ -167,10 +179,17 @@ function _getLocalTrack({ getState }, mediaType: MEDIA_TYPE) {
|
|
167
|
179
|
* @returns {void}
|
|
168
|
180
|
*/
|
|
169
|
181
|
function _setMuted(store, { ensureTrack, muted }, mediaType: MEDIA_TYPE) {
|
|
170
|
|
- const localTrack = _getLocalTrack(store, mediaType);
|
|
|
182
|
+ const localTrack
|
|
|
183
|
+ = _getLocalTrack(store, mediaType, /* includePending */ true);
|
|
171
|
184
|
|
|
172
|
185
|
if (localTrack) {
|
|
173
|
|
- setTrackMuted(localTrack.jitsiTrack, muted);
|
|
|
186
|
+ // The `jitsiTrack` property will have a value only for a localTrack for
|
|
|
187
|
+ // which `getUserMedia` has already completed. If there's no
|
|
|
188
|
+ // `jitsiTrack`, then the `muted` state will be applied once the
|
|
|
189
|
+ // `jitsiTrack` is created.
|
|
|
190
|
+ const { jitsiTrack } = localTrack;
|
|
|
191
|
+
|
|
|
192
|
+ jitsiTrack && setTrackMuted(jitsiTrack, muted);
|
|
174
|
193
|
} else if (!muted && ensureTrack && typeof APP === 'undefined') {
|
|
175
|
194
|
// FIXME: This only runs on mobile now because web has its own way of
|
|
176
|
195
|
// creating local tracks. Adjust the check once they are unified.
|