Ver código fonte

fix(Thumbnail): volume & audioLevel default values

master
Hristo Terezov 4 anos atrás
pai
commit
db48dc3ed3

+ 4
- 1
react/features/audio-level-indicator/components/AudioLevelIndicator.js Ver arquivo

@@ -39,8 +39,11 @@ class AudioLevelIndicator extends Component<Props> {
39 39
      * @returns {ReactElement}
40 40
      */
41 41
     render() {
42
+        const { audioLevel: passedAudioLevel } = this.props;
43
+
42 44
         // First make sure we are sensitive enough.
43
-        const audioLevel = Math.min(this.props.audioLevel * 1.2, 1);
45
+        const audioLevel = typeof passedAudioLevel === 'number' && !isNaN(passedAudioLevel)
46
+            ? Math.min(passedAudioLevel * 1.2, 1) : 0;
44 47
 
45 48
         // Let's now stretch the audio level over the number of dots we have.
46 49
         const stretchedAudioLevel = AUDIO_LEVEL_DOTS * audioLevel;

+ 2
- 2
react/features/filmstrip/components/web/Thumbnail.js Ver arquivo

@@ -401,7 +401,7 @@ class Thumbnail extends Component<Props, State> {
401 401
             _videoTrack
402 402
         } = this.props;
403 403
         const { id } = _participant || {};
404
-        const { audioLevel = 0 } = this.state;
404
+        const { audioLevel } = this.state;
405 405
 
406 406
 
407 407
         return (
@@ -447,7 +447,7 @@ class Thumbnail extends Component<Props, State> {
447 447
             _startSilent
448 448
         } = this.props;
449 449
         const { id } = _participant;
450
-        const { audioLevel = 0, volume = 1 } = this.state;
450
+        const { audioLevel, volume } = this.state;
451 451
 
452 452
         // hide volume when in silent mode
453 453
         const onVolumeChange = _startSilent ? undefined : this._onVolumeChange;

+ 2
- 2
react/features/remote-video-menu/components/web/RemoteVideoMenuTriggerButton.js Ver arquivo

@@ -75,7 +75,7 @@ type Props = {
75 75
      * A value between 0 and 1 indicating the volume of the participant's
76 76
      * audio element.
77 77
      */
78
-    initialVolumeValue: number,
78
+    initialVolumeValue: ?number,
79 79
 
80 80
     /**
81 81
      * Callback to invoke when changing the level of the participant's
@@ -210,7 +210,7 @@ class RemoteVideoMenuTriggerButton extends Component<Props> {
210 210
                 participantID = { participantID } />
211 211
         );
212 212
 
213
-        if (onVolumeChange) {
213
+        if (onVolumeChange && initialVolumeValue && !isNaN(initialVolumeValue)) {
214 214
             buttons.push(
215 215
                 <VolumeSlider
216 216
                     initialValue = { initialVolumeValue }

Carregando…
Cancelar
Salvar