feat(api): expose method for playing touch tones (#4584)
This commit is contained in:
@@ -118,6 +118,18 @@ export const LOCK_STATE_CHANGED = 'LOCK_STATE_CHANGED';
|
||||
*/
|
||||
export const P2P_STATUS_CHANGED = 'P2P_STATUS_CHANGED';
|
||||
|
||||
/**
|
||||
* The type of (redux) action which signals to play specified touch tones.
|
||||
*
|
||||
* {
|
||||
* type: SEND_TONES,
|
||||
* tones: string,
|
||||
* duration: number,
|
||||
* pause: number
|
||||
* }
|
||||
*/
|
||||
export const SEND_TONES = 'SEND_TONES';
|
||||
|
||||
/**
|
||||
* The type of (redux) action which sets the desktop sharing enabled flag for
|
||||
* the current conference.
|
||||
|
||||
@@ -37,6 +37,7 @@ import {
|
||||
KICKED_OUT,
|
||||
LOCK_STATE_CHANGED,
|
||||
P2P_STATUS_CHANGED,
|
||||
SEND_TONES,
|
||||
SET_DESKTOP_SHARING_ENABLED,
|
||||
SET_FOLLOW_ME,
|
||||
SET_MAX_RECEIVER_VIDEO_QUALITY,
|
||||
@@ -520,6 +521,28 @@ export function p2pStatusChanged(p2p: boolean) {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Signals to play touch tones.
|
||||
*
|
||||
* @param {string} tones - The tones to play.
|
||||
* @param {number} [duration] - How long to play each tone.
|
||||
* @param {number} [pause] - How long to pause between each tone.
|
||||
* @returns {{
|
||||
* type: SEND_TONES,
|
||||
* tones: string,
|
||||
* duration: number,
|
||||
* pause: number
|
||||
* }}
|
||||
*/
|
||||
export function sendTones(tones: string, duration: number, pause: number) {
|
||||
return {
|
||||
type: SEND_TONES,
|
||||
tones,
|
||||
duration,
|
||||
pause
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the flag for indicating if desktop sharing is enabled.
|
||||
*
|
||||
|
||||
@@ -35,6 +35,7 @@ import {
|
||||
CONFERENCE_SUBJECT_CHANGED,
|
||||
CONFERENCE_WILL_LEAVE,
|
||||
DATA_CHANNEL_OPENED,
|
||||
SEND_TONES,
|
||||
SET_PENDING_SUBJECT_CHANGE,
|
||||
SET_ROOM
|
||||
} from './actionTypes';
|
||||
@@ -89,6 +90,9 @@ MiddlewareRegistry.register(store => next => action => {
|
||||
case PIN_PARTICIPANT:
|
||||
return _pinParticipant(store, next, action);
|
||||
|
||||
case SEND_TONES:
|
||||
return _sendTones(store, next, action);
|
||||
|
||||
case SET_ROOM:
|
||||
return _setRoom(store, next, action);
|
||||
|
||||
@@ -446,6 +450,31 @@ function _pinParticipant({ getState }, next, action) {
|
||||
return next(action);
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests the specified tones to be played.
|
||||
*
|
||||
* @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 {@code SEND_TONES} which is
|
||||
* being dispatched in the specified {@code store}.
|
||||
* @private
|
||||
* @returns {Object} The value returned by {@code next(action)}.
|
||||
*/
|
||||
function _sendTones({ getState }, next, action) {
|
||||
const state = getState();
|
||||
const { conference } = state['features/base/conference'];
|
||||
|
||||
if (conference) {
|
||||
const { duration, tones, pause } = action;
|
||||
|
||||
conference.sendTones(tones, duration, pause);
|
||||
}
|
||||
|
||||
return next(action);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function for updating the preferred receiver video constraint, based
|
||||
* on the user preference and the internal maximum.
|
||||
|
||||
Reference in New Issue
Block a user