Просмотр исходного кода

fix(conference): start camera later on

Instead of disabling the video button in the toolbar, mark it as muted,
so that the user can click it to try enable video later on, even if
joined without video (either declined permission or was starting with
screen streaming and dismissed the dialog).
j8
paweldomas 8 лет назад
Родитель
Сommit
d84ab20a47
1 измененных файлов: 21 добавлений и 5 удалений
  1. 21
    5
      conference.js

+ 21
- 5
conference.js Просмотреть файл

@@ -613,7 +613,11 @@ export default {
613 613
                 }
614 614
 
615 615
                 if (!tracks.find((t) => t.isVideoTrack())) {
616
-                    APP.UI.setCameraButtonEnabled(false);
616
+                    // Instead of disabling the button we want to show button
617
+                    // muted, so that the user can have the opportunity to add
618
+                    // the video later on, even if joined without it.
619
+                    this.videoMuted = true;
620
+                    APP.UI.setVideoMuted(this.getMyUserId(), this.videoMuted);
617 621
                 }
618 622
 
619 623
                 this._initDeviceList();
@@ -1036,7 +1040,8 @@ export default {
1036 1040
                     newStream.videoType === 'camera'
1037 1041
                         && APP.UI.setCameraButtonEnabled(true);
1038 1042
                 } else {
1039
-                    this.videoMuted = false;
1043
+                    // No video is treated the same way as being video muted
1044
+                    this.videoMuted = true;
1040 1045
                     this.isSharingScreen = false;
1041 1046
                 }
1042 1047
                 APP.UI.setVideoMuted(this.getMyUserId(), this.videoMuted);
@@ -1543,10 +1548,21 @@ export default {
1543 1548
         APP.UI.addListener(UIEvents.VIDEO_MUTED, muted => {
1544 1549
             if (this.isAudioOnly() && !muted) {
1545 1550
                 this._displayAudioOnlyTooltip('videoMute');
1546
-                return;
1551
+            } else if (!localVideo && this.videoMuted && !muted) {
1552
+                // Maybe try to create local video if there wasn't any ?
1553
+                // This handles the case when user joined with no video
1554
+                // (dismissed screen sharing screen), but decided to add it
1555
+                // later on by clicking on muted video icon.
1556
+                createLocalTracks({ devices: ['video'] }, false)
1557
+                    .then(([videoTrack]) => {
1558
+                        APP.conference.useVideoStream(videoTrack);
1559
+                    })
1560
+                    .catch(error => {
1561
+                        APP.UI.showDeviceErrorDialog(null, error);
1562
+                    });
1563
+            } else {
1564
+                muteLocalVideo(muted);
1547 1565
             }
1548
-
1549
-            muteLocalVideo(muted);
1550 1566
         });
1551 1567
 
1552 1568
         room.on(ConnectionQualityEvents.LOCAL_STATS_UPDATED,

Загрузка…
Отмена
Сохранить