Procházet zdrojové kódy

fix(VideoLayout): muted for no tracks

Will make the UI display audio/video muted icon for remote participants
with no audio/video track.
j8
paweldomas před 8 roky
rodič
revize
00d3d3c09a
2 změnil soubory, kde provedl 32 přidání a 9 odebrání
  1. 0
    2
      conference.js
  2. 32
    7
      modules/UI/videolayout/VideoLayout.js

+ 0
- 2
conference.js Zobrazit soubor

@@ -486,8 +486,6 @@ export default {
486 486
         // First try to retrieve both audio and video.
487 487
         let tryCreateLocalTracks;
488 488
 
489
-        // FIXME there is no video muted indication visible on the remote side,
490
-        // after starting in audio only (there's no video track)
491 489
         // FIXME the logic about trying to go audio only on error is duplicated
492 490
         if (options.startAudioOnly) {
493 491
             tryCreateLocalTracks

+ 32
- 7
modules/UI/videolayout/VideoLayout.js Zobrazit soubor

@@ -331,13 +331,11 @@ var VideoLayout = {
331 331
 
332 332
         remoteVideo.addRemoteStreamElement(stream);
333 333
 
334
-        // if track is muted make sure we reflect that
335
-        if(stream.isMuted())
336
-        {
337
-            if(stream.getType() === "audio")
338
-                this.onAudioMute(stream.getParticipantId(), true);
339
-            else
340
-                this.onVideoMute(stream.getParticipantId(), true);
334
+        // Make sure track's muted state is reflected
335
+        if (stream.getType() === "audio") {
336
+            this.onAudioMute(stream.getParticipantId(), stream.isMuted());
337
+        } else {
338
+            this.onVideoMute(stream.getParticipantId(), stream.isMuted());
341 339
         }
342 340
     },
343 341
 
@@ -348,6 +346,30 @@ var VideoLayout = {
348 346
         if (remoteVideo) {
349 347
             remoteVideo.removeRemoteStreamElement(stream);
350 348
         }
349
+        this.updateMutedForNoTracks(id, stream.getType());
350
+    },
351
+
352
+    /**
353
+     * FIXME get rid of this method once muted indicator are reactified (by
354
+     * making sure that user with no tracks is displayed as muted )
355
+     *
356
+     * If participant has no tracks will make the UI display muted status.
357
+     * @param {string} participantId
358
+     * @param {string} mediaType 'audio' or 'video'
359
+     */
360
+    updateMutedForNoTracks(participantId, mediaType) {
361
+        const participant = APP.conference.getParticipantById(participantId);
362
+
363
+        if (participant
364
+                && !participant.getTracksByMediaType(mediaType).length) {
365
+            if (mediaType === 'audio') {
366
+                APP.UI.setAudioMuted(participantId, true);
367
+            } else if (mediaType === 'video') {
368
+                APP.UI.setVideoMuted(participantId, true);
369
+            } else {
370
+                logger.error(`Unsupported media type: ${mediaType}`);
371
+            }
372
+        }
351 373
     },
352 374
 
353 375
     /**
@@ -441,6 +463,9 @@ var VideoLayout = {
441 463
         this._setRemoteControlProperties(user, remoteVideo);
442 464
         this.addRemoteVideoContainer(id, remoteVideo);
443 465
 
466
+        this.updateMutedForNoTracks(id, 'audio');
467
+        this.updateMutedForNoTracks(id, 'video');
468
+
444 469
         const remoteVideosCount = Object.keys(remoteVideos).length;
445 470
 
446 471
         if (remoteVideosCount === 1) {

Načítá se…
Zrušit
Uložit