Skip to content

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

[RN] Fix audio / video mute buttons when permissions are not granted

Saúl Ibarra Corretgéf72932d1254a
diff --git a/react/features/toolbox/functions.native.js b/react/features/toolbox/functions.native.js
index 6555b57836..71770ee71f 100644
--- a/react/features/toolbox/functions.native.js
+++ b/react/features/toolbox/functions.native.js
@@ -4,6 +4,7 @@ import type { Dispatch } from 'redux';
import { appNavigate } from '../app';
import { toggleAudioMuted, toggleVideoMuted } from '../base/media';
+import { getLocalAudioTrack, getLocalVideoTrack } from '../base/tracks';
/**
* Maps (redux) actions to React component props.
@@ -71,9 +72,12 @@ export function abstractMapDispatchToProps(dispatch: Dispatch<*>): Object {
* }}
*/
export function abstractMapStateToProps(state: Object): Object {
- const media = state['features/base/media'];
+ const tracks = state['features/base/tracks'];
const { visible } = state['features/toolbox'];
+ const audioTrack = getLocalAudioTrack(tracks);
+ const videoTrack = getLocalVideoTrack(tracks);
+
return {
/**
* Flag showing that audio is muted.
@@ -81,7 +85,7 @@ export function abstractMapStateToProps(state: Object): Object {
* @protected
* @type {boolean}
*/
- _audioMuted: media.audio.muted,
+ _audioMuted: !audioTrack || audioTrack.muted,
/**
* Flag showing whether video is muted.
@@ -89,7 +93,7 @@ export function abstractMapStateToProps(state: Object): Object {
* @protected
* @type {boolean}
*/
- _videoMuted: media.video.muted,
+ _videoMuted: !videoTrack || videoTrack.muted,
/**
* Flag showing whether toolbox is visible.