fix(always-on-top) Fix audio mute button disabled status

This commit is contained in:
Horatiu Muresan 2022-04-26 15:32:18 +03:00 committed by GitHub
parent 3e004811e0
commit eb64ea6aba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 4 deletions

View File

@ -88,6 +88,7 @@ import { isScreenshotCaptureEnabled } from '../../react/features/screenshot-capt
import { playSharedVideo, stopSharedVideo } from '../../react/features/shared-video/actions.any';
import { extractYoutubeIdOrURL } from '../../react/features/shared-video/functions';
import { toggleRequestingSubtitles, setRequestingSubtitles } from '../../react/features/subtitles/actions';
import { isAudioMuteButtonDisabled } from '../../react/features/toolbox/functions';
import { toggleTileView, setTileView } from '../../react/features/video-layout';
import { muteAllParticipants } from '../../react/features/video-menu/actions';
import { setVideoQuality } from '../../react/features/video-quality';
@ -700,6 +701,9 @@ function initCommands() {
case 'is-audio-muted':
callback(APP.conference.isLocalAudioMuted());
break;
case 'is-audio-disabled':
callback(isAudioMuteButtonDisabled(APP.store.getState()));
break;
case 'is-moderation-on': {
const { mediaType } = request;
const type = mediaType || MEDIA_TYPE.AUDIO;

View File

@ -927,6 +927,18 @@ export default class JitsiMeetExternalAPI extends EventEmitter {
});
}
/**
* Returns the audio disabled status.
*
* @returns {Promise} - Resolves with the audio disabled status and rejects on
* failure.
*/
isAudioDisabled() {
return this._transport.sendRequest({
name: 'is-audio-disabled'
});
}
/**
* Returns the moderation on status on the given mediaType.
*

View File

@ -69,11 +69,11 @@ export default class AudioMuteButton extends Component<Props, State> {
Promise.all([
api.isAudioAvailable(),
api.isAudioMuted(),
api.isStartSilent()
api.isAudioDisabled?.() || Promise.resolve(false)
])
.then(([ audioAvailable, audioMuted, startSilent ]) =>
.then(([ audioAvailable, audioMuted, audioDisabled ]) =>
this.setState({
audioAvailable: audioAvailable && !startSilent,
audioAvailable: audioAvailable && !audioDisabled,
audioMuted
}))
.catch(console.error);

View File

@ -10,5 +10,5 @@ export function isAudioMuteButtonDisabled(state: Object) {
const { available, muted, unmuteBlocked } = state['features/base/media'].audio;
const { startSilent } = state['features/base/config'];
return !available || startSilent || (muted && unmuteBlocked);
return Boolean(!available || startSilent || (muted && unmuteBlocked));
}