Files
jitsi-meet/react/features/base/conference/actions.native.ts
Hristo Terezov 53299a19c2 fix(visitors): Use single GUM for enabling media on promotion.
Before we were using setAudioMuted and setVideoMuted which was effectively using separate GUM calls for audio and video. This was problematic in the case where GUM permissions prompt was displayed because two separate prompts were displayed.
2024-05-07 18:35:05 -05:00

30 lines
935 B
TypeScript

import { IStore } from '../../app/types';
import { setAudioMuted, setVideoMuted } from '../media/actions';
import { MEDIA_TYPE, MediaType, VIDEO_MUTISM_AUTHORITY } from '../media/constants';
export * from './actions.any';
/**
* Starts audio and/or video for the visitor.
*
* @param {Array<MediaType>} mediaTypes - The media types that need to be started.
* @returns {Function}
*/
export function setupVisitorStartupMedia(mediaTypes: Array<MediaType>) {
return (dispatch: IStore['dispatch']) => {
if (!mediaTypes || !Array.isArray(mediaTypes)) {
return;
}
mediaTypes.forEach(mediaType => {
switch (mediaType) {
case MEDIA_TYPE.AUDIO:
dispatch(setAudioMuted(false, true));
break;
case MEDIA_TYPE.VIDEO:
dispatch(setVideoMuted(false, VIDEO_MUTISM_AUTHORITY.USER, true));
}
});
};
}