webRTC video stats: fetch stats on VideoListItem
This commit is contained in:
parent
2eaa457442
commit
6f16948824
@ -38,6 +38,13 @@ class VideoListItem extends Component {
|
||||
}
|
||||
|
||||
toggleStats() {
|
||||
const { getStats, stopGettingStats } = this.props;
|
||||
if (this.state.showStats) {
|
||||
stopGettingStats();
|
||||
} else {
|
||||
getStats(this.videoTag, this.setStats);
|
||||
}
|
||||
|
||||
this.setState({showStats: !this.state.showStats});
|
||||
}
|
||||
|
||||
@ -70,7 +77,7 @@ class VideoListItem extends Component {
|
||||
|
||||
render() {
|
||||
const { showStats, stats } = this.state;
|
||||
const { user, getStats, stopGettingStats } = this.props;
|
||||
const { user } = this.props;
|
||||
|
||||
const availableActions = this.getAvailableActions();
|
||||
|
||||
@ -102,7 +109,7 @@ class VideoListItem extends Component {
|
||||
{ user.isMuted ? <Icon className={styles.muted} iconName="unmute_filled" /> : null }
|
||||
{ user.isListenOnly ? <Icon className={styles.voice} iconName="listen" /> : null }
|
||||
</div>
|
||||
{ showStats ? <VideoListItemStats toggleStats={this.toggleStats} getStats={() => getStats(this.videoTag, this.setStats)} stats={stats} stopGettingStats={stopGettingStats} /> : null }
|
||||
{ showStats ? <VideoListItemStats toggleStats={this.toggleStats} stats={stats} /> : null }
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
@ -8,9 +8,7 @@ import { styles } from '../../styles';
|
||||
|
||||
const propTypes = {
|
||||
toggleStats: PropTypes.func.isRequired,
|
||||
getStats: PropTypes.func.isRequired,
|
||||
stats: PropTypes.object.isRequired,
|
||||
stopGettingStats: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
const intlMessages = defineMessages({
|
||||
@ -61,16 +59,6 @@ class VideoListItemStats extends Component {
|
||||
|
||||
}
|
||||
|
||||
componentDidMount(){
|
||||
const { getStats } = this.props;
|
||||
getStats();
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
const { stopGettingStats } = this.props;
|
||||
stopGettingStats();
|
||||
}
|
||||
|
||||
render() {
|
||||
const { intl, toggleStats, stats } = this.props;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user