mirror of
https://gitcode.com/GitHub_Trending/ji/jitsi-meet.git
synced 2025-12-30 11:22:31 +00:00
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.
30 lines
935 B
TypeScript
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));
|
|
}
|
|
});
|
|
};
|
|
}
|