2022-09-01 08:32:01 +00:00
|
|
|
import ReducerRegistry from '../base/redux/ReducerRegistry';
|
2018-03-07 00:28:19 +00:00
|
|
|
|
2022-09-27 07:10:28 +00:00
|
|
|
import { RESET_SHARED_VIDEO_STATUS, SET_DISABLE_BUTTON, SET_SHARED_VIDEO_STATUS } from './actionTypes';
|
2021-04-16 09:43:34 +00:00
|
|
|
|
|
|
|
const initialState = {};
|
2018-03-07 00:28:19 +00:00
|
|
|
|
2022-09-01 08:32:01 +00:00
|
|
|
export interface ISharedVideoState {
|
|
|
|
disabled?: boolean;
|
|
|
|
muted?: boolean;
|
|
|
|
ownerId?: string;
|
|
|
|
status?: string;
|
|
|
|
time?: number;
|
|
|
|
videoUrl?: string;
|
|
|
|
volume?: number;
|
|
|
|
}
|
|
|
|
|
2018-03-07 00:28:19 +00:00
|
|
|
/**
|
|
|
|
* Reduces the Redux actions of the feature features/shared-video.
|
|
|
|
*/
|
2022-09-05 09:05:07 +00:00
|
|
|
ReducerRegistry.register<ISharedVideoState>('features/shared-video',
|
|
|
|
(state = initialState, action): ISharedVideoState => {
|
2022-09-01 08:32:01 +00:00
|
|
|
const { videoUrl, status, time, ownerId, disabled, muted, volume } = action;
|
2021-03-03 14:37:38 +00:00
|
|
|
|
2018-03-07 00:28:19 +00:00
|
|
|
switch (action.type) {
|
2021-04-16 09:43:34 +00:00
|
|
|
case RESET_SHARED_VIDEO_STATUS:
|
|
|
|
return initialState;
|
2018-03-07 00:28:19 +00:00
|
|
|
case SET_SHARED_VIDEO_STATUS:
|
|
|
|
return {
|
|
|
|
...state,
|
2021-04-16 09:43:34 +00:00
|
|
|
muted,
|
|
|
|
ownerId,
|
|
|
|
status,
|
|
|
|
time,
|
2022-09-01 08:32:01 +00:00
|
|
|
videoUrl,
|
|
|
|
volume
|
2021-03-03 14:37:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
case SET_DISABLE_BUTTON:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
disabled
|
2018-03-07 00:28:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
default:
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
});
|