bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/media/service.js

69 lines
2.2 KiB
JavaScript
Raw Normal View History

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