|
|
@@ -14,17 +14,17 @@ import {
|
|
14
|
14
|
* Component that renders the list of speaker stats.
|
|
15
|
15
|
*
|
|
16
|
16
|
* @param {Function} speakerStatsItem - React element tu use when rendering.
|
|
17
|
|
- * @param {boolean} [isWeb=false] - Is for web in browser.
|
|
18
|
17
|
* @returns {Function}
|
|
19
|
18
|
*/
|
|
20
|
|
-const abstractSpeakerStatsList = (speakerStatsItem: Function, isWeb: boolean = true): Function[] => {
|
|
|
19
|
+const abstractSpeakerStatsList = (speakerStatsItem: Function): Function[] => {
|
|
21
|
20
|
const dispatch = useDispatch();
|
|
22
|
21
|
const { t } = useTranslation();
|
|
23
|
22
|
const conference = useSelector(state => state['features/base/conference'].conference);
|
|
|
23
|
+ const speakerStats = useSelector(state => state['features/speaker-stats'].stats);
|
|
24
|
24
|
const localParticipant = useSelector(getLocalParticipant);
|
|
25
|
|
- const { enableFacialRecognition } = isWeb ? useSelector(state => state['features/base/config']) : {};
|
|
26
|
|
- const { facialExpressions: localFacialExpressions } = isWeb
|
|
27
|
|
- ? useSelector(state => state['features/facial-recognition']) : {};
|
|
|
25
|
+ const { enableFacialRecognition } = useSelector(state => state['features/base/config']) || {};
|
|
|
26
|
+ const { facialExpressions: localFacialExpressions } = useSelector(
|
|
|
27
|
+ state => state['features/facial-recognition']) || {};
|
|
28
|
28
|
|
|
29
|
29
|
/**
|
|
30
|
30
|
* Update the internal state with the latest speaker stats.
|
|
|
@@ -62,21 +62,22 @@ const abstractSpeakerStatsList = (speakerStatsItem: Function, isWeb: boolean = t
|
|
62
|
62
|
});
|
|
63
|
63
|
|
|
64
|
64
|
const updateStats = useCallback(
|
|
65
|
|
- () => dispatch(initUpdateStats(
|
|
66
|
|
- () => getLocalSpeakerStats())), [ dispatch, initUpdateStats() ]);
|
|
|
65
|
+ () => dispatch(initUpdateStats(getLocalSpeakerStats)),
|
|
|
66
|
+ [ dispatch, initUpdateStats ]);
|
|
67
|
67
|
|
|
68
|
68
|
useEffect(() => {
|
|
69
|
|
- const updateInterval = setInterval(() => updateStats(), SPEAKER_STATS_RELOAD_INTERVAL);
|
|
|
69
|
+ const intervalId = setInterval(() => {
|
|
|
70
|
+ updateStats();
|
|
|
71
|
+ }, SPEAKER_STATS_RELOAD_INTERVAL);
|
|
70
|
72
|
|
|
71
|
|
- return () => {
|
|
72
|
|
- clearInterval(updateInterval);
|
|
73
|
|
- };
|
|
74
|
|
- }, [ dispatch, conference ]);
|
|
|
73
|
+ return () => clearInterval(intervalId);
|
|
|
74
|
+ }, []);
|
|
75
|
75
|
|
|
76
|
|
- const userIds = Object.keys(getLocalSpeakerStats());
|
|
|
76
|
+ const localSpeakerStats = Object.keys(speakerStats).length === 0 ? getLocalSpeakerStats() : speakerStats;
|
|
|
77
|
+ const userIds = Object.keys(localSpeakerStats);
|
|
77
|
78
|
|
|
78
|
79
|
return userIds.map(userId => {
|
|
79
|
|
- const statsModel = getLocalSpeakerStats()[userId];
|
|
|
80
|
+ const statsModel = localSpeakerStats[userId];
|
|
80
|
81
|
|
|
81
|
82
|
if (!statsModel || statsModel.hidden) {
|
|
82
|
83
|
return null;
|
|
|
@@ -85,6 +86,7 @@ const abstractSpeakerStatsList = (speakerStatsItem: Function, isWeb: boolean = t
|
|
85
|
86
|
|
|
86
|
87
|
props.isDominantSpeaker = statsModel.isDominantSpeaker();
|
|
87
|
88
|
props.dominantSpeakerTime = statsModel.getTotalDominantSpeakerTime();
|
|
|
89
|
+ props.participantId = userId;
|
|
88
|
90
|
props.hasLeft = statsModel.hasLeft();
|
|
89
|
91
|
if (enableFacialRecognition) {
|
|
90
|
92
|
props.facialExpressions = statsModel.getFacialExpressions();
|