From aff272cbf3023c19deb47e3678b9864067c71894 Mon Sep 17 00:00:00 2001 From: Anton Georgiev <anton.georgiev@protonmail.com> Date: Thu, 25 Feb 2021 19:54:22 +0000 Subject: [PATCH] Merge #7484 into #11447 ExternalVideo recording events --- .../AbsractExternalVideoRecordEvent.scala | 24 +++++++++ .../StartExternalVideoRecordEvent.scala | 34 +++++++++++++ .../events/StopExternalVideoRecordEvent.scala | 24 +++++++++ .../UpdateExternalVideoRecordEvent.scala | 49 +++++++++++++++++++ .../endpoint/redis/RedisRecorderActor.scala | 31 ++++++++++++ .../common2/msgs/ExternalVideoMsgs.scala | 4 +- .../server/methods/emitExternalVideoEvent.js | 6 +-- 7 files changed, 167 insertions(+), 5 deletions(-) create mode 100644 akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/AbsractExternalVideoRecordEvent.scala create mode 100644 akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/StartExternalVideoRecordEvent.scala create mode 100644 akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/StopExternalVideoRecordEvent.scala create mode 100644 akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/UpdateExternalVideoRecordEvent.scala diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/AbsractExternalVideoRecordEvent.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/AbsractExternalVideoRecordEvent.scala new file mode 100644 index 0000000000..66aefb0cf6 --- /dev/null +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/AbsractExternalVideoRecordEvent.scala @@ -0,0 +1,24 @@ +/** + * BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ + * + * Copyright (c) 2019 BigBlueButton Inc. and by respective authors (see below). + * + * This program is free software; you can redistribute it and/or modify it under the + * terms of the GNU Lesser General Public License as published by the Free Software + * Foundation; either version 3.0 of the License, or (at your option) any later + * version. + * + * BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along + * with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. + * + */ + +package org.bigbluebutton.core.record.events + +trait AbstractExternalVideoRecordEvent extends RecordEvent { + setModule("EXTERNAL-VIDEO") +} diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/StartExternalVideoRecordEvent.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/StartExternalVideoRecordEvent.scala new file mode 100644 index 0000000000..1c1e339929 --- /dev/null +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/StartExternalVideoRecordEvent.scala @@ -0,0 +1,34 @@ +/** + * BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ + * + * Copyright (c) 2019 BigBlueButton Inc. and by respective authors (see below). + * + * This program is free software; you can redistribute it and/or modify it under the + * terms of the GNU Lesser General Public License as published by the Free Software + * Foundation; either version 3.0 of the License, or (at your option) any later + * version. + * + * BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along + * with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. + * + */ + +package org.bigbluebutton.core.record.events + +class StartExternalVideoRecordEvent extends AbstractExternalVideoRecordEvent { + import StartExternalVideoRecordEvent._ + + setEvent("StartExternalVideoRecordEvent") + + def setExternalVideoUrl(externalVideoUrl: String) { + eventMap.put(EXTERNAL_VIDEO_URL, externalVideoUrl) + } +} + +object StartExternalVideoRecordEvent { + protected final val EXTERNAL_VIDEO_URL = "externalVideoUrl" +} diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/StopExternalVideoRecordEvent.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/StopExternalVideoRecordEvent.scala new file mode 100644 index 0000000000..789251bb99 --- /dev/null +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/StopExternalVideoRecordEvent.scala @@ -0,0 +1,24 @@ +/** + * BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ + * + * Copyright (c) 2019 BigBlueButton Inc. and by respective authors (see below). + * + * This program is free software; you can redistribute it and/or modify it under the + * terms of the GNU Lesser General Public License as published by the Free Software + * Foundation; either version 3.0 of the License, or (at your option) any later + * version. + * + * BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along + * with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. + * + */ + +package org.bigbluebutton.core.record.events + +class StopExternalVideoRecordEvent extends AbstractExternalVideoRecordEvent { + setEvent("StopExternalVideoRecordEvent") +} 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 new file mode 100644 index 0000000000..dd3fa563b1 --- /dev/null +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/UpdateExternalVideoRecordEvent.scala @@ -0,0 +1,49 @@ +/** + * BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ + * + * Copyright (c) 2019 BigBlueButton Inc. and by respective authors (see below). + * + * This program is free software; you can redistribute it and/or modify it under the + * terms of the GNU Lesser General Public License as published by the Free Software + * Foundation; either version 3.0 of the License, or (at your option) any later + * version. + * + * BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along + * with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. + * + */ + +package org.bigbluebutton.core.record.events + +class UpdateExternalVideoRecordEvent extends AbstractExternalVideoRecordEvent { + import UpdateExternalVideoRecordEvent._ + + setEvent("UpdateExternalVideoRecordEvent") + + def setStatus(status: String) { + eventMap.put(STATUS, status) + } + + def setRate(rate: Double) { + eventMap.put(RATE, rate.toString) + } + + def setTime(time: Double) { + eventMap.put(TIME, time.toString) + } + + def setState(state: Int) { + eventMap.put(STATE, state.toString) + } +} + +object UpdateExternalVideoRecordEvent { + protected final val STATUS = "status" + protected final val RATE = "rate" + protected final val TIME = "time" + protected final val STATE = "state" +} diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/RedisRecorderActor.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/RedisRecorderActor.scala index 3aee1d9502..3469157c08 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/RedisRecorderActor.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/RedisRecorderActor.scala @@ -108,6 +108,11 @@ class RedisRecorderActor( case m: PollStoppedEvtMsg => handlePollStoppedEvtMsg(m) case m: PollShowResultEvtMsg => handlePollShowResultEvtMsg(m) + // ExternalVideo + case m: StartExternalVideoEvtMsg => handleStartExternalVideoEvtMsg(m) + case m: UpdateExternalVideoEvtMsg => handleUpdateExternalVideoEvtMsg(m) + case m: StopExternalVideoEvtMsg => handleStopExternalVideoEvtMsg(m) + case _ => // message not to be recorded. } } @@ -456,6 +461,32 @@ class RedisRecorderActor( } */ + private def handleStartExternalVideoEvtMsg(msg: StartExternalVideoEvtMsg) { + val ev = new StartExternalVideoRecordEvent() + ev.setMeetingId(msg.header.meetingId) + ev.setExternalVideoUrl(msg.body.externalVideoUrl) + + record(msg.header.meetingId, ev.toMap.asJava) + } + + private def handleUpdateExternalVideoEvtMsg(msg: UpdateExternalVideoEvtMsg) { + val ev = new UpdateExternalVideoRecordEvent() + ev.setMeetingId(msg.header.meetingId) + ev.setStatus(msg.body.status) + ev.setRate(msg.body.rate) + ev.setTime(msg.body.time) + ev.setState(msg.body.state) + + record(msg.header.meetingId, ev.toMap.asJava) + } + + private def handleStopExternalVideoEvtMsg(msg: StopExternalVideoEvtMsg) { + val ev = new StopExternalVideoRecordEvent() + ev.setMeetingId(msg.header.meetingId) + + record(msg.header.meetingId, ev.toMap.asJava) + } + private def handleRecordingStatusChangedEvtMsg(msg: RecordingStatusChangedEvtMsg) { val ev = new RecordStatusRecordEvent() ev.setMeetingId(msg.header.meetingId) 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 7a66abd7e7..3ea752b81c 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: Boolean) +case class UpdateExternalVideoPubMsgBody(status: String, rate: Double, time: Double, state: Int) 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: Boolean) +case class UpdateExternalVideoEvtMsgBody(status: String, rate: Double, time: Double, state: Int) 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 1771741e11..a27667a3a2 100644 --- a/bigbluebutton-html5/imports/api/external-videos/server/methods/emitExternalVideoEvent.js +++ b/bigbluebutton-html5/imports/api/external-videos/server/methods/emitExternalVideoEvent.js @@ -13,7 +13,7 @@ export default function emitExternalVideoEvent(options) { const { status, playerStatus } = options; - const user = Users.findOne({ meetingId: meetingId, userId: requesterUserId }) + const user = Users.findOne({ meetingId, userId: requesterUserId }) if (user && user.presenter) { @@ -21,7 +21,7 @@ export default function emitExternalVideoEvent(options) { check(playerStatus, { rate: Match.Maybe(Number), time: Match.Maybe(Number), - state: Match.Maybe(Boolean), + state: Match.Maybe(Number), }); let rate = playerStatus.rate || 0; @@ -32,5 +32,5 @@ export default function emitExternalVideoEvent(options) { Logger.debug(`User id=${requesterUserId} sending ${EVENT_NAME} event:${state} for meeting ${meetingId}`); return RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload); - } + } } -- GitLab