Clean up lifecycle methods
parent
87b114fccc
commit
36b7e45f05
|
|
@ -172,27 +172,21 @@ class Filmstrip extends React.PureComponent
|
||||||
window.removeEventListener('resize', this.updateDimensions);
|
window.removeEventListener('resize', this.updateDimensions);
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUpdate(nextProps)
|
|
||||||
{
|
|
||||||
if (nextProps !== this.props)
|
|
||||||
{
|
|
||||||
if (
|
|
||||||
nextProps.activeSpeakerId != null &&
|
|
||||||
nextProps.activeSpeakerId !== this.props.myId
|
|
||||||
)
|
|
||||||
{
|
|
||||||
// eslint-disable-next-line react/no-did-update-set-state
|
|
||||||
this.setState({
|
|
||||||
lastSpeaker : nextProps.activeSpeakerId
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidUpdate(prevProps)
|
componentDidUpdate(prevProps)
|
||||||
{
|
{
|
||||||
if (prevProps !== this.props)
|
if (prevProps !== this.props)
|
||||||
{
|
{
|
||||||
|
if (
|
||||||
|
this.props.activeSpeakerId != null &&
|
||||||
|
this.props.activeSpeakerId !== this.props.myId
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// eslint-disable-next-line react/no-did-update-set-state
|
||||||
|
this.setState({
|
||||||
|
lastSpeaker : this.props.activeSpeakerId
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
this.updateDimensions();
|
this.updateDimensions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,14 +31,16 @@ export default class PeerAudio extends React.PureComponent
|
||||||
this._setOutputDevice(audioOutputDevice);
|
this._setOutputDevice(audioOutputDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line camelcase
|
componentDidUpdate(prevProps)
|
||||||
UNSAFE_componentWillReceiveProps(nextProps)
|
|
||||||
{
|
{
|
||||||
const { audioTrack, audioOutputDevice } = nextProps;
|
if (prevProps !== this.props)
|
||||||
|
{
|
||||||
|
const { audioTrack, audioOutputDevice } = this.props;
|
||||||
|
|
||||||
this._setTrack(audioTrack);
|
this._setTrack(audioTrack);
|
||||||
this._setOutputDevice(audioOutputDevice);
|
this._setOutputDevice(audioOutputDevice);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_setTrack(audioTrack)
|
_setTrack(audioTrack)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -345,12 +345,15 @@ class VideoView extends React.PureComponent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUpdate()
|
componentDidUpdate(prevProps)
|
||||||
|
{
|
||||||
|
if (prevProps !== this.props)
|
||||||
{
|
{
|
||||||
const { videoTrack, audioTrack } = this.props;
|
const { videoTrack, audioTrack } = this.props;
|
||||||
|
|
||||||
this._setTracks(videoTrack, audioTrack);
|
this._setTracks(videoTrack, audioTrack);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_setTracks(videoTrack, audioTrack)
|
_setTracks(videoTrack, audioTrack)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue