fix(Thumbnail): Improve naming.

This commit is contained in:
Hristo Terezov 2021-01-07 14:34:40 -06:00
parent 9f321c988e
commit e990f6984a
2 changed files with 16 additions and 15 deletions

View File

@ -35,9 +35,10 @@ type Props = {
volume: ?number, volume: ?number,
/** /**
* A function that will be executed when the reference to the underlying audio element changes. * A function that will be executed when the reference to the underlying audio element changes in order to report
* the initial volume value.
*/ */
onAudioElementReferenceChanged: Function onInitialVolumeSet: Function
}; };
/** /**
@ -207,10 +208,10 @@ export default class AudioTrack extends Component<Props> {
*/ */
_setRef(audioElement: ?HTMLAudioElement) { _setRef(audioElement: ?HTMLAudioElement) {
this._ref = audioElement; this._ref = audioElement;
const { onAudioElementReferenceChanged } = this.props; const { onInitialVolumeSet } = this.props;
if (this._ref && onAudioElementReferenceChanged) { if (this._ref && onInitialVolumeSet) {
onAudioElementReferenceChanged({ volume: this._ref.volume }); onInitialVolumeSet(this._ref.volume);
} }
} }
} }

View File

@ -162,7 +162,7 @@ class Thumbnail extends Component<Props, State> {
this._updateAudioLevel = this._updateAudioLevel.bind(this); this._updateAudioLevel = this._updateAudioLevel.bind(this);
this._onVolumeChange = this._onVolumeChange.bind(this); this._onVolumeChange = this._onVolumeChange.bind(this);
this._onAudioElementReferenceChanged = this._onAudioElementReferenceChanged.bind(this); this._onInitialVolumeSet = this._onInitialVolumeSet.bind(this);
} }
/** /**
@ -308,11 +308,11 @@ class Thumbnail extends Component<Props, State> {
} }
/** /**
* Renders the top toolbar of the thumbnail. * Renders the top indicators of the thumbnail.
* *
* @returns {Component} * @returns {Component}
*/ */
_renderTopToolbar() { _renderTopIndicators() {
const { const {
_connectionIndicatorAutoHideEnabled, _connectionIndicatorAutoHideEnabled,
_connectionIndicatorDisabled, _connectionIndicatorDisabled,
@ -416,7 +416,7 @@ class Thumbnail extends Component<Props, State> {
<StatusIndicators participantID = { id } /> <StatusIndicators participantID = { id } />
</div> </div>
<div className = 'videocontainer__toptoolbar'> <div className = 'videocontainer__toptoolbar'>
{ this._renderTopToolbar() } { this._renderTopIndicators() }
</div> </div>
<div className = 'videocontainer__hoverOverlay' /> <div className = 'videocontainer__hoverOverlay' />
<div className = 'displayNameContainer'> <div className = 'displayNameContainer'>
@ -462,14 +462,14 @@ class Thumbnail extends Component<Props, State> {
audioTrack = { _audioTrack } audioTrack = { _audioTrack }
id = { `remoteAudio_${audioTrackId || ''}` } id = { `remoteAudio_${audioTrackId || ''}` }
muted = { _startSilent } muted = { _startSilent }
onAudioElementReferenceChanged = { this._onAudioElementReferenceChanged } onInitialVolumeSet = { this._onInitialVolumeSet }
volume = { this.state.volume } /> volume = { this.state.volume } />
: null : null
} }
<div className = 'videocontainer__background' /> <div className = 'videocontainer__background' />
<div className = 'videocontainer__toptoolbar'> <div className = 'videocontainer__toptoolbar'>
{ this._renderTopToolbar() } { this._renderTopIndicators() }
</div> </div>
<div className = 'videocontainer__toolbar'> <div className = 'videocontainer__toolbar'>
<StatusIndicators participantID = { id } /> <StatusIndicators participantID = { id } />
@ -501,15 +501,15 @@ class Thumbnail extends Component<Props, State> {
); );
} }
_onAudioElementReferenceChanged: Object => void; _onInitialVolumeSet: Object => void;
/** /**
* Handles audio element references changes by receiving some properties from the audio element. * A handler for the initial volume value of the audio element.
* *
* @param {Obejct} audioElementProps - Properties of the audio element. * @param {number} volume - Properties of the audio element.
* @returns {void} * @returns {void}
*/ */
_onAudioElementReferenceChanged({ volume }) { _onInitialVolumeSet(volume) {
if (this.state.volume !== volume) { if (this.state.volume !== volume) {
this.setState({ volume }); this.setState({ volume });
} }