fix(media) dispatch the unmute blocked action irrepective of the muted state.
This fixes an issue where the user muted by focus is able to unmute themselves even when the sender limit has been reached.
This commit is contained in:
parent
65589937ea
commit
b19e4d76b5
|
@ -76,8 +76,6 @@ import {
|
|||
import {
|
||||
getStartWithAudioMuted,
|
||||
getStartWithVideoMuted,
|
||||
isAudioMuted,
|
||||
isVideoMuted,
|
||||
isVideoMutedByUser,
|
||||
MEDIA_TYPE,
|
||||
setAudioAvailable,
|
||||
|
@ -2264,22 +2262,12 @@ export default {
|
|||
room.on(
|
||||
JitsiConferenceEvents.AUDIO_UNMUTE_PERMISSIONS_CHANGED,
|
||||
disableAudioMuteChange => {
|
||||
const muted = isAudioMuted(APP.store.getState());
|
||||
|
||||
// Disable the mute button only if its muted.
|
||||
if (!disableAudioMuteChange || (disableAudioMuteChange && muted)) {
|
||||
APP.store.dispatch(setAudioUnmutePermissions(disableAudioMuteChange));
|
||||
}
|
||||
APP.store.dispatch(setAudioUnmutePermissions(disableAudioMuteChange));
|
||||
});
|
||||
room.on(
|
||||
JitsiConferenceEvents.VIDEO_UNMUTE_PERMISSIONS_CHANGED,
|
||||
disableVideoMuteChange => {
|
||||
const muted = isVideoMuted(APP.store.getState());
|
||||
|
||||
// Disable the mute button only if its muted.
|
||||
if (!disableVideoMuteChange || (disableVideoMuteChange && muted)) {
|
||||
APP.store.dispatch(setVideoUnmutePermissions(disableVideoMuteChange));
|
||||
}
|
||||
APP.store.dispatch(setVideoUnmutePermissions(disableVideoMuteChange));
|
||||
});
|
||||
|
||||
APP.UI.addListener(UIEvents.AUDIO_MUTED, muted => {
|
||||
|
|
|
@ -12,8 +12,6 @@ import { JITSI_CONNECTION_CONFERENCE_KEY } from '../connection';
|
|||
import { JitsiConferenceEvents } from '../lib-jitsi-meet';
|
||||
import {
|
||||
MEDIA_TYPE,
|
||||
isAudioMuted,
|
||||
isVideoMuted,
|
||||
setAudioMuted,
|
||||
setAudioUnmutePermissions,
|
||||
setVideoMuted,
|
||||
|
@ -158,22 +156,12 @@ function _addConferenceListeners(conference, dispatch, state) {
|
|||
conference.on(
|
||||
JitsiConferenceEvents.AUDIO_UNMUTE_PERMISSIONS_CHANGED,
|
||||
disableAudioMuteChange => {
|
||||
const muted = isAudioMuted(state);
|
||||
|
||||
// Disable the mute button only if its muted.
|
||||
if (!disableAudioMuteChange || (disableAudioMuteChange && muted)) {
|
||||
dispatch(setAudioUnmutePermissions(disableAudioMuteChange));
|
||||
}
|
||||
dispatch(setAudioUnmutePermissions(disableAudioMuteChange));
|
||||
});
|
||||
conference.on(
|
||||
JitsiConferenceEvents.VIDEO_UNMUTE_PERMISSIONS_CHANGED,
|
||||
disableVideoMuteChange => {
|
||||
const muted = isVideoMuted(state);
|
||||
|
||||
// Disable the mute button only if its muted.
|
||||
if (!disableVideoMuteChange || (disableVideoMuteChange && muted)) {
|
||||
dispatch(setVideoUnmutePermissions(disableVideoMuteChange));
|
||||
}
|
||||
dispatch(setVideoUnmutePermissions(disableVideoMuteChange));
|
||||
});
|
||||
|
||||
// Dispatches into features/base/tracks follow:
|
||||
|
|
|
@ -20,6 +20,7 @@ import { MiddlewareRegistry } from '../redux';
|
|||
import { getPropertyValue } from '../settings';
|
||||
import {
|
||||
destroyLocalTracks,
|
||||
isLocalTrackMuted,
|
||||
isLocalVideoTrackDesktop,
|
||||
setTrackMuted,
|
||||
TRACK_ADDED
|
||||
|
@ -85,8 +86,11 @@ MiddlewareRegistry.register(store => next => action => {
|
|||
|
||||
case SET_AUDIO_UNMUTE_PERMISSIONS: {
|
||||
const { blocked } = action;
|
||||
const state = store.getState();
|
||||
const tracks = state['features/base/tracks'];
|
||||
const isAudioMuted = isLocalTrackMuted(tracks, MEDIA_TYPE.AUDIO);
|
||||
|
||||
if (blocked) {
|
||||
if (blocked && isAudioMuted) {
|
||||
store.dispatch(showWarningNotification({
|
||||
descriptionKey: 'notify.audioUnmuteBlockedDescription',
|
||||
titleKey: 'notify.audioUnmuteBlockedTitle'
|
||||
|
@ -107,8 +111,11 @@ MiddlewareRegistry.register(store => next => action => {
|
|||
|
||||
case SET_VIDEO_UNMUTE_PERMISSIONS: {
|
||||
const { blocked } = action;
|
||||
const state = store.getState();
|
||||
const tracks = state['features/base/tracks'];
|
||||
const isVideoMuted = isLocalTrackMuted(tracks, MEDIA_TYPE.VIDEO);
|
||||
|
||||
if (blocked) {
|
||||
if (blocked && isVideoMuted) {
|
||||
store.dispatch(showWarningNotification({
|
||||
descriptionKey: 'notify.videoUnmuteBlockedDescription',
|
||||
titleKey: 'notify.videoUnmuteBlockedTitle'
|
||||
|
|
|
@ -35,7 +35,7 @@ import { CAMERA_FACING_MODE } from './constants';
|
|||
*/
|
||||
export const _AUDIO_INITIAL_MEDIA_STATE = {
|
||||
available: true,
|
||||
blocked: false,
|
||||
unmuteBlocked: false,
|
||||
muted: false
|
||||
};
|
||||
|
||||
|
@ -65,7 +65,7 @@ function _audio(state = _AUDIO_INITIAL_MEDIA_STATE, action) {
|
|||
case SET_AUDIO_UNMUTE_PERMISSIONS:
|
||||
return {
|
||||
...state,
|
||||
blocked: action.blocked
|
||||
unmuteBlocked: action.blocked
|
||||
};
|
||||
|
||||
default:
|
||||
|
@ -92,7 +92,7 @@ function _audio(state = _AUDIO_INITIAL_MEDIA_STATE, action) {
|
|||
*/
|
||||
export const _VIDEO_INITIAL_MEDIA_STATE = {
|
||||
available: true,
|
||||
blocked: false,
|
||||
unmuteBlocked: false,
|
||||
facingMode: CAMERA_FACING_MODE.USER,
|
||||
muted: 0,
|
||||
|
||||
|
@ -139,7 +139,7 @@ function _video(state = _VIDEO_INITIAL_MEDIA_STATE, action) {
|
|||
case SET_VIDEO_UNMUTE_PERMISSIONS:
|
||||
return {
|
||||
...state,
|
||||
blocked: action.blocked
|
||||
unmuteBlocked: action.blocked
|
||||
};
|
||||
|
||||
case STORE_VIDEO_TRANSFORM:
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* @returns {boolean}
|
||||
*/
|
||||
export function isAudioMuteButtonDisabled(state: Object) {
|
||||
const { audio } = state['features/base/media'];
|
||||
const { available, muted, unmuteBlocked } = state['features/base/media'].audio;
|
||||
|
||||
return !(audio?.available && !audio?.blocked);
|
||||
return !available || (muted && unmuteBlocked);
|
||||
}
|
||||
|
|
|
@ -80,7 +80,9 @@ export function isToolboxVisible(stateful: Object | Function) {
|
|||
* @returns {boolean}
|
||||
*/
|
||||
export function isVideoMuteButtonDisabled(state: Object) {
|
||||
const { video } = state['features/base/media'];
|
||||
const { muted, unmuteBlocked } = state['features/base/media'].video;
|
||||
|
||||
return !hasAvailableDevices(state, 'videoInput') || video?.blocked || isLocalVideoTrackDesktop(state);
|
||||
return !hasAvailableDevices(state, 'videoInput')
|
||||
|| (unmuteBlocked && Boolean(muted))
|
||||
|| isLocalVideoTrackDesktop(state);
|
||||
}
|
||||
|
|
|
@ -83,9 +83,9 @@ export function isVideoSettingsButtonDisabled(state: Object) {
|
|||
* @returns {boolean}
|
||||
*/
|
||||
export function isVideoMuteButtonDisabled(state: Object) {
|
||||
const { video } = state['features/base/media'];
|
||||
const { muted, unmuteBlocked } = state['features/base/media'].video;
|
||||
|
||||
return !hasAvailableDevices(state, 'videoInput') || video?.blocked;
|
||||
return !hasAvailableDevices(state, 'videoInput') || (unmuteBlocked && Boolean(muted));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue