bigbluebutton-Github/bigbluebutton-html5/imports/api/screenshare/server/handlers/screenshareStarted.js

21 lines
1005 B
JavaScript
Raw Normal View History

2017-07-14 20:32:15 +08:00
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';
2017-07-14 20:32:15 +08:00
export default function handleScreenshareStarted({ body }, meetingId) {
2017-07-14 20:32:15 +08:00
check(meetingId, String);
2017-07-14 22:18:46 +08:00
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}`);
stopWatchingExternalVideo({ meetingId, requesterUserId: presenterId });
}
return addScreenshare(meetingId, body);
2017-07-14 20:32:15 +08:00
}