bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/video-provider/video-button/container.jsx

62 lines
1.8 KiB
React
Raw Normal View History

import React from 'react';
import { useContext } from 'react';
import { withTracker } from 'meteor/react-meteor-data';
import { injectIntl } from 'react-intl';
2024-01-27 00:21:58 +08:00
import { useMutation } from '@apollo/client';
import JoinVideoButton from './component';
2019-11-28 21:13:06 +08:00
import VideoService from '../service';
import {
updateSettings,
} from '/imports/ui/components/settings/service';
import { PluginsContext } from '/imports/ui/components/components-data/plugin-context/context';
2024-01-27 00:21:58 +08:00
import { CAMERA_BROADCAST_STOP } from '../mutations';
2024-01-30 21:03:11 +08:00
import useUserChangedLocalSettings from '/imports/ui/services/settings/hooks/useUserChangedLocalSettings';
const JoinVideoOptionsContainer = (props) => {
const {
updateSettings,
2019-11-28 21:13:06 +08:00
hasVideoStream,
disableReason,
status,
intl,
...restProps
} = props;
2024-01-27 00:21:58 +08:00
const [cameraBroadcastStop] = useMutation(CAMERA_BROADCAST_STOP);
2024-01-30 21:03:11 +08:00
const setLocalSettings = useUserChangedLocalSettings();
2024-01-27 00:21:58 +08:00
const sendUserUnshareWebcam = (cameraId) => {
cameraBroadcastStop({ variables: { cameraId } });
};
const {
pluginsExtensibleAreasAggregatedState,
} = useContext(PluginsContext);
let cameraSettingsDropdownItems = [];
if (pluginsExtensibleAreasAggregatedState.cameraSettingsDropdownItems) {
cameraSettingsDropdownItems = [
...pluginsExtensibleAreasAggregatedState.cameraSettingsDropdownItems,
];
}
2019-11-28 21:13:06 +08:00
return (
<JoinVideoButton {...{
cameraSettingsDropdownItems,
hasVideoStream,
updateSettings,
disableReason,
status,
2024-01-27 00:21:58 +08:00
sendUserUnshareWebcam,
2024-01-30 21:03:11 +08:00
setLocalSettings,
...restProps,
2019-11-28 21:13:06 +08:00
}}
/>
);
};
export default injectIntl(withTracker(() => ({
2019-11-28 21:13:06 +08:00
hasVideoStream: VideoService.hasVideoStream(),
updateSettings,
disableReason: VideoService.disableReason(),
status: VideoService.getStatus(),
}))(JoinVideoOptionsContainer));