Parcourir la source

feat(IFrameApi): setAudioOnly command & event.

factor2
Hristo Terezov il y a 11 mois
Parent
révision
037a7c082c

+ 18
- 0
modules/API/API.js Voir le fichier

@@ -14,6 +14,7 @@ import {
14 14
     requestEnableVideoModeration
15 15
 } from '../../react/features/av-moderation/actions';
16 16
 import { isEnabledFromState } from '../../react/features/av-moderation/functions';
17
+import { setAudioOnly } from '../../react/features/base/audio-only/actions';
17 18
 import {
18 19
     endConference,
19 20
     sendTones,
@@ -565,6 +566,10 @@ function initCommands() {
565 566
             sendAnalytics(createApiEvent('set.video.quality'));
566 567
             APP.store.dispatch(setVideoQuality(frameHeight));
567 568
         },
569
+        'set-audio-only': enable => {
570
+            sendAnalytics(createApiEvent('set.audio.only'));
571
+            APP.store.dispatch(setAudioOnly(enable));
572
+        },
568 573
         'start-share-video': url => {
569 574
             sendAnalytics(createApiEvent('share.video.start'));
570 575
             const id = extractYoutubeIdOrURL(url);
@@ -2218,6 +2223,19 @@ class API {
2218 2223
         });
2219 2224
     }
2220 2225
 
2226
+    /**
2227
+     * Notify the external application (if API is enabled) when the audio only enabled status changed.
2228
+     *
2229
+     * @param {boolean} enabled - Whether the audio only is enabled or not.
2230
+     * @returns {void}
2231
+     */
2232
+    notifyAudioOnlyChanged(enabled) {
2233
+        this._sendEvent({
2234
+            name: 'audio-only-changed',
2235
+            enabled
2236
+        });
2237
+    }
2238
+
2221 2239
     /**
2222 2240
      * Disposes the allocated resources.
2223 2241
      *

+ 2
- 0
modules/API/external/external_api.js Voir le fichier

@@ -59,6 +59,7 @@ const commands = {
59 59
     sendEndpointTextMessage: 'send-endpoint-text-message',
60 60
     sendParticipantToRoom: 'send-participant-to-room',
61 61
     sendTones: 'send-tones',
62
+    setAudioOnly: 'set-audio-only',
62 63
     setAssumedBandwidthBps: 'set-assumed-bandwidth-bps',
63 64
     setBlurredBackground: 'set-blurred-background',
64 65
     setFollowMe: 'set-follow-me',
@@ -103,6 +104,7 @@ const events = {
103 104
     'avatar-changed': 'avatarChanged',
104 105
     'audio-availability-changed': 'audioAvailabilityChanged',
105 106
     'audio-mute-status-changed': 'audioMuteStatusChanged',
107
+    'audio-only-changed': 'audioOnlyChanged',
106 108
     'audio-or-video-sharing-toggled': 'audioOrVideoSharingToggled',
107 109
     'breakout-rooms-updated': 'breakoutRoomsUpdated',
108 110
     'browser-support': 'browserSupport',

+ 10
- 0
react/features/external-api/subscriber.ts Voir le fichier

@@ -61,3 +61,13 @@ StateListenerRegistry.register(
61 61
         APP.API.notifyOnStageParticipantChanged(participantId);
62 62
     }
63 63
 );
64
+
65
+/**
66
+ * Updates the on audio only value.
67
+ */
68
+StateListenerRegistry.register(
69
+    /* selector */ state => state['features/base/audio-only'].enabled,
70
+    /* listener */ enabled => {
71
+        APP.API.notifyAudioOnlyChanged(enabled);
72
+    }
73
+);

Chargement…
Annuler
Enregistrer