2023-03-28 05:40:08 +08:00
|
|
|
import { isScreenBroadcasting, isCameraAsContentBroadcasting } from '/imports/ui/components/screenshare/service';
|
2018-09-14 02:09:30 +08:00
|
|
|
import getFromUserSettings from '/imports/ui/services/users-settings';
|
2023-06-17 04:48:52 +08:00
|
|
|
import {
|
2023-11-29 21:22:59 +08:00
|
|
|
isScreenSharingEnabled, isCameraAsContentEnabled, isPresentationEnabled,
|
2023-06-17 04:48:52 +08:00
|
|
|
} from '/imports/ui/services/features';
|
2021-07-17 02:42:16 +08:00
|
|
|
import { ACTIONS } from '../layout/enums';
|
2022-06-23 21:05:11 +08:00
|
|
|
import UserService from '/imports/ui/components/user-list/service';
|
2023-02-17 23:44:36 +08:00
|
|
|
import VideoStreams from '/imports/api/video-streams';
|
|
|
|
import Auth from '/imports/ui/services/auth/index';
|
2016-05-31 06:07:02 +08:00
|
|
|
|
2024-03-07 01:28:18 +08:00
|
|
|
const LAYOUT_CONFIG = window.meetingClientSettings.public.layout;
|
|
|
|
const KURENTO_CONFIG = window.meetingClientSettings.public.kurento;
|
|
|
|
const PRESENTATION_CONFIG = window.meetingClientSettings.public.presentation;
|
2018-10-24 04:44:17 +08:00
|
|
|
|
2016-09-15 04:25:31 +08:00
|
|
|
function shouldShowWhiteboard() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2024-05-18 04:33:52 +08:00
|
|
|
function shouldShowScreenshare(viewScreenshare) {
|
2023-06-17 04:48:52 +08:00
|
|
|
return (isScreenSharingEnabled() || isCameraAsContentEnabled())
|
|
|
|
&& (viewScreenshare || UserService.isUserPresenter())
|
2023-03-28 05:40:08 +08:00
|
|
|
&& (isScreenBroadcasting() || isCameraAsContentBroadcasting());
|
2016-09-15 04:25:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
function shouldShowOverlay() {
|
2019-07-25 01:04:46 +08:00
|
|
|
return getFromUserSettings('bbb_enable_video', KURENTO_CONFIG.enableVideo);
|
2016-09-15 04:25:31 +08:00
|
|
|
}
|
|
|
|
|
2022-02-11 22:30:35 +08:00
|
|
|
const setPresentationIsOpen = (layoutContextDispatch, value) => {
|
2021-08-05 19:03:24 +08:00
|
|
|
layoutContextDispatch({
|
2021-07-17 02:42:16 +08:00
|
|
|
type: ACTIONS.SET_PRESENTATION_IS_OPEN,
|
2022-02-11 22:30:35 +08:00
|
|
|
value,
|
2021-07-17 02:42:16 +08:00
|
|
|
});
|
2018-04-10 02:48:21 +08:00
|
|
|
};
|
|
|
|
|
2023-02-17 23:44:36 +08:00
|
|
|
const isThereWebcamOn = (meetingID) => {
|
|
|
|
return VideoStreams.find({
|
|
|
|
meetingId: meetingID
|
|
|
|
}).count() > 0;
|
|
|
|
}
|
|
|
|
|
2024-04-25 00:07:06 +08:00
|
|
|
const buildLayoutWhenPresentationAreaIsDisabled = (
|
|
|
|
layoutContextDispatch,
|
|
|
|
isSharingVideo,
|
|
|
|
isSharedNotesPinned,
|
|
|
|
) => {
|
2023-04-28 00:38:27 +08:00
|
|
|
const hasScreenshare = isScreenSharingEnabled();
|
2023-02-23 03:32:57 +08:00
|
|
|
const isThereWebcam = isThereWebcamOn(Auth.meetingID);
|
2023-02-17 23:44:36 +08:00
|
|
|
const isGeneralMediaOff = !hasScreenshare && !isSharedNotesPinned && !isSharingVideo
|
|
|
|
const webcamIsOnlyContent = isThereWebcam && isGeneralMediaOff;
|
|
|
|
const isThereNoMedia = !isThereWebcam && isGeneralMediaOff;
|
2023-02-27 23:18:23 +08:00
|
|
|
const isPresentationDisabled = !isPresentationEnabled();
|
2023-02-17 23:44:36 +08:00
|
|
|
|
2023-02-27 23:18:23 +08:00
|
|
|
if (isPresentationDisabled && (webcamIsOnlyContent || isThereNoMedia)) {
|
2023-02-17 23:44:36 +08:00
|
|
|
setPresentationIsOpen(layoutContextDispatch, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2016-05-31 06:07:02 +08:00
|
|
|
export default {
|
2023-02-17 23:44:36 +08:00
|
|
|
buildLayoutWhenPresentationAreaIsDisabled,
|
2016-09-15 04:25:31 +08:00
|
|
|
shouldShowWhiteboard,
|
2017-07-25 03:29:34 +08:00
|
|
|
shouldShowScreenshare,
|
2016-09-15 04:25:31 +08:00
|
|
|
shouldShowOverlay,
|
2023-03-28 05:40:08 +08:00
|
|
|
isScreenBroadcasting,
|
|
|
|
isCameraAsContentBroadcasting,
|
2022-02-11 22:30:35 +08:00
|
|
|
setPresentationIsOpen,
|
2016-05-31 06:07:02 +08:00
|
|
|
};
|