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 23246167801f9f3297b248a5b1d30fcf854e56e7..31504bffaf3df7ee194838a8fffe0d77547ae4af 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 582aac49fa28c515a45786c73643075580d0e325..d86f24d0ad9e7f48dc515b1b2cdfa955cf6062ad 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.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; @@ -58,10 +61,14 @@ class MutedAlert extends Component { componentWillUnmount() { this._isMounted = false; if (this.speechEvents) this.speechEvents.stop(); + if (this.inputStream) { + this.inputStream.getTracks().forEach(t => t.stop()); + } this.resetTimer(); } cloneMediaStream() { + if (this.inputStream) return; const { inputStream, muted } = this.props; if (inputStream && !muted) this.inputStream = inputStream.clone(); } @@ -71,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;