Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

ref(speaker-stats): begin polling for stats after mount

Leonard Kim1e3e71c2ffcc
diff --git a/react/features/speaker-stats/components/SpeakerStats.js b/react/features/speaker-stats/components/SpeakerStats.js
index c191f56cef..56f565929a 100644
--- a/react/features/speaker-stats/components/SpeakerStats.js
+++ b/react/features/speaker-stats/components/SpeakerStats.js
@@ -12,7 +12,7 @@ import SpeakerStatsLabels from './SpeakerStatsLabels';
declare var interfaceConfig: Object;
/**
- * The type of the React {@code Component} props of {@link SpeakerStats}
+ * The type of the React {@code Component} props of {@link SpeakerStats}.
*/
type Props = {
@@ -33,7 +33,7 @@ type Props = {
};
/**
- * The type of the React {@code Component} state of {@link SpeakerStats}
+ * The type of the React {@code Component} state of {@link SpeakerStats}.
*/
type State = {
@@ -49,10 +49,6 @@ type State = {
* @extends Component
*/
class SpeakerStats extends Component<Props, State> {
- state = {
- stats: {}
- };
-
_updateInterval: IntervalID;
/**
@@ -64,19 +60,20 @@ class SpeakerStats extends Component<Props, State> {
constructor(props) {
super(props);
+ this.state = {
+ stats: this.props.conference.getSpeakerStats()
+ };
+
// Bind event handlers so they are only bound once per instance.
this._updateStats = this._updateStats.bind(this);
}
/**
- * Immediately request for updated speaker stats and begin
- * polling for speaker stats updates.
+ * Begin polling for speaker stats updates.
*
* @inheritdoc
- * @returns {void}
*/
- componentWillMount() {
- this._updateStats();
+ componentDidMount() {
this._updateInterval = setInterval(this._updateStats, 1000);
}