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/virtual-background/middleware.js

27 lines
932 B

// @flow
import { VIDEO_TYPE } from '../base/media';
import { MiddlewareRegistry } from '../base/redux';
import { getLocalVideoTrack } from '../base/tracks';
import { localTrackStopped } from './functions';
/**
* Middleware which intercepts the desktop video type on
* virtual background. If the user stops the screen share
* then the default virtual background is set to 'none' option
*
* @param {Store} store - The redux store.
* @returns {Function}
*/
MiddlewareRegistry.register(store => next => action => {
const { dispatch, getState } = store;
const virtualSource = getState()['features/virtual-background'].virtualSource;
const currentLocalTrack = getLocalVideoTrack(getState()['features/base/tracks']);
if (virtualSource?.videoType === VIDEO_TYPE.DESKTOP && currentLocalTrack) {
localTrackStopped(dispatch, virtualSource, currentLocalTrack.jitsiTrack);
}
return next(action);
});