Browse Source

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

master
Saúl Ibarra Corretgé 8 years ago
parent
commit
f72932d125
1 changed files with 7 additions and 3 deletions
  1. 7
    3
      react/features/toolbox/functions.native.js

+ 7
- 3
react/features/toolbox/functions.native.js View File

4
 
4
 
5
 import { appNavigate } from '../app';
5
 import { appNavigate } from '../app';
6
 import { toggleAudioMuted, toggleVideoMuted } from '../base/media';
6
 import { toggleAudioMuted, toggleVideoMuted } from '../base/media';
7
+import { getLocalAudioTrack, getLocalVideoTrack } from '../base/tracks';
7
 
8
 
8
 /**
9
 /**
9
  * Maps (redux) actions to React component props.
10
  * Maps (redux) actions to React component props.
71
  * }}
72
  * }}
72
  */
73
  */
73
 export function abstractMapStateToProps(state: Object): Object {
74
 export function abstractMapStateToProps(state: Object): Object {
74
-    const media = state['features/base/media'];
75
+    const tracks = state['features/base/tracks'];
75
     const { visible } = state['features/toolbox'];
76
     const { visible } = state['features/toolbox'];
76
 
77
 
78
+    const audioTrack = getLocalAudioTrack(tracks);
79
+    const videoTrack = getLocalVideoTrack(tracks);
80
+
77
     return {
81
     return {
78
         /**
82
         /**
79
          * Flag showing that audio is muted.
83
          * Flag showing that audio is muted.
81
          * @protected
85
          * @protected
82
          * @type {boolean}
86
          * @type {boolean}
83
          */
87
          */
84
-        _audioMuted: media.audio.muted,
88
+        _audioMuted: !audioTrack || audioTrack.muted,
85
 
89
 
86
         /**
90
         /**
87
          * Flag showing whether video is muted.
91
          * Flag showing whether video is muted.
89
          * @protected
93
          * @protected
90
          * @type {boolean}
94
          * @type {boolean}
91
          */
95
          */
92
-        _videoMuted: media.video.muted,
96
+        _videoMuted: !videoTrack || videoTrack.muted,
93
 
97
 
94
         /**
98
         /**
95
          * Flag showing whether toolbox is visible.
99
          * Flag showing whether toolbox is visible.

Loading…
Cancel
Save