bigbluebutton-Github/bigbluebutton-html5/imports/api/audio-captions/server/publishers.js
Pedro Beschorner Marin 944edf2ccf feat(captions): web speech prototype
Hardcoded pt-BR prototype for closed captions generated by the browser's
WebSpeech API.
2022-07-20 17:20:48 +00:00

26 lines
958 B
JavaScript

import AudioCaptions from '/imports/api/audio-captions';
import { Meteor } from 'meteor/meteor';
import Logger from '/imports/startup/server/logger';
import AuthTokenValidation, { ValidationStates } from '/imports/api/auth-token-validation';
function audioCaptions() {
const tokenValidation = AuthTokenValidation.findOne({ connectionId: this.connection.id });
if (!tokenValidation || tokenValidation.validationStatus !== ValidationStates.VALIDATED) {
Logger.warn(`Publishing AudioCaptions was requested by unauth connection ${this.connection.id}`);
return AudioCaptions.find({ meetingId: '' });
}
const { meetingId, userId } = tokenValidation;
Logger.debug('Publishing AudioCaptions', { meetingId, requestedBy: userId });
return AudioCaptions.find({ meetingId });
}
function publish(...args) {
const boundAudioCaptions = audioCaptions.bind(this);
return boundAudioCaptions(...args);
}
Meteor.publish('audio-captions', publish);