mirror of
https://gitcode.com/GitHub_Trending/ji/jitsi-meet.git
synced 2025-12-30 11:22:31 +00:00
* feat(shared-video): Shows confirmation dialog before playing video. * feat(shared-video/native): created ShareVideoConfirmDialog and unified actions * squash: Simplifies state and fixes stop and then start scenario. * squash: Use constants everywhere. * squash: Use helper function. * squash: Ignore any command with not matching video URL. --------- Co-authored-by: Calin-Teodor <calin.chitu@8x8.com>
42 lines
1.3 KiB
TypeScript
42 lines
1.3 KiB
TypeScript
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 { PLAYBACK_STATUSES, SHARED_VIDEO } from './constants';
|
|
import { isSharedVideoEnabled } from './functions';
|
|
|
|
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: {
|
|
if (!isSharedVideoEnabled(state)) {
|
|
break;
|
|
}
|
|
|
|
const { conference } = action;
|
|
|
|
conference.addCommandListener(SHARED_VIDEO, ({ attributes }: { attributes:
|
|
{ from: string; state: string; }; }) => {
|
|
const { from } = attributes;
|
|
const status = attributes.state;
|
|
|
|
if (status === PLAYBACK_STATUSES.PLAYING) {
|
|
if (localParticipantId !== from) {
|
|
dispatch(setDisableButton(true));
|
|
}
|
|
} else if (status === 'stop') {
|
|
dispatch(setDisableButton(false));
|
|
}
|
|
});
|
|
break;
|
|
}
|
|
}
|
|
|
|
return next(action);
|
|
});
|