fix(Thumbnail): volume & audioLevel default values
This commit is contained in:
parent
9bae7099dd
commit
db48dc3ed3
|
@ -39,8 +39,11 @@ class AudioLevelIndicator extends Component<Props> {
|
|||
* @returns {ReactElement}
|
||||
*/
|
||||
render() {
|
||||
const { audioLevel: passedAudioLevel } = this.props;
|
||||
|
||||
// First make sure we are sensitive enough.
|
||||
const audioLevel = Math.min(this.props.audioLevel * 1.2, 1);
|
||||
const audioLevel = typeof passedAudioLevel === 'number' && !isNaN(passedAudioLevel)
|
||||
? Math.min(passedAudioLevel * 1.2, 1) : 0;
|
||||
|
||||
// Let's now stretch the audio level over the number of dots we have.
|
||||
const stretchedAudioLevel = AUDIO_LEVEL_DOTS * audioLevel;
|
||||
|
|
|
@ -401,7 +401,7 @@ class Thumbnail extends Component<Props, State> {
|
|||
_videoTrack
|
||||
} = this.props;
|
||||
const { id } = _participant || {};
|
||||
const { audioLevel = 0 } = this.state;
|
||||
const { audioLevel } = this.state;
|
||||
|
||||
|
||||
return (
|
||||
|
@ -447,7 +447,7 @@ class Thumbnail extends Component<Props, State> {
|
|||
_startSilent
|
||||
} = this.props;
|
||||
const { id } = _participant;
|
||||
const { audioLevel = 0, volume = 1 } = this.state;
|
||||
const { audioLevel, volume } = this.state;
|
||||
|
||||
// hide volume when in silent mode
|
||||
const onVolumeChange = _startSilent ? undefined : this._onVolumeChange;
|
||||
|
|
|
@ -75,7 +75,7 @@ type Props = {
|
|||
* A value between 0 and 1 indicating the volume of the participant's
|
||||
* audio element.
|
||||
*/
|
||||
initialVolumeValue: number,
|
||||
initialVolumeValue: ?number,
|
||||
|
||||
/**
|
||||
* Callback to invoke when changing the level of the participant's
|
||||
|
@ -210,7 +210,7 @@ class RemoteVideoMenuTriggerButton extends Component<Props> {
|
|||
participantID = { participantID } />
|
||||
);
|
||||
|
||||
if (onVolumeChange) {
|
||||
if (onVolumeChange && initialVolumeValue && !isNaN(initialVolumeValue)) {
|
||||
buttons.push(
|
||||
<VolumeSlider
|
||||
initialValue = { initialVolumeValue }
|
||||
|
|
Loading…
Reference in New Issue