Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
jitsi-meet/react/features/analytics/reducer.ts

66 lines
1.4 KiB

import ReducerRegistry from '../base/redux/ReducerRegistry';
import { UPDATE_LOCAL_TRACKS_DURATION } from './actionTypes';
/**
* Initial state.
*/
const DEFAULT_STATE = {
localTracksDuration: {
audio: {
startedTime: -1,
value: 0
},
video: {
camera: {
startedTime: -1,
value: 0
},
desktop: {
startedTime: -1,
value: 0
}
},
conference: {
startedTime: -1,
value: 0
}
}
};
interface IValue {
startedTime: number;
value: number;
}
export interface IAnalyticsState {
localTracksDuration: {
audio: IValue;
conference: IValue;
video: {
camera: IValue;
desktop: IValue;
};
};
}
/**
* Listen for actions which changes the state of the analytics feature.
*
* @param {Object} state - The Redux state of the feature features/analytics.
* @param {Object} action - Action object.
* @param {string} action.type - Type of action.
* @returns {Object}
*/
ReducerRegistry.register<IAnalyticsState>('features/analytics',
(state = DEFAULT_STATE, action): IAnalyticsState => {
switch (action.type) {
case UPDATE_LOCAL_TRACKS_DURATION:
return {
...state,
localTracksDuration: action.localTracksDuration
};
default:
return state;
}
});