Add participantRoleChanged event to external API (#6573)
* Add participantRoleChanged event to external API * Update API documentation * Remove unneeded whitespace * Remove more unneeded whitespace * Fix jsdoc formatting * Fix jsdoc formatting
This commit is contained in:
parent
a18fd1cdb3
commit
acbf641fb4
|
@ -2093,6 +2093,7 @@ export default {
|
||||||
logger.info(`My role changed, new role: ${role}`);
|
logger.info(`My role changed, new role: ${role}`);
|
||||||
|
|
||||||
APP.store.dispatch(localParticipantRoleChanged(role));
|
APP.store.dispatch(localParticipantRoleChanged(role));
|
||||||
|
APP.API.notifyUserRoleChanged(id, role);
|
||||||
} else {
|
} else {
|
||||||
APP.store.dispatch(participantRoleChanged(id, role));
|
APP.store.dispatch(participantRoleChanged(id, role));
|
||||||
}
|
}
|
||||||
|
|
|
@ -465,6 +465,14 @@ changes. The listener will receive an object with the following structure:
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
* **participantRoleChanged** - event notification fired when the role of the local user has changed (none, moderator, participant). The listener will receive an object with the following structure:
|
||||||
|
```javascript
|
||||||
|
{
|
||||||
|
id: string // the id of the participant
|
||||||
|
role: string // the new role of the participant
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
* **passwordRequired** - event notifications fired when failing to join a room because it has a password.
|
* **passwordRequired** - event notifications fired when failing to join a room because it has a password.
|
||||||
|
|
||||||
* **videoConferenceJoined** - event notifications fired when the local user has joined the video conference. The listener will receive an object with the following structure:
|
* **videoConferenceJoined** - event notifications fired when the local user has joined the video conference. The listener will receive an object with the following structure:
|
||||||
|
|
|
@ -439,6 +439,22 @@ class API {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notify external application (if API is enabled) that the user role
|
||||||
|
* has changed.
|
||||||
|
*
|
||||||
|
* @param {string} id - User id.
|
||||||
|
* @param {string} role - The new user role.
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
notifyUserRoleChanged(id: string, role: string) {
|
||||||
|
this._sendEvent({
|
||||||
|
name: 'participant-role-changed',
|
||||||
|
id,
|
||||||
|
role
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notify external application (if API is enabled) that user changed their
|
* Notify external application (if API is enabled) that user changed their
|
||||||
* avatar.
|
* avatar.
|
||||||
|
|
|
@ -67,6 +67,7 @@ const events = {
|
||||||
'participant-joined': 'participantJoined',
|
'participant-joined': 'participantJoined',
|
||||||
'participant-kicked-out': 'participantKickedOut',
|
'participant-kicked-out': 'participantKickedOut',
|
||||||
'participant-left': 'participantLeft',
|
'participant-left': 'participantLeft',
|
||||||
|
'participant-role-changed': 'participantRoleChanged',
|
||||||
'password-required': 'passwordRequired',
|
'password-required': 'passwordRequired',
|
||||||
'proxy-connection-event': 'proxyConnectionEvent',
|
'proxy-connection-event': 'proxyConnectionEvent',
|
||||||
'video-ready-to-close': 'readyToClose',
|
'video-ready-to-close': 'readyToClose',
|
||||||
|
|
|
@ -57,6 +57,19 @@ export const PARTICIPANT_DISPLAY_NAME_CHANGED
|
||||||
*/
|
*/
|
||||||
export const PARTICIPANT_ID_CHANGED = 'PARTICIPANT_ID_CHANGED';
|
export const PARTICIPANT_ID_CHANGED = 'PARTICIPANT_ID_CHANGED';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Action to signal that participant role has changed. e.
|
||||||
|
*
|
||||||
|
* {
|
||||||
|
* type: PARTICIPANT_ROLE_CHANGED,
|
||||||
|
* participant: {
|
||||||
|
* id: string
|
||||||
|
* }
|
||||||
|
* role: string
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
export const PARTICIPANT_ROLE_CHANGED = 'PARTICIPANT_ROLE_CHANGED';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Action to signal that a participant has joined.
|
* Action to signal that a participant has joined.
|
||||||
*
|
*
|
||||||
|
|
|
@ -12,6 +12,7 @@ import {
|
||||||
PARTICIPANT_KICKED,
|
PARTICIPANT_KICKED,
|
||||||
PARTICIPANT_LEFT,
|
PARTICIPANT_LEFT,
|
||||||
PARTICIPANT_JOINED,
|
PARTICIPANT_JOINED,
|
||||||
|
PARTICIPANT_ROLE_CHANGED,
|
||||||
SET_LOADABLE_AVATAR_URL,
|
SET_LOADABLE_AVATAR_URL,
|
||||||
getLocalParticipant,
|
getLocalParticipant,
|
||||||
getParticipantById
|
getParticipantById
|
||||||
|
@ -157,6 +158,10 @@ MiddlewareRegistry.register(store => next => action => {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case PARTICIPANT_ROLE_CHANGED:
|
||||||
|
APP.API.notifyUserRoleChanged(action.participant.id, action.participant.role);
|
||||||
|
break;
|
||||||
|
|
||||||
case SET_FILMSTRIP_VISIBLE:
|
case SET_FILMSTRIP_VISIBLE:
|
||||||
APP.API.notifyFilmstripDisplayChanged(action.visible);
|
APP.API.notifyFilmstripDisplayChanged(action.visible);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue