2017-07-27 23:27:06 +08:00
|
|
|
import Logger from '/imports/startup/server/logger';
|
2017-10-12 10:00:28 +08:00
|
|
|
import Screenshare from '/imports/api/screenshare';
|
2017-07-27 23:27:06 +08:00
|
|
|
|
2023-03-17 02:13:43 +08:00
|
|
|
export default async function clearScreenshare(meetingId, screenshareConf) {
|
2020-11-25 04:44:13 +08:00
|
|
|
try {
|
|
|
|
let numberAffected;
|
2019-03-14 21:15:31 +08:00
|
|
|
|
2020-11-25 04:44:13 +08:00
|
|
|
if (meetingId && screenshareConf) {
|
2023-03-17 02:13:43 +08:00
|
|
|
numberAffected = await Screenshare.removeAsync({ meetingId, 'screenshare.screenshareConf': screenshareConf });
|
2021-02-10 00:44:49 +08:00
|
|
|
} else if (meetingId) {
|
2023-03-17 02:13:43 +08:00
|
|
|
numberAffected = await Screenshare.removeAsync({ meetingId });
|
2020-11-25 04:44:13 +08:00
|
|
|
} else {
|
2023-03-17 02:13:43 +08:00
|
|
|
numberAffected = await Screenshare.removeAsync({});
|
2020-11-25 04:44:13 +08:00
|
|
|
}
|
2019-03-14 21:15:31 +08:00
|
|
|
|
2020-11-25 04:44:13 +08:00
|
|
|
if (numberAffected) {
|
|
|
|
Logger.info(`removed screenshare meetingId=${meetingId} id=${screenshareConf}`);
|
|
|
|
}
|
|
|
|
} catch (err) {
|
|
|
|
Logger.error(`removing screenshare to collection: ${err}`);
|
2017-07-27 23:27:06 +08:00
|
|
|
}
|
|
|
|
}
|