Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
fix(raised-hand) lower raised hand by local audio level changes when participant is dominant
Gabriel Borleaf4bd40dcfe00
diff --git a/conference.js b/conference.jsindex ae412b7330..12746a39db 100644--- a/conference.js+++ b/conference.js@@ -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;}diff --git a/react/features/base/participants/actionTypes.js b/react/features/base/participants/actionTypes.jsindex ca27fa24c9..30db5ea654 100644--- a/react/features/base/participants/actionTypes.js+++ b/react/features/base/participants/actionTypes.js@@ -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'\ No newline at end of filediff --git a/react/features/base/participants/actions.js b/react/features/base/participants/actions.jsindex 8a67f29f89..0f0c395146 100644--- a/react/features/base/participants/actions.js+++ b/react/features/base/participants/actions.js@@ -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+ };+}diff --git a/react/features/base/participants/constants.js b/react/features/base/participants/constants.jsindex 952112b249..79746602b3 100644--- a/react/features/base/participants/constants.js+++ b/react/features/base/participants/constants.js@@ -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;diff --git a/react/features/base/participants/middleware.js b/react/features/base/participants/middleware.jsindex 47d38d2001..425ac1bcc6 100644--- a/react/features/base/participants/middleware.js+++ b/react/features/base/participants/middleware.js@@ -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'];