Browse Source

Adds setting subject and adding event on receiving such change.

master
damencho 6 years ago
parent
commit
fc129d9849

+ 14
- 1
conference.js View File

@@ -45,7 +45,8 @@ import {
45 45
     onStartMutedPolicyChanged,
46 46
     p2pStatusChanged,
47 47
     sendLocalParticipant,
48
-    setDesktopSharingEnabled
48
+    setDesktopSharingEnabled,
49
+    setSubject
49 50
 } from './react/features/base/conference';
50 51
 import {
51 52
     getAvailableDevices,
@@ -1825,6 +1826,8 @@ export default {
1825 1826
         room.on(JitsiConferenceEvents.TALK_WHILE_MUTED, () => {
1826 1827
             APP.UI.showToolbar(6000);
1827 1828
         });
1829
+        room.on(JitsiConferenceEvents.SUBJECT_CHANGED,
1830
+            subject => APP.API.notifySubjectChanged(subject));
1828 1831
 
1829 1832
         room.on(
1830 1833
             JitsiConferenceEvents.LAST_N_ENDPOINTS_CHANGED,
@@ -2756,6 +2759,16 @@ export default {
2756 2759
         APP.API.notifyAudioMutedStatusChanged(muted);
2757 2760
     },
2758 2761
 
2762
+    /**
2763
+     * Changes the subject of the conference.
2764
+     * Note: available only for moderator.
2765
+     *
2766
+     * @param subject {string} the new subject for the conference.
2767
+     */
2768
+    setSubject(subject) {
2769
+        APP.store.dispatch(setSubject(subject));
2770
+    },
2771
+
2759 2772
     /**
2760 2773
      * Dispatches the passed in feedback for submission. The submitted score
2761 2774
      * should be a number inclusively between 1 through 5, or -1 for no score.

+ 13
- 0
doc/api.md View File

@@ -78,6 +78,11 @@ The `command` parameter is String object with the name of the command. The follo
78 78
 api.executeCommand('displayName', 'New Nickname');
79 79
 ```
80 80
 
81
+* **subject** - Sets the subject of the conference. This command requires one argument - the new subject to be set.
82
+```javascript
83
+api.executeCommand('subject', 'New Conference Subject');
84
+```
85
+
81 86
 * **toggleAudio** - Mutes / unmutes the audio for the local participant. No arguments are required.
82 87
 ```javascript
83 88
 api.executeCommand('toggleAudio')
@@ -251,6 +256,14 @@ changes. The listener will receive an object with the following structure:
251 256
 
252 257
 * **readyToClose** - event notification fired when Jitsi Meet is ready to be closed (hangup operations are completed).
253 258
 
259
+* **subjectChange** - event notifications about subject of conference changes. 
260
+The listener will receive an object with the following structure:
261
+```javascript
262
+{
263
+"subject": subject // the new subject
264
+}
265
+```
266
+
254 267
 You can also add multiple event listeners by using `addEventListeners`.
255 268
 This method requires one argument of type Object. The object argument must
256 269
 have the names of the events as keys and the listeners of the events as values.

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

@@ -63,6 +63,10 @@ function initCommands() {
63 63
         'proxy-connection-event': event => {
64 64
             APP.conference.onProxyConnectionEvent(event);
65 65
         },
66
+        'subject': subject => {
67
+            sendAnalytics(createApiEvent('subject.changed'));
68
+            APP.conference.setSubject(subject);
69
+        },
66 70
         'submit-feedback': feedback => {
67 71
             sendAnalytics(createApiEvent('submit.feedback'));
68 72
             APP.conference.submitFeedback(feedback.score, feedback.message);
@@ -551,6 +555,20 @@ class API {
551 555
         });
552 556
     }
553 557
 
558
+    /**
559
+     * Notify external application (if API is enabled) that the conference
560
+     * changed their subject.
561
+     *
562
+     * @param {string} subject - Conference subject.
563
+     * @returns {void}
564
+     */
565
+    notifySubjectChanged(subject: string) {
566
+        this._sendEvent({
567
+            name: 'subject-change',
568
+            subject
569
+        });
570
+    }
571
+
554 572
     /**
555 573
      * Disposes the allocated resources.
556 574
      *

+ 6
- 1
modules/API/external/external_api.js View File

@@ -23,6 +23,7 @@ const commands = {
23 23
     displayName: 'display-name',
24 24
     email: 'email',
25 25
     hangup: 'video-hangup',
26
+    subject: 'subject',
26 27
     submitFeedback: 'submit-feedback',
27 28
     toggleAudio: 'toggle-audio',
28 29
     toggleChat: 'toggle-chat',
@@ -52,7 +53,8 @@ const events = {
52 53
     'video-conference-left': 'videoConferenceLeft',
53 54
     'video-availability-changed': 'videoAvailabilityChanged',
54 55
     'video-mute-status-changed': 'videoMuteStatusChanged',
55
-    'screen-sharing-status-changed': 'screenSharingStatusChanged'
56
+    'screen-sharing-status-changed': 'screenSharingStatusChanged',
57
+    'subject-change': 'subjectChange'
56 58
 };
57 59
 
58 60
 /**
@@ -542,6 +544,9 @@ export default class JitsiMeetExternalAPI extends EventEmitter {
542 544
      * Executes command. The available commands are:
543 545
      * {@code displayName} - Sets the display name of the local participant to
544 546
      * the value passed in the arguments array.
547
+     * {@code subject} - Sets the subject of the conference, the value passed
548
+     * in the arguments array. Note: available only for moderator.
549
+     *
545 550
      * {@code toggleAudio} - Mutes / unmutes audio with no arguments.
546 551
      * {@code toggleVideo} - Mutes / unmutes video with no arguments.
547 552
      * {@code toggleFilmStrip} - Hides / shows the filmstrip with no arguments.

+ 10
- 0
react/features/base/conference/actionTypes.js View File

@@ -119,6 +119,16 @@ export const P2P_STATUS_CHANGED = Symbol('P2P_STATUS_CHANGED');
119 119
  */
120 120
 export const SET_AUDIO_ONLY = Symbol('SET_AUDIO_ONLY');
121 121
 
122
+/**
123
+ * The type of (redux) action, which indicates to set conference subject.
124
+ *
125
+ * {
126
+ *     type: SET_CONFERENCE_SUBJECT
127
+ *     subject: string
128
+ * }
129
+ */
130
+export const SET_CONFERENCE_SUBJECT = Symbol('SET_CONFERENCE_SUBJECT');
131
+
122 132
 /**
123 133
  * The type of (redux) action which sets the desktop sharing enabled flag for
124 134
  * the current conference.

+ 14
- 0
react/features/base/conference/actions.js View File

@@ -33,6 +33,7 @@ import {
33 33
     LOCK_STATE_CHANGED,
34 34
     P2P_STATUS_CHANGED,
35 35
     SET_AUDIO_ONLY,
36
+    SET_CONFERENCE_SUBJECT,
36 37
     SET_DESKTOP_SHARING_ENABLED,
37 38
     SET_FOLLOW_ME,
38 39
     SET_LASTN,
@@ -728,3 +729,16 @@ export function toggleAudioOnly() {
728 729
         return dispatch(setAudioOnly(!audioOnly, true));
729 730
     };
730 731
 }
732
+
733
+/**
734
+ * Changing conference subject.
735
+ *
736
+ * @param {string} subject - The new subject.
737
+ * @returns {void}
738
+ */
739
+export function setSubject(subject: String) {
740
+    return {
741
+        type: SET_CONFERENCE_SUBJECT,
742
+        subject
743
+    };
744
+}

+ 27
- 0
react/features/base/conference/middleware.js View File

@@ -35,6 +35,7 @@ import {
35 35
     CONFERENCE_WILL_LEAVE,
36 36
     DATA_CHANNEL_OPENED,
37 37
     SET_AUDIO_ONLY,
38
+    SET_CONFERENCE_SUBJECT,
38 39
     SET_LASTN,
39 40
     SET_ROOM
40 41
 } from './actionTypes';
@@ -90,6 +91,9 @@ MiddlewareRegistry.register(store => next => action => {
90 91
     case SET_AUDIO_ONLY:
91 92
         return _setAudioOnly(store, next, action);
92 93
 
94
+    case SET_CONFERENCE_SUBJECT:
95
+        return _setSubject(store, next, action);
96
+
93 97
     case SET_LASTN:
94 98
         return _setLastN(store, next, action);
95 99
 
@@ -679,3 +683,26 @@ function _updateLocalParticipantInConference({ getState }, next, action) {
679 683
 
680 684
     return result;
681 685
 }
686
+
687
+/**
688
+ * Changing conference subject.
689
+ *
690
+ * @param {Store} store - The redux store in which the specified {@code action}
691
+ * is being dispatched.
692
+ * @param {Dispatch} next - The redux {@code dispatch} function to dispatch the
693
+ * specified {@code action} to the specified {@code store}.
694
+ * @param {Action} action - The redux action which is being dispatched in the
695
+ * specified {@code store}.
696
+ * @private
697
+ * @returns {Object} The value returned by {@code next(action)}.
698
+ */
699
+function _setSubject({ getState }, next, action) {
700
+    const { conference } = getState()['features/base/conference'];
701
+    const { subject } = action;
702
+
703
+    if (subject) {
704
+        conference.setSubject(subject);
705
+    }
706
+
707
+    return next(action);
708
+}

Loading…
Cancel
Save