mirror of
https://gitcode.com/GitHub_Trending/ji/jitsi-meet.git
synced 2026-05-19 19:57:47 +00:00
ref(TS) Convert some features to TS (#12469)
This commit is contained in:
36
react/features/shared-video/middleware.web.ts
Normal file
36
react/features/shared-video/middleware.web.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import { CONFERENCE_JOIN_IN_PROGRESS } from '../base/conference/actionTypes';
|
||||
import { getLocalParticipant } from '../base/participants/functions';
|
||||
import MiddlewareRegistry from '../base/redux/MiddlewareRegistry';
|
||||
|
||||
import { setDisableButton } from './actions.web';
|
||||
import { SHARED_VIDEO } from './constants';
|
||||
|
||||
import './middleware.any';
|
||||
|
||||
MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {
|
||||
const state = getState();
|
||||
const localParticipantId = getLocalParticipant(state)?.id;
|
||||
|
||||
switch (action.type) {
|
||||
case CONFERENCE_JOIN_IN_PROGRESS: {
|
||||
const { conference } = action;
|
||||
|
||||
conference.addCommandListener(SHARED_VIDEO, ({ attributes }: { attributes:
|
||||
{ from: string; state: string; }; }) => {
|
||||
const { from } = attributes;
|
||||
const status = attributes.state;
|
||||
|
||||
if (status === 'playing') {
|
||||
if (localParticipantId !== from) {
|
||||
dispatch(setDisableButton(true));
|
||||
}
|
||||
} else if (status === 'stop') {
|
||||
dispatch(setDisableButton(false));
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return next(action);
|
||||
});
|
||||
Reference in New Issue
Block a user