2017-09-01 23:26:57 +08:00
|
|
|
import Logger from '/imports/startup/server/logger';
|
2019-09-07 00:50:31 +08:00
|
|
|
import VideoStreams from '/imports/api/video-streams';
|
2017-11-18 02:55:59 +08:00
|
|
|
import { check } from 'meteor/check';
|
2019-11-23 05:08:27 +08:00
|
|
|
import { getDeviceId } from '/imports/api/video-streams/server/helpers';
|
2017-09-01 23:26:57 +08:00
|
|
|
|
2019-11-23 05:08:27 +08:00
|
|
|
export default function unsharedWebcam(meetingId, userId, stream) {
|
2017-09-01 23:26:57 +08:00
|
|
|
check(meetingId, String);
|
|
|
|
check(userId, String);
|
2019-11-23 05:08:27 +08:00
|
|
|
check(stream, String);
|
|
|
|
|
|
|
|
const deviceId = getDeviceId(stream);
|
2017-09-01 23:26:57 +08:00
|
|
|
|
|
|
|
const selector = {
|
|
|
|
meetingId,
|
|
|
|
userId,
|
2019-11-23 05:08:27 +08:00
|
|
|
deviceId,
|
2017-09-01 23:26:57 +08:00
|
|
|
};
|
|
|
|
|
2020-11-23 21:13:46 +08:00
|
|
|
try {
|
|
|
|
VideoStreams.remove(selector);
|
2017-09-01 23:26:57 +08:00
|
|
|
|
2020-11-23 21:13:46 +08:00
|
|
|
Logger.info(`Removed stream=${stream} meeting=${meetingId}`);
|
|
|
|
} catch (err) {
|
|
|
|
Logger.error(`Error removing stream: ${err}`);
|
|
|
|
}
|
2017-09-01 23:26:57 +08:00
|
|
|
}
|