2023-11-30 19:08:16 +08:00
|
|
|
import React from 'react';
|
2018-01-08 12:44:42 +08:00
|
|
|
import { withTracker } from 'meteor/react-meteor-data';
|
2024-04-25 00:07:06 +08:00
|
|
|
import { useMutation, useSubscription } from '@apollo/client';
|
2019-04-16 05:39:07 +08:00
|
|
|
import {
|
2023-03-28 05:40:08 +08:00
|
|
|
getSharingContentType,
|
|
|
|
getBroadcastContentType,
|
|
|
|
isScreenGloballyBroadcasting,
|
|
|
|
isCameraAsContentGloballyBroadcasting,
|
|
|
|
isScreenBroadcasting,
|
|
|
|
isCameraAsContentBroadcasting,
|
2023-11-30 19:08:16 +08:00
|
|
|
shouldEnableVolumeControl,
|
2019-04-16 05:39:07 +08:00
|
|
|
} from './service';
|
2017-07-25 03:29:34 +08:00
|
|
|
import ScreenshareComponent from './component';
|
2021-09-11 04:48:52 +08:00
|
|
|
import { layoutSelect, layoutSelectOutput, layoutDispatch } from '../layout/context';
|
2021-09-28 03:57:02 +08:00
|
|
|
import getFromUserSettings from '/imports/ui/services/users-settings';
|
2023-05-13 04:06:23 +08:00
|
|
|
import AudioService from '/imports/ui/components/audio/service';
|
2022-02-10 03:45:43 +08:00
|
|
|
import MediaService from '/imports/ui/components/media/service';
|
2023-03-28 05:40:08 +08:00
|
|
|
import { defineMessages } from 'react-intl';
|
2024-01-20 02:40:27 +08:00
|
|
|
import { EXTERNAL_VIDEO_STOP } from '../external-video-player/mutations';
|
2024-04-25 00:07:06 +08:00
|
|
|
import { PINNED_PAD_SUBSCRIPTION } from '../notes/notes-graphql/queries';
|
|
|
|
|
|
|
|
const NOTES_CONFIG = window.meetingClientSettings.public.notes;
|
2023-03-28 05:40:08 +08:00
|
|
|
|
|
|
|
const screenshareIntlMessages = defineMessages({
|
|
|
|
// SCREENSHARE
|
|
|
|
label: {
|
|
|
|
id: 'app.screenshare.screenShareLabel',
|
|
|
|
description: 'screen share area element label',
|
|
|
|
},
|
|
|
|
presenterLoadingLabel: {
|
|
|
|
id: 'app.screenshare.presenterLoadingLabel',
|
|
|
|
},
|
|
|
|
viewerLoadingLabel: {
|
|
|
|
id: 'app.screenshare.viewerLoadingLabel',
|
|
|
|
},
|
|
|
|
presenterSharingLabel: {
|
|
|
|
id: 'app.screenshare.presenterSharingLabel',
|
|
|
|
},
|
|
|
|
autoplayBlockedDesc: {
|
|
|
|
id: 'app.media.screenshare.autoplayBlockedDesc',
|
|
|
|
},
|
|
|
|
autoplayAllowLabel: {
|
|
|
|
id: 'app.media.screenshare.autoplayAllowLabel',
|
|
|
|
},
|
|
|
|
started: {
|
|
|
|
id: 'app.media.screenshare.start',
|
|
|
|
description: 'toast to show when a screenshare has started',
|
|
|
|
},
|
|
|
|
ended: {
|
|
|
|
id: 'app.media.screenshare.end',
|
|
|
|
description: 'toast to show when a screenshare has ended',
|
|
|
|
},
|
|
|
|
endedDueToDataSaving: {
|
|
|
|
id: 'app.media.screenshare.endDueToDataSaving',
|
|
|
|
description: 'toast to show when a screenshare has ended by changing data savings option',
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
const cameraAsContentIntlMessages = defineMessages({
|
|
|
|
// CAMERA AS CONTENT
|
|
|
|
label: {
|
|
|
|
id: 'app.cameraAsContent.cameraAsContentLabel',
|
|
|
|
description: 'screen share area element label',
|
|
|
|
},
|
|
|
|
presenterLoadingLabel: {
|
|
|
|
id: 'app.cameraAsContent.presenterLoadingLabel',
|
|
|
|
},
|
|
|
|
viewerLoadingLabel: {
|
|
|
|
id: 'app.cameraAsContent.viewerLoadingLabel',
|
|
|
|
},
|
|
|
|
presenterSharingLabel: {
|
|
|
|
id: 'app.cameraAsContent.presenterSharingLabel',
|
|
|
|
},
|
|
|
|
autoplayBlockedDesc: {
|
|
|
|
id: 'app.media.cameraAsContent.autoplayBlockedDesc',
|
|
|
|
},
|
|
|
|
autoplayAllowLabel: {
|
|
|
|
id: 'app.media.cameraAsContent.autoplayAllowLabel',
|
|
|
|
},
|
|
|
|
started: {
|
|
|
|
id: 'app.media.cameraAsContent.start',
|
|
|
|
description: 'toast to show when camera as content has started',
|
|
|
|
},
|
|
|
|
ended: {
|
|
|
|
id: 'app.media.cameraAsContent.end',
|
|
|
|
description: 'toast to show when camera as content has ended',
|
|
|
|
},
|
|
|
|
endedDueToDataSaving: {
|
|
|
|
id: 'app.media.cameraAsContent.endDueToDataSaving',
|
|
|
|
description: 'toast to show when camera as content has ended by changing data savings option',
|
|
|
|
},
|
|
|
|
});
|
2017-07-25 03:29:34 +08:00
|
|
|
|
2019-07-24 03:56:39 +08:00
|
|
|
const ScreenshareContainer = (props) => {
|
2021-09-11 04:48:52 +08:00
|
|
|
const screenShare = layoutSelectOutput((i) => i.screenShare);
|
|
|
|
const fullscreen = layoutSelect((i) => i.fullscreen);
|
|
|
|
const layoutContextDispatch = layoutDispatch();
|
2021-09-10 21:16:44 +08:00
|
|
|
|
2021-07-13 03:47:06 +08:00
|
|
|
const { element } = fullscreen;
|
2021-09-10 21:16:44 +08:00
|
|
|
const fullscreenElementId = 'Screenshare';
|
2021-07-07 03:27:28 +08:00
|
|
|
const fullscreenContext = (element === fullscreenElementId);
|
2024-01-20 02:40:27 +08:00
|
|
|
const [stopExternalVideoShare] = useMutation(EXTERNAL_VIDEO_STOP);
|
2021-06-15 19:51:44 +08:00
|
|
|
|
2024-04-25 00:07:06 +08:00
|
|
|
const { data: pinnedPadData } = useSubscription(PINNED_PAD_SUBSCRIPTION);
|
|
|
|
const isSharedNotesPinned = !!pinnedPadData
|
|
|
|
&& pinnedPadData.sharedNotes[0]?.sharedNotesExtId === NOTES_CONFIG.id;
|
|
|
|
|
2023-12-01 19:12:45 +08:00
|
|
|
const { isPresenter } = props;
|
2021-11-23 22:20:29 +08:00
|
|
|
|
2023-03-28 05:40:08 +08:00
|
|
|
const info = {
|
|
|
|
screenshare: {
|
|
|
|
icon: "desktop",
|
|
|
|
locales: screenshareIntlMessages,
|
|
|
|
startPreviewSizeBig: false,
|
|
|
|
showSwitchPreviewSizeButton: true,
|
|
|
|
},
|
|
|
|
camera: {
|
|
|
|
icon: "video",
|
|
|
|
locales: cameraAsContentIntlMessages,
|
|
|
|
startPreviewSizeBig: true,
|
|
|
|
showSwitchPreviewSizeButton: false,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
const getContentType = () => {
|
|
|
|
return isPresenter ? getSharingContentType() : getBroadcastContentType();
|
|
|
|
}
|
|
|
|
const contentTypeInfo = info[getContentType()];
|
|
|
|
const defaultInfo = info.camera;
|
|
|
|
const selectedInfo = contentTypeInfo ? contentTypeInfo : defaultInfo;
|
|
|
|
|
|
|
|
if (isScreenBroadcasting() || isCameraAsContentBroadcasting()) {
|
2021-07-07 03:27:28 +08:00
|
|
|
return (
|
|
|
|
<ScreenshareComponent
|
|
|
|
{
|
|
|
|
...{
|
2021-08-05 19:03:24 +08:00
|
|
|
layoutContextDispatch,
|
2021-07-07 03:27:28 +08:00
|
|
|
...props,
|
|
|
|
...screenShare,
|
|
|
|
fullscreenContext,
|
|
|
|
fullscreenElementId,
|
2024-04-25 00:07:06 +08:00
|
|
|
isSharedNotesPinned,
|
2024-01-20 02:40:27 +08:00
|
|
|
stopExternalVideoShare,
|
2023-03-28 05:40:08 +08:00
|
|
|
...selectedInfo,
|
2021-07-07 03:27:28 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
);
|
2017-07-25 03:29:34 +08:00
|
|
|
}
|
2019-07-24 03:56:39 +08:00
|
|
|
return null;
|
|
|
|
};
|
2017-07-25 03:29:34 +08:00
|
|
|
|
2024-03-07 01:28:18 +08:00
|
|
|
const LAYOUT_CONFIG = window.meetingClientSettings.public.layout;
|
2021-09-28 03:57:02 +08:00
|
|
|
|
2022-02-10 03:45:43 +08:00
|
|
|
export default withTracker(() => {
|
|
|
|
return {
|
2023-03-28 05:40:08 +08:00
|
|
|
isGloballyBroadcasting: isScreenGloballyBroadcasting() || isCameraAsContentGloballyBroadcasting(),
|
2022-02-10 03:45:43 +08:00
|
|
|
toggleSwapLayout: MediaService.toggleSwapLayout,
|
2023-02-18 01:59:39 +08:00
|
|
|
hidePresentationOnJoin: getFromUserSettings('bbb_hide_presentation_on_join', LAYOUT_CONFIG.hidePresentationOnJoin),
|
2022-02-10 03:45:43 +08:00
|
|
|
enableVolumeControl: shouldEnableVolumeControl(),
|
2023-05-13 04:06:23 +08:00
|
|
|
outputDeviceId: AudioService.outputDeviceId(),
|
2022-02-10 03:45:43 +08:00
|
|
|
};
|
|
|
|
})(ScreenshareContainer);
|