fix(always-on-top) Fix audio mute button disabled status
This commit is contained in:
parent
3e004811e0
commit
eb64ea6aba
|
@ -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;
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue