public String recordMeetingStream(String roomRecordingName, String comment, Boolean isInterview) {
try {
log.debug(":: recordMeetingStream ::");
IConnection current = Red5.getConnectionLocal();
Client currentClient = sessionManager.getClientByStreamId(current.getClient().getId(), null);
Long room_id = currentClient.getRoom_id();
Date now = new Date();
FlvRecording flvRecording = new FlvRecording();
flvRecording.setFileHash("");
flvRecording.setFileName(roomRecordingName);
flvRecording.setInsertedBy(currentClient.getUser_id());
flvRecording.setFolder(false);
flvRecording.setIsImage(false);
flvRecording.setIsPresentation(false);
flvRecording.setIsRecording(true);
flvRecording.setComment(comment);
flvRecording.setIsInterview(isInterview);
flvRecording.setRoom_id(room_id);
flvRecording.setRecordStart(now);
flvRecording.setWidth(currentClient.getVWidth());
flvRecording.setHeight(currentClient.getVHeight());
flvRecording.setOwnerId(currentClient.getUser_id());
flvRecording.setStatus(FlvRecording.Status.PROCESSING);
flvRecording = recordingDao.update(flvRecording);
// Receive flvRecordingId
Long flvRecordingId = flvRecording.getFlvRecordingId();
// Update Client and set Flag
currentClient.setIsRecording(true);
currentClient.setFlvRecordingId(flvRecordingId);
sessionManager.updateClientByStreamId(current.getClient().getId(), currentClient, false, null);
// get all stream and start recording them
for (Set<IConnection> conset : current.getScope().getConnections()) {
for (IConnection conn : conset) {
if (conn != null) {
if (conn instanceof IServiceCapableConnection) {
Client rcl = sessionManager.getClientByStreamId(conn.getClient().getId(), null);
// Send every user a notification that the recording did start
if (!rcl.getIsAVClient()) {
((IServiceCapableConnection) conn).invoke("startedRecording", new Object[] { currentClient }, this);
}
// If its the recording client we need another type of Meta Data
if (rcl.getIsScreenClient()) {
if (rcl.getFlvRecordingId() != null && rcl.isScreenPublishStarted()) {
String streamName_Screen = generateFileName(flvRecordingId, rcl.getStreamPublishName().toString());
Long flvRecordingMetaDataId = metaDataDao.addFlvRecordingMetaData(
flvRecordingId, rcl.getFirstname() + " " + rcl.getLastname(), now, false,
false, true, streamName_Screen, rcl.getInterviewPodId());
// Start FLV Recording
recordShow(conn, rcl.getStreamPublishName(), streamName_Screen, flvRecordingMetaDataId, true, isInterview);
// Add Meta Data
rcl.setFlvRecordingMetaDataId(flvRecordingMetaDataId);
sessionManager.updateClientByStreamId(rcl.getStreamid(), rcl, false, null);
}
} else if (rcl.getIsAVClient()
&& (rcl.getAvsettings().equals("av") || rcl.getAvsettings().equals("a") || rcl.getAvsettings().equals("v"))) {
// if the user does publish av, a, v
// But we only record av or a, video only is not interesting
String streamName = generateFileName(flvRecordingId, String.valueOf(rcl.getBroadCastID()).toString());
// Add Meta Data
boolean isAudioOnly = false;
if (rcl.getAvsettings().equals("a")) {
isAudioOnly = true;
}
boolean isVideoOnly = false;
if (rcl.getAvsettings().equals("v")) {
isVideoOnly = true;
}
Long flvRecordingMetaDataId = metaDataDao.addFlvRecordingMetaData(flvRecordingId,
rcl.getFirstname() + " " + rcl.getLastname(), now, isAudioOnly, isVideoOnly, false, streamName,
rcl.getInterviewPodId());
rcl.setFlvRecordingMetaDataId(flvRecordingMetaDataId);
sessionManager.updateClientByStreamId(rcl.getStreamid(), rcl, false, null);
// Start FLV recording
recordShow(conn, String.valueOf(rcl.getBroadCastID()).toString(), streamName, flvRecordingMetaDataId, !isAudioOnly,
isInterview);
}
}
}
}