Register external video playback events to Redis
This commit is contained in:
parent
aff272cbf3
commit
ddc7a974bf
@ -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);
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user