bigbluebutton-Github/bigbluebutton-html5/imports/api/external-videos/server/methods/startWatchingExternalVideo.js

33 lines
1.3 KiB
JavaScript
Raw Normal View History

import { check } from 'meteor/check';
import Logger from '/imports/startup/server/logger';
import Users from '/imports/api/users';
import RedisPubSub from '/imports/startup/server/redis';
import { extractCredentials } from '/imports/api/common/server/helpers';
export default function startWatchingExternalVideo(options) {
const REDIS_CONFIG = Meteor.settings.private.redis;
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
Committer: Antonio Guirado <amguirado73@gmail.com> Changes to be committed: new file: akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/externalvideo/ExternalVideoApp2x.scala new file: akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/externalvideo/StartExternalVideoPubMsgHdlr.scala new file: akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/externalvideo/StopExternalVideoPubMsgHdlr.scala new file: akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/externalvideo/UpdateExternalVideoPubMsgHdlr.scala modified: akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala modified: akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala modified: akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/FromAkkaAppsMsgSenderActor.scala new file: bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/ExternalVideoMsgs.scala new file: bigbluebutton-html5/imports/api/external-videos/server/eventHandlers.js new file: bigbluebutton-html5/imports/api/external-videos/server/handlers/startExternalVideo.js new file: bigbluebutton-html5/imports/api/external-videos/server/handlers/stopExternalVideo.js new file: bigbluebutton-html5/imports/api/external-videos/server/handlers/updateExternalVideo.js modified: bigbluebutton-html5/imports/api/external-videos/server/index.js modified: bigbluebutton-html5/imports/api/external-videos/server/methods.js modified: bigbluebutton-html5/imports/api/external-videos/server/methods/emitExternalVideoEvent.js modified: bigbluebutton-html5/imports/api/external-videos/server/methods/startWatchingExternalVideo.js modified: bigbluebutton-html5/imports/api/external-videos/server/methods/stopWatchingExternalVideo.js new file: bigbluebutton-html5/imports/api/external-videos/server/streamer.js modified: bigbluebutton-html5/imports/api/meetings/server/handlers/meetingDestruction.js modified: bigbluebutton-html5/imports/api/meetings/server/modifiers/addMeeting.js modified: bigbluebutton-html5/imports/api/meetings/server/modifiers/meetingHasEnded.js modified: bigbluebutton-html5/imports/api/users/server/handlers/validateAuthToken.js modified: bigbluebutton-html5/imports/api/users/server/store/bannedUsers.js modified: bigbluebutton-html5/imports/startup/server/index.js modified: bigbluebutton-html5/imports/startup/server/redis.js modified: bigbluebutton-html5/imports/ui/components/external-video-player/service.js modified: bigbluebutton-html5/private/config/settings.yml
2020-08-28 18:58:55 +08:00
const EVENT_NAME = 'StartExternalVideoPubMsg';
const { meetingId, requesterUserId: userId } = extractCredentials(this.userId);
const { externalVideoUrl } = options;
try {
check(meetingId, String);
check(userId, String);
check(externalVideoUrl, String);
const user = Users.findOne({ meetingId, userId }, { presenter: 1 });
if (user && user.presenter) {
check(externalVideoUrl, String);
const payload = { externalVideoUrl };
Logger.debug(`User id=${userId} sending ${EVENT_NAME} url:${externalVideoUrl} for meeting ${meetingId}`);
return RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, userId, payload);
}
Logger.error(`Only presenters are allowed to start external video for a meeting. meeting=${meetingId} userId=${userId}`);
} catch (error) {
Logger.error(`Error on sharing an external video: ${externalVideoUrl} ${error}`);
}
}