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