bigbluebutton-Github/bigbluebutton-html5/imports/api/cursor/server/streamer.js
2019-10-24 17:49:21 -03:00

26 lines
762 B
JavaScript

import publishCursorUpdate from './methods/publishCursorUpdate';
export function removeCursorStreamer(meetingId) {
delete Meteor.StreamerCentral.instances[`cursor-${meetingId}`];
}
export function addCursorStreamer(meetingId) {
const streamer = new Meteor.Streamer(`cursor-${meetingId}`, { retransmit: false });
streamer.allowRead(function allowRead() {
return this.userId && this.userId.includes(meetingId);
});
streamer.allowWrite(function allowWrite() {
return this.userId && this.userId.includes(meetingId);
});
streamer.on('publish', (message) => {
publishCursorUpdate(message.credentials, message.payload);
});
}
export default function get(meetingId) {
return Meteor.StreamerCentral.instances[`cursor-${meetingId}`];
}