fix(webcam): remove video-streams collection usage from media service

This commit is contained in:
João Victor 2024-05-06 12:19:27 -03:00
parent 9fcb83b352
commit 4391b3dfbb
2 changed files with 9 additions and 10 deletions

View File

@ -32,6 +32,7 @@ import App from './component';
import useToggleVoice from '../audio/audio-graphql/hooks/useToggleVoice';
import useUserChangedLocalSettings from '../../services/settings/hooks/useUserChangedLocalSettings';
import { PINNED_PAD_SUBSCRIPTION } from '../notes/queries';
import VideoStreamsState from '../video-provider/video-provider-graphql/state';
const CUSTOM_STYLE_URL = window.meetingClientSettings.public.app.customStyleUrl;
const NOTES_CONFIG = window.meetingClientSettings.public.notes;
@ -88,6 +89,7 @@ const AppContainer = (props) => {
const isSharedNotesPinnedFromGraphql = !!pinnedPadData
&& pinnedPadData.sharedNotes[0]?.sharedNotesExtId === NOTES_CONFIG.id;
const isSharedNotesPinned = sharedNotesInput?.isPinned && isSharedNotesPinnedFromGraphql;
const isThereWebcam = VideoStreamsState.getStreams().length > 0;
const setMobileUser = (mobile) => {
setMobileFlag({
@ -171,7 +173,12 @@ const AppContainer = (props) => {
const isSharingVideo = !!currentMeeting?.externalVideo?.externalVideoUrl;
useEffect(() => {
MediaService.buildLayoutWhenPresentationAreaIsDisabled(layoutContextDispatch, isSharingVideo, sharedNotesInput?.isPinned);
MediaService.buildLayoutWhenPresentationAreaIsDisabled(
layoutContextDispatch,
isSharingVideo,
sharedNotesInput?.isPinned,
isThereWebcam,
);
});
const shouldShowExternalVideo = isExternalVideoEnabled() && isSharingVideo;

View File

@ -6,8 +6,6 @@ import {
} from '/imports/ui/services/features';
import { ACTIONS } from '../layout/enums';
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;
@ -35,19 +33,13 @@ const setPresentationIsOpen = (layoutContextDispatch, value) => {
});
};
const isThereWebcamOn = (meetingID) => {
return VideoStreams.find({
meetingId: meetingID
}).count() > 0;
}
const buildLayoutWhenPresentationAreaIsDisabled = (
layoutContextDispatch,
isSharingVideo,
isSharedNotesPinned,
isThereWebcam,
) => {
const hasScreenshare = isScreenSharingEnabled();
const isThereWebcam = isThereWebcamOn(Auth.meetingID);
const isGeneralMediaOff = !hasScreenshare && !isSharedNotesPinned && !isSharingVideo
const webcamIsOnlyContent = isThereWebcam && isGeneralMediaOff;
const isThereNoMedia = !isThereWebcam && isGeneralMediaOff;