From f72932d1254a4a5cbefd03e52d85dd45eb4d03a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Wed, 19 Jul 2017 14:38:38 +0200 Subject: [PATCH] [RN] Fix audio / video mute buttons when permissions are not granted --- react/features/toolbox/functions.native.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/react/features/toolbox/functions.native.js b/react/features/toolbox/functions.native.js index 6555b5783..71770ee71 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.