소스 검색

ref(large-video): combine selectParticipant logic from web (#3266)

* ref(large-video): combine selectParticipant logic from web

Currently native/middleware/redux has its own logic for selecting a participant
on the bridge. To have the logic web respect that logic, a few changes are
needed.
- Web no longer has its own call to selectParticipant.
- To keep in line with web logic selectParticipant action should act even when
  there is no track. This makes it so that when a participant does get a track
  that the bridge will send high quality. The bridge can already handle when the
  selected participant does not have a video track.
- The timing of web is such that on joining an existing conference, a
  participant joins and the participant's tracks get updated and then the
  conference is joined. The result is selectParticipant does not get fired
  because it no-ops when there is no conference. To avoid having to make
  uncertain changes (to be lazy), update the selected participant on conference
  join as well.

* squash: update comment, pass message to error handler
master
virtuacoplenny 6 년 전
부모
커밋
afd2aea79c
5개의 변경된 파일28개의 추가작업 그리고 36개의 파일을 삭제
  1. 0
    21
      conference.js
  2. 1
    1
      modules/UI/videolayout/VideoLayout.js
  3. 19
    13
      react/features/large-video/actions.js
  4. 8
    0
      react/features/large-video/middleware.js
  5. 0
    1
      service/UI/UIEvents.js

+ 0
- 21
conference.js 파일 보기

@@ -7,8 +7,6 @@ import Recorder from './modules/recorder/Recorder';
7 7
 
8 8
 import mediaDeviceHelper from './modules/devices/mediaDeviceHelper';
9 9
 
10
-import { reportError } from './modules/util/helpers';
11
-
12 10
 import * as RemoteControlEvents
13 11
     from './service/remotecontrol/RemoteControlEvents';
14 12
 import UIEvents from './service/UI/UIEvents';
@@ -18,7 +16,6 @@ import * as JitsiMeetConferenceEvents from './ConferenceEvents';
18 16
 import {
19 17
     createDeviceChangedEvent,
20 18
     createScreenSharingEvent,
21
-    createSelectParticipantFailedEvent,
22 19
     createStreamSwitchDelayEvent,
23 20
     createTrackMutedEvent,
24 21
     sendAnalytics
@@ -1813,24 +1810,6 @@ export default {
1813 1810
                     room.sendTextMessage(message);
1814 1811
                 });
1815 1812
             }
1816
-
1817
-            APP.UI.addListener(UIEvents.SELECTED_ENDPOINT, id => {
1818
-                APP.API.notifyOnStageParticipantChanged(id);
1819
-                try {
1820
-                    // do not try to select participant if there is none (we
1821
-                    // are alone in the room), otherwise an error will be
1822
-                    // thrown cause reporting mechanism is not available
1823
-                    // (datachannels currently)
1824
-                    if (room.getParticipants().length === 0) {
1825
-                        return;
1826
-                    }
1827
-
1828
-                    room.selectParticipant(id);
1829
-                } catch (e) {
1830
-                    sendAnalytics(createSelectParticipantFailedEvent(e));
1831
-                    reportError(e);
1832
-                }
1833
-            });
1834 1813
         }
1835 1814
 
1836 1815
         room.on(JitsiConferenceEvents.CONNECTION_INTERRUPTED, () => {

+ 1
- 1
modules/UI/videolayout/VideoLayout.js 파일 보기

@@ -960,7 +960,7 @@ const VideoLayout = {
960 960
             // FIXME video type is not the same thing as container type
961 961
 
962 962
             if (id !== currentId && videoType === VIDEO_CONTAINER_TYPE) {
963
-                eventEmitter.emit(UIEvents.SELECTED_ENDPOINT, id);
963
+                APP.API.notifyOnStageParticipantChanged(id);
964 964
             }
965 965
 
966 966
             let oldSmallVideo;

+ 19
- 13
react/features/large-video/actions.js 파일 보기

@@ -1,14 +1,19 @@
1 1
 // @flow
2 2
 
3
+import {
4
+    createSelectParticipantFailedEvent,
5
+    sendAnalytics
6
+} from '../analytics';
3 7
 import { _handleParticipantError } from '../base/conference';
4
-import { MEDIA_TYPE, VIDEO_TYPE } from '../base/media';
5
-import { getTrackByMediaTypeAndParticipant } from '../base/tracks';
8
+import { MEDIA_TYPE } from '../base/media';
6 9
 
7 10
 import {
8 11
     SELECT_LARGE_VIDEO_PARTICIPANT,
9 12
     UPDATE_KNOWN_LARGE_VIDEO_RESOLUTION
10 13
 } from './actionTypes';
11 14
 
15
+declare var APP: Object;
16
+
12 17
 /**
13 18
  * Signals conference to select a participant.
14 19
  *
@@ -21,22 +26,23 @@ export function selectParticipant() {
21 26
 
22 27
         if (conference) {
23 28
             const largeVideo = state['features/large-video'];
24
-            const tracks = state['features/base/tracks'];
25
-
26 29
             const id = largeVideo.participantId;
27
-            const videoTrack
28
-                = getTrackByMediaTypeAndParticipant(
29
-                    tracks,
30
-                    MEDIA_TYPE.VIDEO,
31
-                    id);
32 30
 
33 31
             try {
34
-                conference.selectParticipant(
35
-                    videoTrack && videoTrack.videoType === VIDEO_TYPE.CAMERA
36
-                        ? id
37
-                        : null);
32
+                conference.selectParticipant(id);
38 33
             } catch (err) {
39 34
                 _handleParticipantError(err);
35
+
36
+                sendAnalytics(createSelectParticipantFailedEvent(err));
37
+
38
+                if (typeof APP === 'object' && window.onerror) {
39
+                    window.onerror(
40
+                        `Failed to select participant ${id}`,
41
+                        null, // source
42
+                        null, // lineno
43
+                        null, // colno
44
+                        err);
45
+                }
40 46
             }
41 47
         }
42 48
     };

+ 8
- 0
react/features/large-video/middleware.js 파일 보기

@@ -1,5 +1,6 @@
1 1
 // @flow
2 2
 
3
+import { CONFERENCE_JOINED } from '../base/conference';
3 4
 import {
4 5
     DOMINANT_SPEAKER_CHANGED,
5 6
     PARTICIPANT_JOINED,
@@ -46,6 +47,13 @@ MiddlewareRegistry.register(store => next => action => {
46 47
         store.dispatch(selectParticipantInLargeVideo());
47 48
         break;
48 49
 
50
+    case CONFERENCE_JOINED:
51
+        // Ensure a participant is selected on conference join. This addresses
52
+        // the case where video tracks were received before CONFERENCE_JOINED
53
+        // fired; without the conference selection may not happen.
54
+        store.dispatch(selectParticipant());
55
+        break;
56
+
49 57
     case TRACK_UPDATED:
50 58
         // In order to minimize re-calculations, we need to select participant
51 59
         // only if the videoType of the current participant rendered in

+ 0
- 1
service/UI/UIEvents.js 파일 보기

@@ -1,6 +1,5 @@
1 1
 export default {
2 2
     NICKNAME_CHANGED: 'UI.nickname_changed',
3
-    SELECTED_ENDPOINT: 'UI.selected_endpoint',
4 3
     PINNED_ENDPOINT: 'UI.pinned_endpoint',
5 4
 
6 5
     /**

Loading…
취소
저장