Kaynağa Gözat

fix(always-on-top) Fix audio mute button disabled status

master
Horatiu Muresan 3 yıl önce
ebeveyn
işleme
eb64ea6aba
No account linked to committer's email address

+ 4
- 0
modules/API/API.js Dosyayı Görüntüle

@@ -88,6 +88,7 @@ import { isScreenshotCaptureEnabled } from '../../react/features/screenshot-capt
88 88
 import { playSharedVideo, stopSharedVideo } from '../../react/features/shared-video/actions.any';
89 89
 import { extractYoutubeIdOrURL } from '../../react/features/shared-video/functions';
90 90
 import { toggleRequestingSubtitles, setRequestingSubtitles } from '../../react/features/subtitles/actions';
91
+import { isAudioMuteButtonDisabled } from '../../react/features/toolbox/functions';
91 92
 import { toggleTileView, setTileView } from '../../react/features/video-layout';
92 93
 import { muteAllParticipants } from '../../react/features/video-menu/actions';
93 94
 import { setVideoQuality } from '../../react/features/video-quality';
@@ -700,6 +701,9 @@ function initCommands() {
700 701
         case 'is-audio-muted':
701 702
             callback(APP.conference.isLocalAudioMuted());
702 703
             break;
704
+        case 'is-audio-disabled':
705
+            callback(isAudioMuteButtonDisabled(APP.store.getState()));
706
+            break;
703 707
         case 'is-moderation-on': {
704 708
             const { mediaType } = request;
705 709
             const type = mediaType || MEDIA_TYPE.AUDIO;

+ 12
- 0
modules/API/external/external_api.js Dosyayı Görüntüle

@@ -927,6 +927,18 @@ export default class JitsiMeetExternalAPI extends EventEmitter {
927 927
         });
928 928
     }
929 929
 
930
+    /**
931
+     * Returns the audio disabled status.
932
+     *
933
+     * @returns {Promise} - Resolves with the audio disabled status and rejects on
934
+     * failure.
935
+     */
936
+    isAudioDisabled() {
937
+        return this._transport.sendRequest({
938
+            name: 'is-audio-disabled'
939
+        });
940
+    }
941
+
930 942
     /**
931 943
      * Returns the moderation on status on the given mediaType.
932 944
      *

+ 3
- 3
react/features/always-on-top/AudioMuteButton.js Dosyayı Görüntüle

@@ -69,11 +69,11 @@ export default class AudioMuteButton extends Component<Props, State> {
69 69
         Promise.all([
70 70
             api.isAudioAvailable(),
71 71
             api.isAudioMuted(),
72
-            api.isStartSilent()
72
+            api.isAudioDisabled?.() || Promise.resolve(false)
73 73
         ])
74
-            .then(([ audioAvailable, audioMuted, startSilent ]) =>
74
+            .then(([ audioAvailable, audioMuted, audioDisabled ]) =>
75 75
                 this.setState({
76
-                    audioAvailable: audioAvailable && !startSilent,
76
+                    audioAvailable: audioAvailable && !audioDisabled,
77 77
                     audioMuted
78 78
                 }))
79 79
             .catch(console.error);

+ 1
- 1
react/features/toolbox/functions.any.js Dosyayı Görüntüle

@@ -10,5 +10,5 @@ export function isAudioMuteButtonDisabled(state: Object) {
10 10
     const { available, muted, unmuteBlocked } = state['features/base/media'].audio;
11 11
     const { startSilent } = state['features/base/config'];
12 12
 
13
-    return !available || startSilent || (muted && unmuteBlocked);
13
+    return Boolean(!available || startSilent || (muted && unmuteBlocked));
14 14
 }

Loading…
İptal
Kaydet