|
@@ -296,57 +296,55 @@ JitsiLocalTrack.prototype._setMute = function(mute) {
|
296
|
296
|
if(this.track) {
|
297
|
297
|
this.track.enabled = !mute;
|
298
|
298
|
}
|
299
|
|
- } else {
|
300
|
|
- if(mute) {
|
301
|
|
- this.dontFireRemoveEvent = true;
|
302
|
|
- promise = new Promise((resolve, reject) => {
|
303
|
|
- this._removeStreamFromConferenceAsMute(() => {
|
304
|
|
- // FIXME: Maybe here we should set the SRC for the containers
|
305
|
|
- // to something
|
306
|
|
- this._stopMediaStream();
|
307
|
|
- this._setStream(null);
|
308
|
|
- resolve();
|
309
|
|
- }, err => {
|
310
|
|
- reject(err);
|
311
|
|
- });
|
|
299
|
+ } else if (mute) {
|
|
300
|
+ this.dontFireRemoveEvent = true;
|
|
301
|
+ promise = new Promise((resolve, reject) => {
|
|
302
|
+ this._removeStreamFromConferenceAsMute(() => {
|
|
303
|
+ // FIXME: Maybe here we should set the SRC for the containers
|
|
304
|
+ // to something
|
|
305
|
+ this._stopMediaStream();
|
|
306
|
+ this._setStream(null);
|
|
307
|
+ resolve();
|
|
308
|
+ }, err => {
|
|
309
|
+ reject(err);
|
312
|
310
|
});
|
313
|
|
- } else {
|
314
|
|
- // This path is only for camera.
|
315
|
|
- const streamOptions = {
|
316
|
|
- cameraDeviceId: this.getDeviceId(),
|
317
|
|
- devices: [ MediaType.VIDEO ],
|
318
|
|
- facingMode: this.getCameraFacingMode()
|
319
|
|
- };
|
320
|
|
- if (this.resolution) {
|
321
|
|
- streamOptions.resolution = this.resolution;
|
322
|
|
- }
|
|
311
|
+ });
|
|
312
|
+ } else {
|
|
313
|
+ // This path is only for camera.
|
|
314
|
+ const streamOptions = {
|
|
315
|
+ cameraDeviceId: this.getDeviceId(),
|
|
316
|
+ devices: [ MediaType.VIDEO ],
|
|
317
|
+ facingMode: this.getCameraFacingMode()
|
|
318
|
+ };
|
|
319
|
+ if (this.resolution) {
|
|
320
|
+ streamOptions.resolution = this.resolution;
|
|
321
|
+ }
|
323
|
322
|
|
324
|
|
- promise = RTCUtils.obtainAudioAndVideoPermissions(streamOptions)
|
325
|
|
- .then(streamsInfo => {
|
326
|
|
- const mediaType = self.getType();
|
327
|
|
- const streamInfo = streamsInfo.find(info => info.mediaType === mediaType);
|
328
|
|
-
|
329
|
|
- if (streamInfo) {
|
330
|
|
- self._setStream(streamInfo.stream);
|
331
|
|
- self.track = streamInfo.track;
|
332
|
|
- // This is not good when video type changes after
|
333
|
|
- // unmute, but let's not crash here
|
334
|
|
- if (self.videoType !== streamInfo.videoType) {
|
335
|
|
- logger.warn(
|
336
|
|
- 'Video type has changed after unmute!',
|
337
|
|
- self.videoType, streamInfo.videoType);
|
338
|
|
- self.videoType = streamInfo.videoType;
|
339
|
|
- }
|
340
|
|
- }else {
|
341
|
|
- throw new JitsiTrackError(
|
342
|
|
- JitsiTrackErrors.TRACK_NO_STREAM_FOUND);
|
|
323
|
+ promise = RTCUtils.obtainAudioAndVideoPermissions(streamOptions)
|
|
324
|
+ .then(streamsInfo => {
|
|
325
|
+ const mediaType = self.getType();
|
|
326
|
+ const streamInfo = streamsInfo.find(info => info.mediaType === mediaType);
|
|
327
|
+
|
|
328
|
+ if (streamInfo) {
|
|
329
|
+ self._setStream(streamInfo.stream);
|
|
330
|
+ self.track = streamInfo.track;
|
|
331
|
+ // This is not good when video type changes after
|
|
332
|
+ // unmute, but let's not crash here
|
|
333
|
+ if (self.videoType !== streamInfo.videoType) {
|
|
334
|
+ logger.warn(
|
|
335
|
+ 'Video type has changed after unmute!',
|
|
336
|
+ self.videoType, streamInfo.videoType);
|
|
337
|
+ self.videoType = streamInfo.videoType;
|
343
|
338
|
}
|
|
339
|
+ }else {
|
|
340
|
+ throw new JitsiTrackError(
|
|
341
|
+ JitsiTrackErrors.TRACK_NO_STREAM_FOUND);
|
|
342
|
+ }
|
344
|
343
|
|
345
|
|
- self.containers = self.containers.map(cont => RTCUtils.attachMediaStream(cont, self.stream));
|
|
344
|
+ self.containers = self.containers.map(cont => RTCUtils.attachMediaStream(cont, self.stream));
|
346
|
345
|
|
347
|
|
- return self._addStreamToConferenceAsUnmute();
|
348
|
|
- });
|
349
|
|
- }
|
|
346
|
+ return self._addStreamToConferenceAsUnmute();
|
|
347
|
+ });
|
350
|
348
|
}
|
351
|
349
|
|
352
|
350
|
return promise
|