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 0000000000000000000000000000000000000000..66aefb0cf6e47f3deff4ecab774710930bd5ce92 --- /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 0000000000000000000000000000000000000000..1c1e33992980e6a99ceb1d306bd805358b6f0e83 --- /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 0000000000000000000000000000000000000000..789251bb99203e003225c687dfe1c2233ccd7e02 --- /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 0000000000000000000000000000000000000000..dd3fa563b13729eca67a5ef9ce43b6f82b7113f2 --- /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 3aee1d95028a9d06a5b26b1a70d17fa0da6a3e8d..3469157c086c2e12684888bddc240d942b287d49 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 7a66abd7e74828afd2e11092893e7c11129630d0..3ea752b81c016f0ea80bee22fd57f795a520249a 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 1771741e116fe232fce6dc8ebfd84250dbf2e7fb..a27667a3a219ca8114d79cee2579a5feabd8d50d 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); - } + } }