fix(raised-hand) lower raised hand by local audio level changes when participant is dominant
This commit is contained in:
parent
be27464b08
commit
f4bd40dcfe
|
@ -90,6 +90,7 @@ import {
|
|||
dominantSpeakerChanged,
|
||||
getLocalParticipant,
|
||||
getNormalizedDisplayName,
|
||||
localParticipantAudioLevelChanged,
|
||||
localParticipantConnectionStatusChanged,
|
||||
localParticipantRoleChanged,
|
||||
participantConnectionStatusChanged,
|
||||
|
@ -2128,6 +2129,10 @@ export default {
|
|||
const localAudio = getLocalJitsiAudioTrack(APP.store.getState());
|
||||
let newLvl = lvl;
|
||||
|
||||
if (this.isLocalId(id)) {
|
||||
APP.store.dispatch(localParticipantAudioLevelChanged(lvl));
|
||||
}
|
||||
|
||||
if (this.isLocalId(id) && localAudio?.isMuted()) {
|
||||
newLvl = 0;
|
||||
}
|
||||
|
|
|
@ -192,3 +192,12 @@ export const LOCAL_PARTICIPANT_RAISE_HAND = 'LOCAL_PARTICIPANT_RAISE_HAND';
|
|||
* }
|
||||
*/
|
||||
export const RAISE_HAND_UPDATED = 'RAISE_HAND_UPDATED';
|
||||
|
||||
/**
|
||||
* The type of Redux action which notifies that the local participant has changed the audio levels.
|
||||
* {
|
||||
* type: LOCAL_PARTICIPANT_AUDIO_LEVEL_CHANGED
|
||||
* level: number
|
||||
* }
|
||||
*/
|
||||
export const LOCAL_PARTICIPANT_AUDIO_LEVEL_CHANGED = 'LOCAL_PARTICIPANT_AUDIO_LEVEL_CHANGED'
|
|
@ -7,6 +7,7 @@ import {
|
|||
HIDDEN_PARTICIPANT_LEFT,
|
||||
GRANT_MODERATOR,
|
||||
KICK_PARTICIPANT,
|
||||
LOCAL_PARTICIPANT_AUDIO_LEVEL_CHANGED,
|
||||
LOCAL_PARTICIPANT_RAISE_HAND,
|
||||
MUTE_REMOTE_PARTICIPANT,
|
||||
PARTICIPANT_ID_CHANGED,
|
||||
|
@ -592,3 +593,19 @@ export function raiseHandUpdateQueue(participant) {
|
|||
participant
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Notifies if the local participant audio level has changed.
|
||||
*
|
||||
* @param {number} level - The audio level.
|
||||
* @returns {{
|
||||
* type: LOCAL_PARTICIPANT_AUDIO_LEVEL_CHANGED,
|
||||
* level: number
|
||||
* }}
|
||||
*/
|
||||
export function localParticipantAudioLevelChanged(level) {
|
||||
return {
|
||||
type: LOCAL_PARTICIPANT_AUDIO_LEVEL_CHANGED,
|
||||
level
|
||||
};
|
||||
}
|
||||
|
|
|
@ -70,3 +70,10 @@ export const PARTICIPANT_ROLE = {
|
|||
NONE: 'none',
|
||||
PARTICIPANT: 'participant'
|
||||
};
|
||||
|
||||
/**
|
||||
* The audio level at which the hand will be lowered if raised.
|
||||
*
|
||||
* @type {string}
|
||||
*/
|
||||
export const LOWER_HAND_AUDIO_LEVEL = 0.2;
|
||||
|
|
|
@ -31,6 +31,7 @@ import {
|
|||
DOMINANT_SPEAKER_CHANGED,
|
||||
GRANT_MODERATOR,
|
||||
KICK_PARTICIPANT,
|
||||
LOCAL_PARTICIPANT_AUDIO_LEVEL_CHANGED,
|
||||
LOCAL_PARTICIPANT_RAISE_HAND,
|
||||
MUTE_REMOTE_PARTICIPANT,
|
||||
PARTICIPANT_DISPLAY_NAME_CHANGED,
|
||||
|
@ -50,10 +51,12 @@ import {
|
|||
} from './actions';
|
||||
import {
|
||||
LOCAL_PARTICIPANT_DEFAULT_ID,
|
||||
LOWER_HAND_AUDIO_LEVEL,
|
||||
PARTICIPANT_JOINED_SOUND_ID,
|
||||
PARTICIPANT_LEFT_SOUND_ID
|
||||
} from './constants';
|
||||
import {
|
||||
getDominantSpeakerParticipant,
|
||||
getFirstLoadableAvatarUrl,
|
||||
getLocalParticipant,
|
||||
getParticipantById,
|
||||
|
@ -106,6 +109,22 @@ MiddlewareRegistry.register(store => next => action => {
|
|||
break;
|
||||
}
|
||||
|
||||
case LOCAL_PARTICIPANT_AUDIO_LEVEL_CHANGED: {
|
||||
const state = store.getState();
|
||||
const participant = getDominantSpeakerParticipant(state);
|
||||
|
||||
if (
|
||||
participant
|
||||
&& participant.local
|
||||
&& hasRaisedHand(participant)
|
||||
&& action.level > LOWER_HAND_AUDIO_LEVEL
|
||||
&& !getDisableRemoveRaisedHandOnFocus(state)
|
||||
) {
|
||||
store.dispatch(raiseHand(false));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case GRANT_MODERATOR: {
|
||||
const { conference } = store.getState()['features/base/conference'];
|
||||
|
||||
|
|
Loading…
Reference in New Issue