bigbluebutton-Github/bigbluebutton-html5/imports/api/video/server/handlers/userSharedHtml5Webcam.js

21 lines
611 B
JavaScript
Raw Normal View History

import { check } from 'meteor/check';
2018-06-19 02:59:35 +08:00
import sharedWebcam from '../modifiers/sharedWebcam';
2018-06-19 02:59:35 +08:00
export default function handleUserSharedHtml5Webcam({ header, body }, meetingId) {
const { userId, stream } = body;
2018-06-19 02:59:35 +08:00
const isValidStream = (testString) => {
// Checking if the stream name is a flash one
const regexp = /^([A-z0-9]+)-([A-z0-9]+)-([A-z0-9]+)(-recorded)?$/;
2018-06-19 02:59:35 +08:00
return !regexp.test(testString);
};
2017-09-01 23:26:57 +08:00
check(header, Object);
2017-09-01 23:26:57 +08:00
check(meetingId, String);
check(userId, String);
check(stream, String);
if (!isValidStream(stream)) return false;
2017-09-01 23:26:57 +08:00
return sharedWebcam(meetingId, userId);
}