bigbluebutton-Github/bigbluebutton-html5/imports/api/external-videos/server/modifiers/updateExternalVideo.js
Pedro Beschorner Marin 72cfc9f86c refactor(external videos): data check
Add missing data check and move the existing ones inside the try-catch
blocks.
2021-06-06 13:13:16 -03:00

28 lines
833 B
JavaScript

import { check } from 'meteor/check';
import Logger from '/imports/startup/server/logger';
import ExternalVideoStreamer from '/imports/api/external-videos/server/streamer';
export default function updateExternalVideo(meetingId, userId, status, rate, time, state) {
try {
check(meetingId, String);
check(userId, String);
check(status, String);
check(rate, Number);
check(time, Number);
check(state, Number);
const modifier = {
meetingId,
userId,
rate,
time,
state,
};
Logger.debug(`UpdateExternalVideoEvtMsg received for user ${userId} and meeting ${meetingId} event:${status}`);
ExternalVideoStreamer(meetingId).emit(status, modifier);
} catch (err) {
Logger.error(`Error on setting shared external video update in Meetings collection: ${err}`);
}
}