Remove: external video player meteor server files
This commit is contained in:
parent
60b8aa9452
commit
3142557849
@ -1,11 +0,0 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
|
||||
let streamer = null;
|
||||
const getStreamer = (meetingID) => {
|
||||
if (!streamer) {
|
||||
streamer = new Meteor.Streamer(`external-videos-${meetingID}`);
|
||||
}
|
||||
return streamer;
|
||||
};
|
||||
|
||||
export { getStreamer };
|
@ -1,49 +0,0 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
|
||||
const allowRecentMessages = (eventName, message) => {
|
||||
|
||||
const {
|
||||
userId,
|
||||
meetingId,
|
||||
time,
|
||||
rate,
|
||||
state,
|
||||
} = message;
|
||||
|
||||
Logger.debug(`ExternalVideo Streamer auth allowed userId: ${userId}, meetingId: ${meetingId}, event: ${eventName}, time: ${time} rate: ${rate}, state: ${state}`);
|
||||
return true;
|
||||
};
|
||||
|
||||
export function removeExternalVideoStreamer(meetingId) {
|
||||
const streamName = `external-videos-${meetingId}`;
|
||||
|
||||
if (Meteor.StreamerCentral.instances[streamName]) {
|
||||
Logger.info(`Destroying External Video streamer object for ${streamName}`);
|
||||
delete Meteor.StreamerCentral.instances[streamName];
|
||||
}
|
||||
}
|
||||
|
||||
export function addExternalVideoStreamer(meetingId) {
|
||||
|
||||
const streamName = `external-videos-${meetingId}`;
|
||||
if (!Meteor.StreamerCentral.instances[streamName]) {
|
||||
|
||||
const streamer = new Meteor.Streamer(streamName);
|
||||
streamer.allowRead(function allowRead() {
|
||||
if (!this.userId) return false;
|
||||
|
||||
return this.userId && this.userId.includes(meetingId);
|
||||
});
|
||||
streamer.allowWrite('none');
|
||||
streamer.allowEmit(allowRecentMessages);
|
||||
Logger.info(`Created External Video streamer for ${streamName}`);
|
||||
} else {
|
||||
Logger.debug(`External Video streamer is already created for ${streamName}`);
|
||||
}
|
||||
}
|
||||
|
||||
export default function get(meetingId) {
|
||||
const streamName = `external-videos-${meetingId}`;
|
||||
return Meteor.StreamerCentral.instances[streamName];
|
||||
}
|
@ -1,16 +1,12 @@
|
||||
import RedisPubSub from '/imports/startup/server/redis';
|
||||
import { check } from 'meteor/check';
|
||||
|
||||
import { removeExternalVideoStreamer } from '/imports/api/external-videos/server/streamer';
|
||||
|
||||
export default function handleMeetingDestruction({ body }) {
|
||||
check(body, Object);
|
||||
const { meetingId } = body;
|
||||
check(meetingId, String);
|
||||
|
||||
if (!process.env.BBB_HTML5_ROLE || process.env.BBB_HTML5_ROLE === 'frontend') {
|
||||
removeExternalVideoStreamer(meetingId);
|
||||
}
|
||||
|
||||
return RedisPubSub.destroyMeetingQueue(meetingId);
|
||||
}
|
||||
|
@ -10,7 +10,6 @@ import Meetings, {
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import { initPads } from '/imports/api/pads/server/helpers';
|
||||
import createTimer from '/imports/api/timer/server/methods/createTimer';
|
||||
import { addExternalVideoStreamer } from '/imports/api/external-videos/server/streamer';
|
||||
import { LAYOUT_TYPE } from '/imports/ui/components/layout/enums';
|
||||
|
||||
const addLayout = async (meetingId, layout) => {
|
||||
@ -210,16 +209,6 @@ export default async function addMeeting(meeting) {
|
||||
},
|
||||
};
|
||||
|
||||
if (!process.env.BBB_HTML5_ROLE || process.env.BBB_HTML5_ROLE === 'frontend') {
|
||||
addExternalVideoStreamer(meetingId);
|
||||
|
||||
// we don't want to fully process the create meeting message
|
||||
// in frontend since it can lead to duplication of meetings in mongo.
|
||||
if (process.env.BBB_HTML5_ROLE === 'frontend') {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
await addLayout(meetingId, LAYOUT_TYPE[meetingLayout] || 'smart');
|
||||
|
||||
try {
|
||||
|
@ -1,8 +1,6 @@
|
||||
import Meetings from '/imports/api/meetings';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
|
||||
import { removeExternalVideoStreamer } from '/imports/api/external-videos/server/streamer';
|
||||
|
||||
import clearUsers from '/imports/api/users/server/modifiers/clearUsers';
|
||||
import clearPads from '/imports/api/pads/server/modifiers/clearPads';
|
||||
import clearVoiceUsers from '/imports/api/voice-users/server/modifiers/clearVoiceUsers';
|
||||
@ -13,10 +11,6 @@ import clearVideoStreams from '/imports/api/video-streams/server/modifiers/clear
|
||||
import Metrics from '/imports/startup/server/metrics';
|
||||
|
||||
export default async function meetingHasEnded(meetingId) {
|
||||
if (!process.env.BBB_HTML5_ROLE || process.env.BBB_HTML5_ROLE === 'frontend') {
|
||||
removeExternalVideoStreamer(meetingId);
|
||||
}
|
||||
|
||||
await Meetings.removeAsync({ meetingId });
|
||||
await Promise.all([
|
||||
clearPads(meetingId),
|
||||
|
@ -1,6 +1,4 @@
|
||||
import Auth from '/imports/ui/services/auth';
|
||||
|
||||
import { getStreamer } from '/imports/api/external-videos';
|
||||
import ReactPlayer from 'react-player';
|
||||
|
||||
import Panopto from './custom-players/panopto';
|
||||
@ -17,16 +15,6 @@ const isUrlValid = (url) => {
|
||||
return /^https.*$/.test(url) && (ReactPlayer.canPlay(url) || Panopto.canPlay(url));
|
||||
};
|
||||
|
||||
const onMessage = (message, func) => {
|
||||
const streamer = getStreamer(Auth.meetingID);
|
||||
streamer.on(message, func);
|
||||
};
|
||||
|
||||
const removeAllListeners = (eventType) => {
|
||||
const streamer = getStreamer(Auth.meetingID);
|
||||
streamer.removeAllListeners(eventType);
|
||||
};
|
||||
|
||||
// Convert state (Number) to playing (Boolean)
|
||||
const getPlayingState = (state) => {
|
||||
if (state === 1) return true;
|
||||
@ -35,8 +23,6 @@ const getPlayingState = (state) => {
|
||||
};
|
||||
|
||||
export {
|
||||
onMessage,
|
||||
removeAllListeners,
|
||||
isUrlValid,
|
||||
getPlayingState,
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user