From 540ce10c2425c94eb944d29fec841cd4e8d6e0aa Mon Sep 17 00:00:00 2001
From: Pedro Beschorner Marin <pedrobmarin@gmail.com>
Date: Tue, 28 May 2019 12:59:40 +0000
Subject: [PATCH] Recording external video events

---
 .../UpdateExternalVideoRecordEvent.scala      |  2 +-
 .../common2/msgs/ExternalVideoMsgs.scala      |  4 ++--
 .../server/methods/emitExternalVideoEvent.js  |  2 +-
 .../methods/updateExternalVideoStatus.js      | 22 -------------------
 4 files changed, 4 insertions(+), 26 deletions(-)
 delete mode 100644 bigbluebutton-html5/imports/api/external-videos/server/methods/updateExternalVideoStatus.js

diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/UpdateExternalVideoRecordEvent.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/UpdateExternalVideoRecordEvent.scala
index dd3fa563b1..983ab26be6 100644
--- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/UpdateExternalVideoRecordEvent.scala
+++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/UpdateExternalVideoRecordEvent.scala
@@ -36,7 +36,7 @@ class UpdateExternalVideoRecordEvent extends AbstractExternalVideoRecordEvent {
     eventMap.put(TIME, time.toString)
   }
 
-  def setState(state: Int) {
+  def setState(state: Boolean) {
     eventMap.put(STATE, state.toString)
   }
 }
diff --git a/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/ExternalVideoMsgs.scala b/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/ExternalVideoMsgs.scala
index 3ea752b81c..7a66abd7e7 100644
--- a/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/ExternalVideoMsgs.scala
+++ b/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/ExternalVideoMsgs.scala
@@ -7,7 +7,7 @@ case class StartExternalVideoPubMsgBody(externalVideoUrl: String)
 
 object UpdateExternalVideoPubMsg { val NAME = "UpdateExternalVideoPubMsg" }
 case class UpdateExternalVideoPubMsg(header: BbbClientMsgHeader, body: UpdateExternalVideoPubMsgBody) extends StandardMsg
-case class UpdateExternalVideoPubMsgBody(status: String, rate: Double, time: Double, state: Int)
+case class UpdateExternalVideoPubMsgBody(status: String, rate: Double, time: Double, state: Boolean)
 
 object StopExternalVideoPubMsg { val NAME = "StopExternalVideoPubMsg" }
 case class StopExternalVideoPubMsg(header: BbbClientMsgHeader, body: StopExternalVideoPubMsgBody) extends StandardMsg
@@ -20,7 +20,7 @@ case class StartExternalVideoEvtMsgBody(externalVideoUrl: String)
 
 object UpdateExternalVideoEvtMsg { val NAME = "UpdateExternalVideoEvtMsg" }
 case class UpdateExternalVideoEvtMsg(header: BbbClientMsgHeader, body: UpdateExternalVideoEvtMsgBody) extends BbbCoreMsg
-case class UpdateExternalVideoEvtMsgBody(status: String, rate: Double, time: Double, state: Int)
+case class UpdateExternalVideoEvtMsgBody(status: String, rate: Double, time: Double, state: Boolean)
 
 object StopExternalVideoEvtMsg { val NAME = "StopExternalVideoEvtMsg" }
 case class StopExternalVideoEvtMsg(header: BbbClientMsgHeader, body: StopExternalVideoEvtMsgBody) extends BbbCoreMsg
diff --git a/bigbluebutton-html5/imports/api/external-videos/server/methods/emitExternalVideoEvent.js b/bigbluebutton-html5/imports/api/external-videos/server/methods/emitExternalVideoEvent.js
index a27667a3a2..29123dbd86 100644
--- a/bigbluebutton-html5/imports/api/external-videos/server/methods/emitExternalVideoEvent.js
+++ b/bigbluebutton-html5/imports/api/external-videos/server/methods/emitExternalVideoEvent.js
@@ -21,7 +21,7 @@ export default function emitExternalVideoEvent(options) {
     check(playerStatus, {
       rate: Match.Maybe(Number),
       time: Match.Maybe(Number),
-      state: Match.Maybe(Number),
+      state: Match.Maybe(Boolean),
     });
 
     let rate = playerStatus.rate || 0;
diff --git a/bigbluebutton-html5/imports/api/external-videos/server/methods/updateExternalVideoStatus.js b/bigbluebutton-html5/imports/api/external-videos/server/methods/updateExternalVideoStatus.js
deleted file mode 100644
index 628eeeaa14..0000000000
--- a/bigbluebutton-html5/imports/api/external-videos/server/methods/updateExternalVideoStatus.js
+++ /dev/null
@@ -1,22 +0,0 @@
-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);
-}
-- 
GitLab