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
     onStartMutedPolicyChanged,
45
     onStartMutedPolicyChanged,
46
     p2pStatusChanged,
46
     p2pStatusChanged,
47
     sendLocalParticipant,
47
     sendLocalParticipant,
48
-    setDesktopSharingEnabled
48
+    setDesktopSharingEnabled,
49
+    setSubject
49
 } from './react/features/base/conference';
50
 } from './react/features/base/conference';
50
 import {
51
 import {
51
     getAvailableDevices,
52
     getAvailableDevices,
1825
         room.on(JitsiConferenceEvents.TALK_WHILE_MUTED, () => {
1826
         room.on(JitsiConferenceEvents.TALK_WHILE_MUTED, () => {
1826
             APP.UI.showToolbar(6000);
1827
             APP.UI.showToolbar(6000);
1827
         });
1828
         });
1829
+        room.on(JitsiConferenceEvents.SUBJECT_CHANGED,
1830
+            subject => APP.API.notifySubjectChanged(subject));
1828
 
1831
 
1829
         room.on(
1832
         room.on(
1830
             JitsiConferenceEvents.LAST_N_ENDPOINTS_CHANGED,
1833
             JitsiConferenceEvents.LAST_N_ENDPOINTS_CHANGED,
2756
         APP.API.notifyAudioMutedStatusChanged(muted);
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
      * Dispatches the passed in feedback for submission. The submitted score
2773
      * Dispatches the passed in feedback for submission. The submitted score
2761
      * should be a number inclusively between 1 through 5, or -1 for no score.
2774
      * should be a number inclusively between 1 through 5, or -1 for no score.

+ 13
- 0
doc/api.md View File

78
 api.executeCommand('displayName', 'New Nickname');
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
 * **toggleAudio** - Mutes / unmutes the audio for the local participant. No arguments are required.
86
 * **toggleAudio** - Mutes / unmutes the audio for the local participant. No arguments are required.
82
 ```javascript
87
 ```javascript
83
 api.executeCommand('toggleAudio')
88
 api.executeCommand('toggleAudio')
251
 
256
 
252
 * **readyToClose** - event notification fired when Jitsi Meet is ready to be closed (hangup operations are completed).
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
 You can also add multiple event listeners by using `addEventListeners`.
267
 You can also add multiple event listeners by using `addEventListeners`.
255
 This method requires one argument of type Object. The object argument must
268
 This method requires one argument of type Object. The object argument must
256
 have the names of the events as keys and the listeners of the events as values.
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
         'proxy-connection-event': event => {
63
         'proxy-connection-event': event => {
64
             APP.conference.onProxyConnectionEvent(event);
64
             APP.conference.onProxyConnectionEvent(event);
65
         },
65
         },
66
+        'subject': subject => {
67
+            sendAnalytics(createApiEvent('subject.changed'));
68
+            APP.conference.setSubject(subject);
69
+        },
66
         'submit-feedback': feedback => {
70
         'submit-feedback': feedback => {
67
             sendAnalytics(createApiEvent('submit.feedback'));
71
             sendAnalytics(createApiEvent('submit.feedback'));
68
             APP.conference.submitFeedback(feedback.score, feedback.message);
72
             APP.conference.submitFeedback(feedback.score, feedback.message);
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
      * Disposes the allocated resources.
573
      * Disposes the allocated resources.
556
      *
574
      *

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

23
     displayName: 'display-name',
23
     displayName: 'display-name',
24
     email: 'email',
24
     email: 'email',
25
     hangup: 'video-hangup',
25
     hangup: 'video-hangup',
26
+    subject: 'subject',
26
     submitFeedback: 'submit-feedback',
27
     submitFeedback: 'submit-feedback',
27
     toggleAudio: 'toggle-audio',
28
     toggleAudio: 'toggle-audio',
28
     toggleChat: 'toggle-chat',
29
     toggleChat: 'toggle-chat',
52
     'video-conference-left': 'videoConferenceLeft',
53
     'video-conference-left': 'videoConferenceLeft',
53
     'video-availability-changed': 'videoAvailabilityChanged',
54
     'video-availability-changed': 'videoAvailabilityChanged',
54
     'video-mute-status-changed': 'videoMuteStatusChanged',
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
      * Executes command. The available commands are:
544
      * Executes command. The available commands are:
543
      * {@code displayName} - Sets the display name of the local participant to
545
      * {@code displayName} - Sets the display name of the local participant to
544
      * the value passed in the arguments array.
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
      * {@code toggleAudio} - Mutes / unmutes audio with no arguments.
550
      * {@code toggleAudio} - Mutes / unmutes audio with no arguments.
546
      * {@code toggleVideo} - Mutes / unmutes video with no arguments.
551
      * {@code toggleVideo} - Mutes / unmutes video with no arguments.
547
      * {@code toggleFilmStrip} - Hides / shows the filmstrip with no arguments.
552
      * {@code toggleFilmStrip} - Hides / shows the filmstrip with no arguments.

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

119
  */
119
  */
120
 export const SET_AUDIO_ONLY = Symbol('SET_AUDIO_ONLY');
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
  * The type of (redux) action which sets the desktop sharing enabled flag for
133
  * The type of (redux) action which sets the desktop sharing enabled flag for
124
  * the current conference.
134
  * the current conference.

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

33
     LOCK_STATE_CHANGED,
33
     LOCK_STATE_CHANGED,
34
     P2P_STATUS_CHANGED,
34
     P2P_STATUS_CHANGED,
35
     SET_AUDIO_ONLY,
35
     SET_AUDIO_ONLY,
36
+    SET_CONFERENCE_SUBJECT,
36
     SET_DESKTOP_SHARING_ENABLED,
37
     SET_DESKTOP_SHARING_ENABLED,
37
     SET_FOLLOW_ME,
38
     SET_FOLLOW_ME,
38
     SET_LASTN,
39
     SET_LASTN,
728
         return dispatch(setAudioOnly(!audioOnly, true));
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
     CONFERENCE_WILL_LEAVE,
35
     CONFERENCE_WILL_LEAVE,
36
     DATA_CHANNEL_OPENED,
36
     DATA_CHANNEL_OPENED,
37
     SET_AUDIO_ONLY,
37
     SET_AUDIO_ONLY,
38
+    SET_CONFERENCE_SUBJECT,
38
     SET_LASTN,
39
     SET_LASTN,
39
     SET_ROOM
40
     SET_ROOM
40
 } from './actionTypes';
41
 } from './actionTypes';
90
     case SET_AUDIO_ONLY:
91
     case SET_AUDIO_ONLY:
91
         return _setAudioOnly(store, next, action);
92
         return _setAudioOnly(store, next, action);
92
 
93
 
94
+    case SET_CONFERENCE_SUBJECT:
95
+        return _setSubject(store, next, action);
96
+
93
     case SET_LASTN:
97
     case SET_LASTN:
94
         return _setLastN(store, next, action);
98
         return _setLastN(store, next, action);
95
 
99
 
679
 
683
 
680
     return result;
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