send redis msg when stopping external video due to screenshare

This commit is contained in:
Anton Georgiev 2019-12-19 16:13:21 -05:00
parent 4e1d55efd2
commit 2b4506fe2d

View File

@ -1,16 +1,20 @@
import { check } from 'meteor/check';
import Meetings from '/imports/api/meetings';
import Users from '/imports/api/users';
import addScreenshare from '../modifiers/addScreenshare';
import Logger from '/imports/startup/server/logger';
import stopWatchingExternalVideo from '/imports/api/external-videos/server/methods/stopWatchingExternalVideo';
export default function handleScreenshareStarted({ body }, meetingId) {
check(meetingId, String);
check(body, Object);
const meeting = Meetings.findOne({ meetingId });
const presenter = Users.findOne({ meetingId, presenter: true });
const presenterId = presenter && presenter.userId ? presenter.userId : 'system-screenshare-starting';
if (meeting && meeting.externalVideoUrl) {
Logger.info(`ScreenshareStarted: There is external video being shared. Stopping it due to presenter change, ${meeting.externalVideoUrl}`);
Meetings.update({ meetingId }, { $set: { externalVideoUrl: null } });
stopWatchingExternalVideo({ meetingId, requesterUserId: presenterId });
}
return addScreenshare(meetingId, body);
}