Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(av-moderation) Fix Ask to Unmute on native

robertpin53a05dd1ad02
diff --git a/react/features/video-menu/components/native/AskUnmuteButton.js b/react/features/video-menu/components/native/AskUnmuteButton.js
index e73af327af..18c3d0817b 100644
--- a/react/features/video-menu/components/native/AskUnmuteButton.js
+++ b/react/features/video-menu/components/native/AskUnmuteButton.js
@@ -1,8 +1,9 @@
// @flow
import { approveParticipant } from '../../../av-moderation/actions';
+import { isSupported } from '../../../av-moderation/functions';
import { translate } from '../../../base/i18n';
-import { IconMicrophone } from '../../../base/icons';
+import { IconCamera, IconMicrophone } from '../../../base/icons';
import { MEDIA_TYPE } from '../../../base/media';
import { getParticipantById, isLocalParticipantModerator } from '../../../base/participants';
import { connect } from '../../../base/redux';
@@ -16,11 +17,21 @@ export type Props = AbstractButtonProps & {
*/
dispatch: Function,
+ /**
+ * Whether or not the participant is audio force muted.
+ */
+ isAudioForceMuted: boolean,
+
+ /**
+ * Whether or not the participant is video force muted.
+ */
+ isVideoForceMuted: boolean,
+
/**
* The ID of the participant object that this button is supposed to
* ask to unmute.
*/
- participantID: string,
+ participantID: string
};
/**
@@ -31,6 +42,36 @@ class AskUnmuteButton extends AbstractButton<Props, *> {
icon = IconMicrophone;
label = 'participantsPane.actions.askUnmute';
+ /**
+ * Gets the current label.
+ *
+ * @returns {string}
+ */
+ _getLabel() {
+ const { isAudioForceMuted, isVideoForceMuted } = this.props;
+
+ if (!isAudioForceMuted && isVideoForceMuted) {
+ return 'participantsPane.actions.allowVideo';
+ }
+
+ return this.label;
+ }
+
+ /**
+ * Gets the current icon.
+ *
+ * @returns {string}
+ */
+ _getIcon() {
+ const { isAudioForceMuted, isVideoForceMuted } = this.props;
+
+ if (!isAudioForceMuted && isVideoForceMuted) {
+ return IconCamera;
+ }
+
+ return this.icon;
+ }
+
/**
* Handles clicking / pressing the button, and asks the participant to unmute.
*
@@ -56,9 +97,9 @@ function mapStateToProps(state, ownProps) {
const participant = getParticipantById(state, participantID);
return {
- visible: isLocalParticipantModerator(state)
- && (isForceMuted(participant, MEDIA_TYPE.AUDIO, state)
- || isForceMuted(participant, MEDIA_TYPE.VIDEO, state))
+ isAudioForceMuted: isForceMuted(participant, MEDIA_TYPE.AUDIO, state),
+ isVideoForceMuted: isForceMuted(participant, MEDIA_TYPE.VIDEO, state),
+ visible: isLocalParticipantModerator(state) && isSupported()
};
}