瀏覽代碼

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

master
Saúl Ibarra Corretgé 8 年之前
父節點
當前提交
f72932d125
共有 1 個文件被更改,包括 7 次插入3 次删除
  1. 7
    3
      react/features/toolbox/functions.native.js

+ 7
- 3
react/features/toolbox/functions.native.js 查看文件

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

Loading…
取消
儲存