2017-10-12 10:00:28 +08:00
|
|
|
import Presentations from '/imports/api/presentations';
|
2017-07-25 03:29:34 +08:00
|
|
|
import { isVideoBroadcasting } from '/imports/ui/components/screenshare/service';
|
2019-07-13 04:08:55 +08:00
|
|
|
import { getVideoUrl } from '/imports/ui/components/external-video-player/service';
|
2018-02-06 21:33:48 +08:00
|
|
|
import Auth from '/imports/ui/services/auth';
|
|
|
|
import Users from '/imports/api/users';
|
2018-04-18 01:55:07 +08:00
|
|
|
import Settings from '/imports/ui/services/settings';
|
|
|
|
import PollingService from '/imports/ui/components/polling/service';
|
2018-09-14 02:09:30 +08:00
|
|
|
import getFromUserSettings from '/imports/ui/services/users-settings';
|
2016-05-31 06:07:02 +08:00
|
|
|
|
2018-10-24 04:44:17 +08:00
|
|
|
const LAYOUT_CONFIG = Meteor.settings.public.layout;
|
|
|
|
const KURENTO_CONFIG = Meteor.settings.public.kurento;
|
|
|
|
|
2017-06-03 03:25:02 +08:00
|
|
|
const getPresentationInfo = () => {
|
2017-07-01 03:16:00 +08:00
|
|
|
const currentPresentation = Presentations.findOne({
|
2017-07-25 02:46:53 +08:00
|
|
|
current: true,
|
2017-06-03 03:25:02 +08:00
|
|
|
});
|
2016-05-31 06:07:02 +08:00
|
|
|
|
|
|
|
return {
|
2017-06-03 03:25:02 +08:00
|
|
|
current_presentation: (currentPresentation != null),
|
2016-05-31 06:07:02 +08:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2019-08-30 00:26:07 +08:00
|
|
|
const isUserPresenter = () => Users.findOne({ userId: Auth.userID },
|
|
|
|
{ fields: { presenter: 1 } }).presenter;
|
2018-02-06 21:33:48 +08:00
|
|
|
|
2016-09-15 04:25:31 +08:00
|
|
|
function shouldShowWhiteboard() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2017-07-25 03:29:34 +08:00
|
|
|
function shouldShowScreenshare() {
|
2019-02-05 20:59:39 +08:00
|
|
|
const { viewScreenshare } = Settings.dataSaving;
|
2019-07-25 01:04:46 +08:00
|
|
|
const enableScreensharing = getFromUserSettings('bbb_enable_screen_sharing', KURENTO_CONFIG.enableScreensharing);
|
2019-02-05 20:59:39 +08:00
|
|
|
return enableScreensharing && viewScreenshare && isVideoBroadcasting();
|
2016-09-15 04:25:31 +08:00
|
|
|
}
|
|
|
|
|
2018-11-30 01:24:02 +08:00
|
|
|
function shouldShowExternalVideo() {
|
2019-07-16 03:31:28 +08:00
|
|
|
const { enabled: enableExternalVideo } = Meteor.settings.public.externalVideoPlayer;
|
2019-07-13 04:08:55 +08:00
|
|
|
return enableExternalVideo && getVideoUrl();
|
2018-11-30 01:24:02 +08:00
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2018-04-10 02:48:21 +08:00
|
|
|
const swapLayout = {
|
2019-07-22 22:28:13 +08:00
|
|
|
value: getFromUserSettings('bbb_auto_swap_layout', LAYOUT_CONFIG.autoSwapLayout),
|
2018-04-10 02:48:21 +08:00
|
|
|
tracker: new Tracker.Dependency(),
|
|
|
|
};
|
|
|
|
|
2019-06-25 05:01:54 +08:00
|
|
|
const setSwapLayout = () => {
|
2019-07-22 22:28:13 +08:00
|
|
|
swapLayout.value = getFromUserSettings('bbb_auto_swap_layout', LAYOUT_CONFIG.autoSwapLayout);
|
2019-06-25 05:01:54 +08:00
|
|
|
swapLayout.tracker.changed();
|
|
|
|
};
|
|
|
|
|
2018-04-10 02:48:21 +08:00
|
|
|
const toggleSwapLayout = () => {
|
|
|
|
swapLayout.value = !swapLayout.value;
|
|
|
|
swapLayout.tracker.changed();
|
|
|
|
};
|
|
|
|
|
2019-09-27 04:14:05 +08:00
|
|
|
export const shouldEnableSwapLayout = () => !shouldShowScreenshare() && !shouldShowExternalVideo();
|
2018-04-18 01:55:07 +08:00
|
|
|
|
2018-04-10 02:48:21 +08:00
|
|
|
export const getSwapLayout = () => {
|
|
|
|
swapLayout.tracker.depend();
|
2019-06-25 05:01:54 +08:00
|
|
|
return swapLayout.value;
|
2018-04-10 02:48:21 +08:00
|
|
|
};
|
|
|
|
|
2016-05-31 06:07:02 +08:00
|
|
|
export default {
|
|
|
|
getPresentationInfo,
|
2016-09-15 04:25:31 +08:00
|
|
|
shouldShowWhiteboard,
|
2017-07-25 03:29:34 +08:00
|
|
|
shouldShowScreenshare,
|
2018-11-30 01:24:02 +08:00
|
|
|
shouldShowExternalVideo,
|
2016-09-15 04:25:31 +08:00
|
|
|
shouldShowOverlay,
|
2018-02-06 21:33:48 +08:00
|
|
|
isUserPresenter,
|
2018-03-09 19:20:08 +08:00
|
|
|
isVideoBroadcasting,
|
2018-04-10 02:48:21 +08:00
|
|
|
toggleSwapLayout,
|
2018-04-18 01:55:07 +08:00
|
|
|
shouldEnableSwapLayout,
|
2018-12-12 00:28:37 +08:00
|
|
|
getSwapLayout,
|
2019-06-25 05:01:54 +08:00
|
|
|
setSwapLayout,
|
2016-05-31 06:07:02 +08:00
|
|
|
};
|