Register external video playback events to Redis

This commit is contained in:
Lucas Fialho Zawacki 2019-05-22 20:12:13 +00:00 committed by Anton Georgiev
parent aff272cbf3
commit ddc7a974bf
2 changed files with 27 additions and 5 deletions

View File

@ -0,0 +1,22 @@
import { Meteor } from 'meteor/meteor';
import { check } from 'meteor/check';
import Logger from '/imports/startup/server/logger';
import RedisPubSub from '/imports/startup/server/redis';
export default function updateExternalVideoStatus(credentials, options) {
const REDIS_CONFIG = Meteor.settings.private.redis;
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
const EVENT_NAME = 'UpdateExternalVideoStatusMsg';
const { meetingId, requesterUserId } = credentials;
const { eventName, playerStatus } = options;
check(meetingId, String);
check(requesterUserId, String);
const payload = { eventName, playerStatus };
Logger.info(`User id=${requesterUserId} sending video status: ${eventName} for meeting ${meetingId}`);
return RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload);
}

View File

@ -33,12 +33,12 @@ let lastMessage = null;
const sendMessage = (event, data) => {
// don't re-send repeated update messages
if (lastMessage && lastMessage.event === event
&& event === 'playerUpdate' && lastMessage.time === data.time) {
return;
}
if (lastMessage && lastMessage.event === event
&& event === 'playerUpdate' && lastMessage.time === data.time) {
return;
}
// don't register to redis a viewer joined message
// don't register to redis a viewer joined message
if (event === 'viewerJoined') {
return;
}