Browse Source

feat(IFrameApi): setAudioOnly command & event.

factor2
Hristo Terezov 11 months ago
parent
commit
037a7c082c

+ 18
- 0
modules/API/API.js View File

14
     requestEnableVideoModeration
14
     requestEnableVideoModeration
15
 } from '../../react/features/av-moderation/actions';
15
 } from '../../react/features/av-moderation/actions';
16
 import { isEnabledFromState } from '../../react/features/av-moderation/functions';
16
 import { isEnabledFromState } from '../../react/features/av-moderation/functions';
17
+import { setAudioOnly } from '../../react/features/base/audio-only/actions';
17
 import {
18
 import {
18
     endConference,
19
     endConference,
19
     sendTones,
20
     sendTones,
565
             sendAnalytics(createApiEvent('set.video.quality'));
566
             sendAnalytics(createApiEvent('set.video.quality'));
566
             APP.store.dispatch(setVideoQuality(frameHeight));
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
         'start-share-video': url => {
573
         'start-share-video': url => {
569
             sendAnalytics(createApiEvent('share.video.start'));
574
             sendAnalytics(createApiEvent('share.video.start'));
570
             const id = extractYoutubeIdOrURL(url);
575
             const id = extractYoutubeIdOrURL(url);
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
      * Disposes the allocated resources.
2240
      * Disposes the allocated resources.
2223
      *
2241
      *

+ 2
- 0
modules/API/external/external_api.js View File

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

+ 10
- 0
react/features/external-api/subscriber.ts View File

61
         APP.API.notifyOnStageParticipantChanged(participantId);
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
+);

Loading…
Cancel
Save