Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
Adds setting subject and adding event on receiving such change.
damenchofc129d9849ca
diff --git a/conference.js b/conference.jsindex e14cb6e23a..d350e2e072 100644--- a/conference.js+++ b/conference.js@@ -45,7 +45,8 @@ import {onStartMutedPolicyChanged,p2pStatusChanged,sendLocalParticipant,- setDesktopSharingEnabled+ setDesktopSharingEnabled,+ setSubject} from './react/features/base/conference';import {getAvailableDevices,@@ -1825,6 +1826,8 @@ export default {room.on(JitsiConferenceEvents.TALK_WHILE_MUTED, () => {APP.UI.showToolbar(6000);});+ room.on(JitsiConferenceEvents.SUBJECT_CHANGED,+ subject => APP.API.notifySubjectChanged(subject));room.on(JitsiConferenceEvents.LAST_N_ENDPOINTS_CHANGED,@@ -2756,6 +2759,16 @@ export default {APP.API.notifyAudioMutedStatusChanged(muted);},+ /**+ * Changes the subject of the conference.+ * Note: available only for moderator.+ *+ * @param subject {string} the new subject for the conference.+ */+ setSubject(subject) {+ APP.store.dispatch(setSubject(subject));+ },+/*** Dispatches the passed in feedback for submission. The submitted score* should be a number inclusively between 1 through 5, or -1 for no score.diff --git a/doc/api.md b/doc/api.mdindex 4fab09a5cc..7670030bef 100644--- a/doc/api.md+++ b/doc/api.md@@ -78,6 +78,11 @@ The `command` parameter is String object with the name of the command. The folloapi.executeCommand('displayName', 'New Nickname');```+* **subject** - Sets the subject of the conference. This command requires one argument - the new subject to be set.+```javascript+api.executeCommand('subject', 'New Conference Subject');+```+* **toggleAudio** - Mutes / unmutes the audio for the local participant. No arguments are required.```javascriptapi.executeCommand('toggleAudio')@@ -251,6 +256,14 @@ changes. The listener will receive an object with the following structure:* **readyToClose** - event notification fired when Jitsi Meet is ready to be closed (hangup operations are completed).+* **subjectChange** - event notifications about subject of conference changes.+The listener will receive an object with the following structure:+```javascript+{+"subject": subject // the new subject+}+```+You can also add multiple event listeners by using `addEventListeners`.This method requires one argument of type Object. The object argument musthave the names of the events as keys and the listeners of the events as values.diff --git a/modules/API/API.js b/modules/API/API.jsindex 4740dc0265..51a60b74c2 100644--- a/modules/API/API.js+++ b/modules/API/API.js@@ -63,6 +63,10 @@ function initCommands() {'proxy-connection-event': event => {APP.conference.onProxyConnectionEvent(event);},+ 'subject': subject => {+ sendAnalytics(createApiEvent('subject.changed'));+ APP.conference.setSubject(subject);+ },'submit-feedback': feedback => {sendAnalytics(createApiEvent('submit.feedback'));APP.conference.submitFeedback(feedback.score, feedback.message);@@ -551,6 +555,20 @@ class API {});}+ /**+ * Notify external application (if API is enabled) that the conference+ * changed their subject.+ *+ * @param {string} subject - Conference subject.+ * @returns {void}+ */+ notifySubjectChanged(subject: string) {+ this._sendEvent({+ name: 'subject-change',+ subject+ });+ }+/*** Disposes the allocated resources.*diff --git a/modules/API/external/external_api.js b/modules/API/external/external_api.jsindex 92e17626e1..8d1dbb481f 100644--- a/modules/API/external/external_api.js+++ b/modules/API/external/external_api.js@@ -23,6 +23,7 @@ const commands = {displayName: 'display-name',email: 'email',hangup: 'video-hangup',+ subject: 'subject',submitFeedback: 'submit-feedback',toggleAudio: 'toggle-audio',toggleChat: 'toggle-chat',@@ -52,7 +53,8 @@ const events = {'video-conference-left': 'videoConferenceLeft','video-availability-changed': 'videoAvailabilityChanged','video-mute-status-changed': 'videoMuteStatusChanged',- 'screen-sharing-status-changed': 'screenSharingStatusChanged'+ 'screen-sharing-status-changed': 'screenSharingStatusChanged',+ 'subject-change': 'subjectChange'};/**@@ -542,6 +544,9 @@ export default class JitsiMeetExternalAPI extends EventEmitter {* Executes command. The available commands are:* {@code displayName} - Sets the display name of the local participant to* the value passed in the arguments array.+ * {@code subject} - Sets the subject of the conference, the value passed+ * in the arguments array. Note: available only for moderator.+ ** {@code toggleAudio} - Mutes / unmutes audio with no arguments.* {@code toggleVideo} - Mutes / unmutes video with no arguments.* {@code toggleFilmStrip} - Hides / shows the filmstrip with no arguments.diff --git a/react/features/base/conference/actionTypes.js b/react/features/base/conference/actionTypes.jsindex 39aa715bc7..e28c01dd96 100644--- a/react/features/base/conference/actionTypes.js+++ b/react/features/base/conference/actionTypes.js@@ -119,6 +119,16 @@ export const P2P_STATUS_CHANGED = Symbol('P2P_STATUS_CHANGED');*/export const SET_AUDIO_ONLY = Symbol('SET_AUDIO_ONLY');+/**+ * The type of (redux) action, which indicates to set conference subject.+ *+ * {+ * type: SET_CONFERENCE_SUBJECT+ * subject: string+ * }+ */+export const SET_CONFERENCE_SUBJECT = Symbol('SET_CONFERENCE_SUBJECT');+/*** The type of (redux) action which sets the desktop sharing enabled flag for* the current conference.diff --git a/react/features/base/conference/actions.js b/react/features/base/conference/actions.jsindex 6f5beb694c..31158b5858 100644--- a/react/features/base/conference/actions.js+++ b/react/features/base/conference/actions.js@@ -33,6 +33,7 @@ import {LOCK_STATE_CHANGED,P2P_STATUS_CHANGED,SET_AUDIO_ONLY,+ SET_CONFERENCE_SUBJECT,SET_DESKTOP_SHARING_ENABLED,SET_FOLLOW_ME,SET_LASTN,@@ -728,3 +729,16 @@ export function toggleAudioOnly() {return dispatch(setAudioOnly(!audioOnly, true));};}++/**+ * Changing conference subject.+ *+ * @param {string} subject - The new subject.+ * @returns {void}+ */+export function setSubject(subject: String) {+ return {+ type: SET_CONFERENCE_SUBJECT,+ subject+ };+}diff --git a/react/features/base/conference/middleware.js b/react/features/base/conference/middleware.jsindex 2a3d571b11..134df915a0 100644--- a/react/features/base/conference/middleware.js+++ b/react/features/base/conference/middleware.js@@ -35,6 +35,7 @@ import {CONFERENCE_WILL_LEAVE,DATA_CHANNEL_OPENED,SET_AUDIO_ONLY,+ SET_CONFERENCE_SUBJECT,SET_LASTN,SET_ROOM} from './actionTypes';@@ -90,6 +91,9 @@ MiddlewareRegistry.register(store => next => action => {case SET_AUDIO_ONLY:return _setAudioOnly(store, next, action);+ case SET_CONFERENCE_SUBJECT:+ return _setSubject(store, next, action);+case SET_LASTN:return _setLastN(store, next, action);@@ -679,3 +683,26 @@ function _updateLocalParticipantInConference({ getState }, next, action) {return result;}++/**+ * Changing conference subject.+ *+ * @param {Store} store - The redux store in which the specified {@code action}+ * is being dispatched.+ * @param {Dispatch} next - The redux {@code dispatch} function to dispatch the+ * specified {@code action} to the specified {@code store}.+ * @param {Action} action - The redux action which is being dispatched in the+ * specified {@code store}.+ * @private+ * @returns {Object} The value returned by {@code next(action)}.+ */+function _setSubject({ getState }, next, action) {+ const { conference } = getState()['features/base/conference'];+ const { subject } = action;++ if (subject) {+ conference.setSubject(subject);+ }++ return next(action);+}