feat(audio-recording): Handles conference properties sent from jicofo and play notification.

When audio-recording is enabled server-side play the recording audio and visual notification.
This commit is contained in:
damencho
2024-10-28 12:24:42 -05:00
committed by Дамян Минков
parent aa506a7607
commit 04bee97682
10 changed files with 106 additions and 55 deletions

View File

@@ -82,6 +82,19 @@ export const CONFERENCE_FOCUSED = 'CONFERENCE_FOCUSED';
*/
export const CONFERENCE_LOCAL_SUBJECT_CHANGED = 'CONFERENCE_LOCAL_SUBJECT_CHANGED';
/**
* The type of (redux) action, which indicates conference properties change.
*
* {
* type: CONFERENCE_PROPERTIES_CHANGED
* properties: {
* audio-recording-enabled: boolean,
* visitor-count: number
* }
* }
*/
export const CONFERENCE_PROPERTIES_CHANGED = 'CONFERENCE_PROPERTIES_CHANGED';
/**
* The type of (redux) action, which indicates conference subject changes.
*

View File

@@ -45,6 +45,7 @@ import {
CONFERENCE_JOIN_IN_PROGRESS,
CONFERENCE_LEFT,
CONFERENCE_LOCAL_SUBJECT_CHANGED,
CONFERENCE_PROPERTIES_CHANGED,
CONFERENCE_SUBJECT_CHANGED,
CONFERENCE_TIMESTAMP_CHANGED,
CONFERENCE_UNIQUE_ID_SET,
@@ -156,6 +157,10 @@ function _addConferenceListeners(conference: IJitsiConference, dispatch: IStore[
JitsiConferenceEvents.LOCK_STATE_CHANGED,
(locked: boolean) => dispatch(lockStateChanged(conference, locked)));
conference.on(
JitsiConferenceEvents.PROPERTIES_CHANGED,
(properties: Object) => dispatch(conferencePropertiesChanged(properties)));
// Dispatches into features/base/media follow:
conference.on(
@@ -449,6 +454,23 @@ export function conferenceLeft(conference?: IJitsiConference) {
};
}
/**
* Signals that the conference properties have been changed.
*
* @param {Object} properties - The new properties set.
* @returns {{
* type: CONFERENCE_PROPERTIES_CHANGED,
* properties: Object
* }}
*/
export function conferencePropertiesChanged(properties: object) {
return {
type: CONFERENCE_PROPERTIES_CHANGED,
properties
};
}
/**
* Signals that the conference subject has been changed.
*

View File

@@ -393,6 +393,19 @@ export function isP2pActive(stateful: IStateful): boolean | null {
return conference.isP2PActive();
}
/**
* Returns whether the current conference has audio recording property which is on.
*
* @param {IStateful} stateful - The redux store, state, or {@code getState} function.
* @returns {boolean|null}
*/
export function isConferenceAudioRecordingOn(stateful: IStateful): boolean | null {
const state = getConferenceState(toState(stateful));
// @ts-ignore
return state.properties?.['audio-recording-enabled'] === 'true';
}
/**
* Returns the stored room name.
*

View File

@@ -8,7 +8,7 @@ import { IConfig } from '../config/configType';
import { CONNECTION_WILL_CONNECT, SET_LOCATION_URL } from '../connection/actionTypes';
import { JitsiConferenceErrors } from '../lib-jitsi-meet';
import ReducerRegistry from '../redux/ReducerRegistry';
import { assign, set } from '../redux/functions';
import { assign, equals, set } from '../redux/functions';
import {
AUTH_STATUS_CHANGED,
@@ -16,6 +16,7 @@ import {
CONFERENCE_JOINED,
CONFERENCE_LEFT,
CONFERENCE_LOCAL_SUBJECT_CHANGED,
CONFERENCE_PROPERTIES_CHANGED,
CONFERENCE_SUBJECT_CHANGED,
CONFERENCE_TIMESTAMP_CHANGED,
CONFERENCE_WILL_JOIN,
@@ -48,7 +49,8 @@ const DEFAULT_STATE = {
membersOnly: undefined,
metadata: undefined,
password: undefined,
passwordRequired: undefined
passwordRequired: undefined,
properties: undefined
};
export interface IConferenceMetadata {
@@ -176,6 +178,7 @@ export interface IConferenceState {
password?: string;
passwordRequired?: IJitsiConference;
pendingSubjectChange?: string;
properties?: object;
room?: string;
startAudioMutedPolicy?: boolean;
startReactionsMuted?: boolean;
@@ -220,6 +223,9 @@ ReducerRegistry.register<IConferenceState>('features/base/conference',
case CONFERENCE_LOCAL_SUBJECT_CHANGED:
return set(state, 'localSubject', action.localSubject);
case CONFERENCE_PROPERTIES_CHANGED:
return _conferencePropertiesChanged(state, action);
case CONFERENCE_TIMESTAMP_CHANGED:
return set(state, 'conferenceTimestamp', action.conferenceTimestamp);
@@ -518,6 +524,26 @@ function _conferenceLeftOrWillLeave(state: IConferenceState, { conference, type
return nextState;
}
/**
* Reduces a specific Redux action CONFERENCE_PROPERTIES_CHANGED of the feature
* base/conference.
*
* @param {Object} state - The Redux state of the feature base/conference.
* @param {Action} action - The Redux action CONFERENCE_PROPERTIES_CHANGED to reduce.
* @private
* @returns {Object} The new state of the feature base/conference after the
* reduction of the specified action.
*/
function _conferencePropertiesChanged(state: IConferenceState, { properties }: { properties: Object; }) {
if (!equals(state.properties, properties)) {
return assign(state, {
properties
});
}
return state;
}
/**
* Reduces a specific Redux action CONFERENCE_WILL_JOIN of the feature
* base/conference.