From 37e67550085f86e3041d90ed3474990a2b4dca8f Mon Sep 17 00:00:00 2001 From: Mario Jr <mariogasparoni@gmail.com> Date: Wed, 31 Mar 2021 16:09:08 -0300 Subject: [PATCH] Fix muted banner being created for listen-only fallback stream When listen only fallbacks from Kurento to FreeSWITCH, we must guarantee the muted alert won't be created, speciallly because listen-only's fallback uses a flow similar to microphone's. Client currently crashes when this happens: this commit fixes this peoblem. --- .../audio/audio-controls/component.jsx | 3 ++- .../ui/components/muted-alert/component.jsx | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/bigbluebutton-html5/imports/ui/components/audio/audio-controls/component.jsx b/bigbluebutton-html5/imports/ui/components/audio/audio-controls/component.jsx index 2324616780..31504bffaf 100755 --- a/bigbluebutton-html5/imports/ui/components/audio/audio-controls/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/audio/audio-controls/component.jsx @@ -168,6 +168,7 @@ class AudioControls extends PureComponent { intl, shortcuts, isVoiceUser, + listenOnly, inputStream, isViewer, isPresenter, @@ -198,7 +199,7 @@ class AudioControls extends PureComponent { return ( <span className={styles.container}> - {isVoiceUser && inputStream && muteAlertEnabled ? ( + {isVoiceUser && inputStream && muteAlertEnabled && !listenOnly ? ( <MutedAlert {...{ muted, inputStream, isViewer, isPresenter, }} diff --git a/bigbluebutton-html5/imports/ui/components/muted-alert/component.jsx b/bigbluebutton-html5/imports/ui/components/muted-alert/component.jsx index 8c67ce721f..d86f24d0ad 100644 --- a/bigbluebutton-html5/imports/ui/components/muted-alert/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/muted-alert/component.jsx @@ -9,7 +9,7 @@ import { styles } from './styles'; const MUTE_ALERT_CONFIG = Meteor.settings.public.app.mutedAlert; const propTypes = { - inputStream: PropTypes.objectOf(PropTypes.object).isRequired, + inputStream: PropTypes.objectOf(PropTypes.any).isRequired, isPresenter: PropTypes.bool.isRequired, isViewer: PropTypes.bool.isRequired, muted: PropTypes.bool.isRequired, @@ -33,6 +33,9 @@ class MutedAlert extends Component { componentDidMount() { this._isMounted = true; + + if (!this.hasValidInputStream()) return; + this.cloneMediaStream(); if (this.inputStream) { const { interval, threshold, duration } = MUTE_ALERT_CONFIG; @@ -75,6 +78,17 @@ class MutedAlert extends Component { this.timer = null; } + hasValidInputStream() { + const { inputStream } = this.props; + + if (inputStream + && (typeof inputStream.getAudioTracks === 'function') + && (inputStream.getAudioTracks().length > 0) + ) return true; + + return false; + } + render() { const { isViewer, isPresenter, muted } = this.props; const { visible } = this.state; -- GitLab