2022-09-27 07:10:28 +00:00
|
|
|
import { MEDIA_TYPE, VIDEO_MUTISM_AUTHORITY, setVideoMuted } from '../base/media';
|
2022-05-06 10:14:10 +00:00
|
|
|
import { MiddlewareRegistry } from '../base/redux';
|
2022-08-16 11:56:47 +00:00
|
|
|
import { CLIENT_RESIZED } from '../base/responsive-ui';
|
|
|
|
import { setLargeVideoDimensions } from '../large-video/actions.any';
|
2022-05-06 10:14:10 +00:00
|
|
|
|
|
|
|
import { SET_CAR_MODE } from './actionTypes';
|
2018-11-28 19:36:23 +00:00
|
|
|
import './middleware.any';
|
2022-05-06 10:14:10 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Middleware which intercepts actions and updates the legacy component.
|
|
|
|
*
|
|
|
|
* @param {Store} store - The redux store.
|
|
|
|
* @returns {Function}
|
|
|
|
*/
|
|
|
|
MiddlewareRegistry.register(store => next => action => {
|
|
|
|
const result = next(action);
|
|
|
|
const { dispatch } = store;
|
|
|
|
|
|
|
|
switch (action.type) {
|
|
|
|
case SET_CAR_MODE:
|
|
|
|
dispatch(setVideoMuted(action.enabled, MEDIA_TYPE.VIDEO, VIDEO_MUTISM_AUTHORITY.CAR_MODE));
|
|
|
|
break;
|
2022-08-16 11:56:47 +00:00
|
|
|
case CLIENT_RESIZED: {
|
|
|
|
const { clientHeight, clientWidth } = store.getState()['features/base/responsive-ui'];
|
|
|
|
|
|
|
|
// On mobile the large video should always fill the screen.
|
|
|
|
dispatch(setLargeVideoDimensions(clientHeight, clientWidth));
|
|
|
|
break;
|
|
|
|
}
|
2022-05-06 10:14:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
});
|