use of org.red5.server.api.IConnection in project bigbluebutton by bigbluebutton.
the class VideoApplication method FCPublish.
/**
* Notification method that is sent by FME just before publishing starts.
*
* @param streamName Name of stream that is about to be published.
*/
@Override
public void FCPublish(String streamName) {
IConnection conn = Red5.getConnectionLocal();
log.info("FCPublish " + streamName + " " + System.currentTimeMillis() + " " + conn.getScope().getName());
}
use of org.red5.server.api.IConnection in project bigbluebutton by bigbluebutton.
the class VideoApplication method streamBroadcastClose.
@Override
public void streamBroadcastClose(IBroadcastStream stream) {
super.streamBroadcastClose(stream);
IConnection conn = Red5.getConnectionLocal();
String scopeName;
if (conn != null) {
scopeName = conn.getScope().getName();
} else {
log.info("Connection local was null, using scope name from the stream: {}", stream);
scopeName = stream.getScope().getName();
}
log.info("Stream broadcast closed for stream=[{}] meeting=[{}]", stream.getPublishedName(), scopeName);
// TODO Anton publish a message to a redis channel so that all [Flash client] users are
// notified that there is no longer rtmp stream being broadcasted.
String userId = getUserId();
String meetingId = conn.getScope().getName();
String streamId = stream.getPublishedName();
if (recordVideoStream) {
long publishDuration = (System.currentTimeMillis() - stream.getCreationTime()) / 1000;
log.info("Stop recording event for stream=[{}] meeting=[{}]", stream.getPublishedName(), scopeName);
Map<String, String> event = new HashMap<String, String>();
event.put("module", "WEBRTC-DESKSHARE");
event.put("timestamp", genTimestamp().toString());
event.put("meetingId", scopeName);
event.put("stream", stream.getPublishedName());
event.put("duration", new Long(publishDuration).toString());
event.put("eventName", "StopWebRTCDesktopShareEvent");
recordingService.record(scopeName, event);
}
}
use of org.red5.server.api.IConnection in project bigbluebutton by bigbluebutton.
the class VideoApplication method streamPublishStart.
@Override
public void streamPublishStart(IBroadcastStream stream) {
super.streamPublishStart(stream);
IConnection conn = Red5.getConnectionLocal();
log.info("streamPublishStart " + stream.getPublishedName() + " " + System.currentTimeMillis() + " " + conn.getScope().getName());
}
use of org.red5.server.api.IConnection in project bigbluebutton by bigbluebutton.
the class VideoApplication method streamBroadcastStart.
@Override
public void streamBroadcastStart(IBroadcastStream stream) {
IConnection conn = Red5.getConnectionLocal();
super.streamBroadcastStart(stream);
log.info("streamBroadcastStart " + stream.getPublishedName() + " " + System.currentTimeMillis() + " " + conn.getScope().getName());
if (recordVideoStream) {
recordStream(stream);
}
}
use of org.red5.server.api.IConnection in project bigbluebutton by bigbluebutton.
the class BigBlueButtonApplication method roomConnect.
@Override
public boolean roomConnect(IConnection connection, Object[] params) {
String username = ((String) params[0]).toString();
String role = ((String) params[1]).toString();
String room = ((String) params[2]).toString();
String voiceBridge = ((String) params[3]).toString();
boolean record = (Boolean) params[4];
String externalUserID = ((String) params[5]).toString();
String internalUserID = ((String) params[6]).toString();
Boolean muted = false;
if (params.length >= 7 && ((Boolean) params[7])) {
muted = true;
}
Map<String, Boolean> lsMap = null;
if (params.length >= 8) {
try {
lsMap = (Map<String, Boolean>) params[8];
} catch (Exception e) {
lsMap = new HashMap<String, Boolean>();
}
}
String userId = internalUserID;
String sessionId = Red5.getConnectionLocal().getSessionId();
String connType = getConnectionType(Red5.getConnectionLocal().getType());
/**
* Find if there are any other connections owned by this user. If we find one,
* that means that the connection is old and the user reconnected. Clear the
* userId attribute so that messages would not be sent in the defunct connection.
*/
Set<IConnection> conns = Red5.getConnectionLocal().getScope().getClientConnections();
for (IConnection conn : conns) {
String connUserId = (String) conn.getAttribute("INTERNAL_USER_ID");
String connSessionId = conn.getSessionId();
String clientId = conn.getClient().getId();
String remoteHost = connection.getRemoteAddress();
int remotePort = connection.getRemotePort();
if (connUserId != null && connUserId.equals(userId) && !connSessionId.equals(sessionId)) {
conn.removeAttribute("INTERNAL_USER_ID");
Map<String, Object> logData = new HashMap<String, Object>();
logData.put("meetingId", room);
logData.put("userId", userId);
logData.put("oldConnId", connSessionId);
logData.put("newConnId", sessionId);
logData.put("clientId", clientId);
logData.put("remoteAddress", remoteHost + ":" + remotePort);
logData.put("event", "removing_defunct_connection");
logData.put("description", "Removing defunct connection BBB Apps.");
Gson gson = new Gson();
String logStr = gson.toJson(logData);
log.info("Removing defunct connection: data={}", logStr);
}
}
BigBlueButtonSession bbbSession = new BigBlueButtonSession(room, internalUserID, username, role, voiceBridge, record, externalUserID, muted, sessionId);
connection.setAttribute(Constants.SESSION, bbbSession);
connection.setAttribute("INTERNAL_USER_ID", internalUserID);
connection.setAttribute("USER_SESSION_ID", sessionId);
connection.setAttribute("TIMESTAMP", System.currentTimeMillis());
red5InGW.initLockSettings(room, lsMap);
red5InGW.initAudioSettings(room, internalUserID, muted);
String meetingId = bbbSession.getRoom();
String userFullname = bbbSession.getUsername();
String connId = Red5.getConnectionLocal().getSessionId();
String remoteHost = Red5.getConnectionLocal().getRemoteAddress();
int remotePort = Red5.getConnectionLocal().getRemotePort();
String clientId = Red5.getConnectionLocal().getClient().getId();
Map<String, Object> logData = new HashMap<String, Object>();
logData.put("meetingId", meetingId);
logData.put("connType", connType);
logData.put("connId", connId);
logData.put("clientId", clientId);
logData.put("remoteAddress", remoteHost + ":" + remotePort);
logData.put("userId", userId);
logData.put("externalUserId", externalUserID);
logData.put("sessionId", sessionId);
logData.put("username", userFullname);
logData.put("event", "user_joining_bbb_apps");
logData.put("description", "User joining BBB Apps.");
Gson gson = new Gson();
String logStr = gson.toJson(logData);
log.info("User joining bbb-apps: data={}", logStr);
userConnections.addUserConnection(userId, connId);
return super.roomConnect(connection, params);
}
Aggregations