2020-08-28 18:58:55 +08:00
|
|
|
import { check } from 'meteor/check';
|
2018-11-30 01:24:02 +08:00
|
|
|
import Logger from '/imports/startup/server/logger';
|
2020-02-28 03:42:53 +08:00
|
|
|
import { extractCredentials } from '/imports/api/common/server/helpers';
|
2021-05-28 07:50:43 +08:00
|
|
|
import RedisPubSub from '/imports/startup/server/redis';
|
2018-11-30 01:24:02 +08:00
|
|
|
|
2021-02-21 20:19:01 +08:00
|
|
|
export default function stopWatchingExternalVideo() {
|
2021-05-28 07:50:43 +08:00
|
|
|
const REDIS_CONFIG = Meteor.settings.private.redis;
|
|
|
|
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
|
|
|
const EVENT_NAME = 'StopExternalVideoPubMsg';
|
2020-02-28 04:30:35 +08:00
|
|
|
|
2020-09-04 03:07:54 +08:00
|
|
|
try {
|
2021-05-28 07:50:43 +08:00
|
|
|
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
|
|
|
|
2020-09-04 03:07:54 +08:00
|
|
|
check(meetingId, String);
|
|
|
|
check(requesterUserId, String);
|
2021-02-21 20:19:01 +08:00
|
|
|
|
2021-05-28 07:50:43 +08:00
|
|
|
const payload = {};
|
|
|
|
|
|
|
|
Logger.info(`User ${requesterUserId} stoping an external video for meeting ${meetingId}`);
|
2020-02-28 03:42:53 +08:00
|
|
|
|
2021-06-01 06:42:39 +08:00
|
|
|
RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload);
|
2020-09-04 03:07:54 +08:00
|
|
|
} catch (error) {
|
2021-05-28 07:50:43 +08:00
|
|
|
Logger.error(`Error on stoping an external video for meeting ${meetingId}: ${error}`);
|
2020-09-04 03:07:54 +08:00
|
|
|
}
|
2018-11-30 01:24:02 +08:00
|
|
|
}
|