feat: Add webcam basic support
This commit is contained in:
@@ -10,7 +10,8 @@ import {
|
||||
User,
|
||||
BanEntry,
|
||||
VoiceState,
|
||||
ScreenShareState
|
||||
ScreenShareState,
|
||||
CameraState
|
||||
} from '../../shared-kernel';
|
||||
|
||||
export const UsersActions = createActionGroup({
|
||||
@@ -52,6 +53,7 @@ export const UsersActions = createActionGroup({
|
||||
'Update Host': props<{ userId: string }>(),
|
||||
|
||||
'Update Voice State': props<{ userId: string; voiceState: Partial<VoiceState> }>(),
|
||||
'Update Screen Share State': props<{ userId: string; screenShareState: Partial<ScreenShareState> }>()
|
||||
'Update Screen Share State': props<{ userId: string; screenShareState: Partial<ScreenShareState> }>(),
|
||||
'Update Camera State': props<{ userId: string; cameraState: Partial<CameraState> }>()
|
||||
}
|
||||
});
|
||||
|
||||
@@ -212,6 +212,23 @@ export const usersReducer = createReducer(
|
||||
state
|
||||
);
|
||||
}),
|
||||
on(UsersActions.updateCameraState, (state, { userId, cameraState }) => {
|
||||
const prev = state.entities[userId]?.cameraState || {
|
||||
isEnabled: false
|
||||
};
|
||||
|
||||
return usersAdapter.updateOne(
|
||||
{
|
||||
id: userId,
|
||||
changes: {
|
||||
cameraState: {
|
||||
isEnabled: cameraState.isEnabled ?? prev.isEnabled
|
||||
}
|
||||
}
|
||||
},
|
||||
state
|
||||
);
|
||||
}),
|
||||
on(UsersActions.syncUsers, (state, { users }) =>
|
||||
usersAdapter.upsertMany(users, state)
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user