Add a new message RecordAndClearPreviousMarkersCmd.

This commit is contained in:
Ghazi Triki 2018-05-23 16:09:15 +01:00
parent a4fef6ff8a
commit 4eebdf00fa
13 changed files with 122 additions and 31 deletions

View File

@ -0,0 +1,45 @@
package org.bigbluebutton.core.apps.users
import org.bigbluebutton.common2.msgs._
import org.bigbluebutton.core.domain.MeetingState2x
import org.bigbluebutton.core.running.{ LiveMeeting, OutMsgRouter }
import org.bigbluebutton.core2.MeetingStatus2x
import org.bigbluebutton.core.util.TimeUtil
import org.bigbluebutton.core.bus.BigBlueButtonEvent
import org.bigbluebutton.core.api.SendRecordingTimerInternalMsg
trait RecordAndClearPreviousMarkersCmdMsgHdlr {
this: UsersApp =>
val liveMeeting: LiveMeeting
val outGW: OutMsgRouter
def handleRecordAndClearPreviousMarkersCmdMsg(msg: RecordAndClearPreviousMarkersCmdMsg, state: MeetingState2x): MeetingState2x = {
log.info("Set a new recording marker and clear previous ones. meetingId=" + liveMeeting.props.meetingProp.intId + " recording=" + msg.body.recording)
def buildRecordingStatusChangedEvtMsg(meetingId: String, userId: String, recording: Boolean): BbbCommonEnvCoreMsg = {
val routing = Routing.addMsgToClientRouting(MessageTypes.BROADCAST_TO_MEETING, meetingId, userId)
val envelope = BbbCoreEnvelope(RecordingStatusChangedEvtMsg.NAME, routing)
val body = RecordingStatusChangedEvtMsgBody(recording, userId)
val header = BbbClientMsgHeader(RecordingStatusChangedEvtMsg.NAME, meetingId, userId)
val event = RecordingStatusChangedEvtMsg(header, body)
BbbCommonEnvCoreMsg(envelope, event)
}
// Do not allow stop recording and clear previous markers
if (liveMeeting.props.recordProp.allowStartStopRecording &&
MeetingStatus2x.isRecording(liveMeeting.status) != msg.body.recording) {
MeetingStatus2x.recordingStarted(liveMeeting.status)
val tracker = state.recordingTracker.resetTimer(TimeUtil.timeNowInMs())
val event = buildRecordingStatusChangedEvtMsg(liveMeeting.props.meetingProp.intId, msg.body.setBy, msg.body.recording)
outGW.send(event)
state.update(tracker)
} else {
state
}
}
}

View File

@ -14,7 +14,7 @@ trait SendRecordingTimerInternalMsgHdlr {
val outGW: OutMsgRouter
def handleSendRecordingTimerInternalMsg(msg: SendRecordingTimerInternalMsg, state: MeetingState2x): MeetingState2x = {
def buildUpdateReocrdingTimerEvtMsg(meetingId: String, recordingTime: Long): BbbCommonEnvCoreMsg = {
def buildUpdateRecordingTimerEvtMsg(meetingId: String, recordingTime: Long): BbbCommonEnvCoreMsg = {
val routing = Routing.addMsgToClientRouting(MessageTypes.BROADCAST_TO_MEETING, meetingId, "not-used")
val envelope = BbbCoreEnvelope(UpdateRecordingTimerEvtMsg.NAME, routing)
val body = UpdateRecordingTimerEvtMsgBody(recordingTime)
@ -33,7 +33,7 @@ trait SendRecordingTimerInternalMsgHdlr {
val recordingTime = TimeUtil.millisToSeconds(tracker.recordingDuration())
val event = buildUpdateReocrdingTimerEvtMsg(liveMeeting.props.meetingProp.intId, recordingTime)
val event = buildUpdateRecordingTimerEvtMsg(liveMeeting.props.meetingProp.intId, recordingTime)
outGW.send(event)
state.update(tracker)

View File

@ -19,6 +19,7 @@ class UsersApp(
with LogoutAndEndMeetingCmdMsgHdlr
with MeetingActivityResponseCmdMsgHdlr
with SetRecordingStatusCmdMsgHdlr
with RecordAndClearPreviousMarkersCmdMsgHdlr
with SendRecordingTimerInternalMsgHdlr
with UpdateWebcamsOnlyForModeratorCmdMsgHdlr
with GetRecordingStatusReqMsgHdlr

View File

@ -1,12 +1,11 @@
package org.bigbluebutton.core.domain
case class MeetingInactivityTracker(
val maxInactivityTimeoutInMs: Long,
val warningBeforeMaxInMs: Long,
lastActivityTimestampInMs: Long,
warningSent: Boolean,
warningSentOnTimestampInMs: Long
) {
val maxInactivityTimeoutInMs: Long,
val warningBeforeMaxInMs: Long,
lastActivityTimestampInMs: Long,
warningSent: Boolean,
warningSentOnTimestampInMs: Long) {
def setWarningSentAndTimestamp(nowInMs: Long): MeetingInactivityTracker = {
copy(warningSent = true, warningSentOnTimestampInMs = nowInMs)
}
@ -33,13 +32,12 @@ case class MeetingInactivityTracker(
}
case class MeetingExpiryTracker(
startedOnInMs: Long,
userHasJoined: Boolean,
lastUserLeftOnInMs: Option[Long],
durationInMs: Long,
meetingExpireIfNoUserJoinedInMs: Long,
meetingExpireWhenLastUserLeftInMs: Long
) {
startedOnInMs: Long,
userHasJoined: Boolean,
lastUserLeftOnInMs: Option[Long],
durationInMs: Long,
meetingExpireIfNoUserJoinedInMs: Long,
meetingExpireWhenLastUserLeftInMs: Long) {
def setUserHasJoined(): MeetingExpiryTracker = {
if (!userHasJoined) {
copy(userHasJoined = true, lastUserLeftOnInMs = None)
@ -92,10 +90,9 @@ case class MeetingExpiryTracker(
}
case class MeetingRecordingTracker(
startedOnInMs: Long,
previousDurationInMs: Long,
currentDurationInMs: Long
) {
startedOnInMs: Long,
previousDurationInMs: Long,
currentDurationInMs: Long) {
def startTimer(nowInMs: Long): MeetingRecordingTracker = {
copy(startedOnInMs = nowInMs)
@ -105,8 +102,8 @@ case class MeetingRecordingTracker(
copy(currentDurationInMs = 0L, previousDurationInMs = previousDurationInMs + nowInMs - startedOnInMs, startedOnInMs = 0L)
}
def stopTimer(nowInMs: Long): MeetingRecordingTracker = {
copy(startedOnInMs = 0L, previousDurationInMs = 0L, currentDurationInMs = 0L)
def resetTimer(nowInMs: Long): MeetingRecordingTracker = {
copy(startedOnInMs = nowInMs, previousDurationInMs = 0L, currentDurationInMs = 0L)
}
def udpateCurrentDuration(nowInMs: Long): MeetingRecordingTracker = {

View File

@ -15,12 +15,11 @@ object ReceivedJsonMsgHandlerActor {
class ReceivedJsonMsgHandlerActor(
val eventBus: BbbMsgRouterEventBus,
val incomingJsonMessageBus: IncomingJsonMessageBus
)
extends Actor with ActorLogging
with SystemConfiguration
with ReceivedJsonMsgDeserializer
with ReceivedMessageRouter {
val incomingJsonMessageBus: IncomingJsonMessageBus)
extends Actor with ActorLogging
with SystemConfiguration
with ReceivedJsonMsgDeserializer
with ReceivedMessageRouter {
def receive = {
case msg: ReceivedJsonMessage =>
@ -238,6 +237,8 @@ class ReceivedJsonMsgHandlerActor(
routeGenericMsg[LogoutAndEndMeetingCmdMsg](envelope, jsonNode)
case SetRecordingStatusCmdMsg.NAME =>
routeGenericMsg[SetRecordingStatusCmdMsg](envelope, jsonNode)
case RecordAndClearPreviousMarkersCmdMsg.NAME =>
routeGenericMsg[RecordAndClearPreviousMarkersCmdMsg](envelope, jsonNode)
case GetRecordingStatusReqMsg.NAME =>
routeGenericMsg[GetRecordingStatusReqMsg](envelope, jsonNode)
case GetScreenshareStatusReqMsg.NAME =>

View File

@ -208,6 +208,8 @@ class MeetingActor(
case m: LogoutAndEndMeetingCmdMsg => usersApp.handleLogoutAndEndMeetingCmdMsg(m, state)
case m: SetRecordingStatusCmdMsg =>
state = usersApp.handleSetRecordingStatusCmdMsg(m, state)
case m: RecordAndClearPreviousMarkersCmdMsg =>
state = usersApp.handleRecordAndClearPreviousMarkersCmdMsg(m, state)
case m: GetWebcamsOnlyForModeratorReqMsg => usersApp.handleGetWebcamsOnlyForModeratorReqMsg(m)
case m: UpdateWebcamsOnlyForModeratorCmdMsg => usersApp.handleUpdateWebcamsOnlyForModeratorCmdMsg(m)
case m: GetRecordingStatusReqMsg => usersApp.handleGetRecordingStatusReqMsg(m)

View File

@ -75,6 +75,7 @@ class AnalyticsActor extends Actor with ActorLogging {
case m: StartRecordingVoiceConfSysMsg => logMessage(msg)
case m: StopRecordingVoiceConfSysMsg => logMessage(msg)
case m: UpdateRecordingTimerEvtMsg => logMessage(msg)
case m: RecordAndClearPreviousMarkersCmdMsg => logMessage(msg)
case m: TransferUserToVoiceConfSysMsg => logMessage(msg)
case m: UserBroadcastCamStartMsg => logMessage(msg)
case m: UserBroadcastCamStopMsg => logMessage(msg)

View File

@ -92,6 +92,14 @@ object SetRecordingStatusCmdMsg { val NAME = "SetRecordingStatusCmdMsg" }
case class SetRecordingStatusCmdMsg(header: BbbClientMsgHeader, body: SetRecordingStatusCmdMsgBody) extends StandardMsg
case class SetRecordingStatusCmdMsgBody(recording: Boolean, setBy: String)
/**
* Sent by user to start recording mark and ignore previsous marks
*/
object RecordAndClearPreviousMarkersCmdMsg { val NAME = "RecordAndClearPreviousMarkersCmdMsg" }
case class RecordAndClearPreviousMarkersCmdMsg(header: BbbClientMsgHeader, body: RecordAndClearPreviousMarkersCmdMsgBody) extends StandardMsg
case class RecordAndClearPreviousMarkersCmdMsgBody(recording: Boolean, setBy: String)
/**
* Sent to all users about start recording mark.
*/

View File

@ -47,7 +47,8 @@ package org.bigbluebutton.main.events {
public static const MIC_SETTINGS_CLOSED:String = "MIC_SETTINGS_CLOSED";
public static const CAM_SETTINGS_CLOSED:String = "CAM_SETTINGS_CLOSED";
public static const JOIN_VOICE_FOCUS_HEAD:String = "JOIN_VOICE_FOCUS_HEAD";
public static const CHANGE_RECORDING_STATUS:String = "CHANGE_RECORDING_STATUS";
public static const RECORD_AND_CLEAR_PREVIOUS_MARKERS:String = "RECORD_AND_CLEAR_PREVIOUS_MARKERS";
public static const CHANGE_RECORDING_STATUS:String = "RECORD_AND_CLEAR_PREVIOUS_MARKERS";
public static const CHANGE_WEBCAMS_ONLY_FOR_MODERATOR:String = "CHANGE_WEBCAMS_ONLY_FOR_MODERATOR";
public static const SETTINGS_CONFIRMED:String = "BBB_SETTINGS_CONFIRMED";

View File

@ -192,6 +192,12 @@ package org.bigbluebutton.main.model.users
}
}
public function recordAndClearPreviousMarkers(e:BBBEvent):void {
if (this.isModerator() && !e.payload.remote) {
sender.recordAndClearPreviousMarkers(UsersUtil.getMyUserID(), e.payload.recording);
}
}
public function userLoggedIn(e:UsersConnectionEvent):void {
LOGGER.debug("In userLoggedIn - reconnecting and allowed to join");
if (reconnecting && ! LiveMeeting.inst().me.waitingForApproval) {

View File

@ -50,13 +50,17 @@
close();
}
var event:BBBEvent = new BBBEvent(BBBEvent.CHANGE_RECORDING_STATUS);
var event:BBBEvent;
if (_recordingFlag && clearRecordingsChecbox.selected) {
event = new BBBEvent(BBBEvent.RECORD_AND_CLEAR_PREVIOUS_MARKERS);
} else {
event = new BBBEvent(BBBEvent.CHANGE_RECORDING_STATUS);
}
event.payload.remote = false;
event.payload.recording = _recordingFlag;
var d:Dispatcher = new Dispatcher();
d.dispatchEvent(event);
this.enabled = false;
LOGGER.debug("Changing record status to {0}", [event.payload.recording]);
if (!_recordingFlag && getLayoutOptions().logoutOnStopRecording) {

View File

@ -109,7 +109,11 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<EventHandlers type="{BBBEvent.CHANGE_RECORDING_STATUS}">
<MethodInvoker generator="{UserService}" method="changeRecordingStatus" arguments="{event}" />
</EventHandlers>
<EventHandlers type="{BBBEvent.RECORD_AND_CLEAR_PREVIOUS_MARKERS}">
<MethodInvoker generator="{UserService}" method="recordAndClearPreviousMarkers" arguments="{event}" />
</EventHandlers>
<EventHandlers type="{BBBEvent.ACTIVITY_RESPONSE_EVENT}">
<MethodInvoker generator="{UserService}" method="activityResponse" />
</EventHandlers>

View File

@ -329,6 +329,27 @@ package org.bigbluebutton.modules.users.services
); //_netConnection.call
}
public function recordAndClearPreviousMarkers(userID:String, recording:Boolean):void {
var message:Object = {
header: {name: "RecordAndClearPreviousMarkersCmdMsg", meetingId: UsersUtil.getInternalMeetingID(),
userId: UsersUtil.getMyUserID()},
body: {recording: recording, setBy: userID}
};
var _nc:ConnectionManager = BBB.initConnectionManager();
_nc.sendMessage2x(
function(result:String):void { // On successful result
},
function(status:String):void { // status - On error occurred
var logData:Object = UsersUtil.initLogData();
logData.tags = ["apps"];
logData.logCode = "error_sending_change_recording_status";
LOGGER.info(JSON.stringify(logData));
},
JSON.stringify(message)
); //_netConnection.call
}
public function muteAllUsers(mute:Boolean):void {
var message:Object = {
header: {name: "MuteMeetingCmdMsg", meetingId: UsersUtil.getInternalMeetingID(),