use of org.red5.server.api.stream.IBroadcastStream 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);
String userId = getUserId();
String meetingId = conn.getScope().getName();
String streamId = stream.getPublishedName();
Matcher matcher = RECORD_STREAM_ID_PATTERN.matcher(stream.getPublishedName());
if (matcher.matches()) {
IStreamListener listener = streamListeners.remove(scopeName + "-" + stream.getPublishedName());
if (listener != null) {
((VideoStreamListener) listener).streamStopped();
stream.removeStreamListener(listener);
}
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", "WEBCAM");
event.put("timestamp", genTimestamp().toString());
event.put("meetingId", scopeName);
event.put("stream", stream.getPublishedName());
event.put("duration", new Long(publishDuration).toString());
event.put("eventName", "StopWebcamShareEvent");
recordingService.record(scopeName, event);
}
}
use of org.red5.server.api.stream.IBroadcastStream 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.stream.IBroadcastStream in project bigbluebutton by bigbluebutton.
the class Red5AppAdapter method streamBroadcastClose.
@Override
public void streamBroadcastClose(IBroadcastStream stream) {
super.streamBroadcastClose(stream);
log.info("streamBroadcastStop " + stream.getPublishedName() + "]");
String streamId = stream.getPublishedName();
Matcher matcher = STREAM_ID_PATTERN.matcher(stream.getPublishedName());
if (matcher.matches()) {
String meetingId = matcher.group(1).trim();
app.streamStopped(meetingId, streamId);
boolean recordVideoStream = app.recordStream(meetingId, streamId);
if (recordVideoStream) {
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();
}
IStreamListener listener = streamListeners.remove(scopeName + "-" + stream.getPublishedName());
if (listener != null) {
stream.removeStreamListener(listener);
}
String filename = recordingDirectory;
if (!filename.endsWith("/")) {
filename.concat("/");
}
filename = filename.concat(meetingId).concat("/").concat(stream.getPublishedName()).concat(".flv");
long publishDuration = (System.currentTimeMillis() - stream.getCreationTime()) / 1000;
Map<String, String> event = new HashMap<String, String>();
event.put("module", "Deskshare");
event.put("timestamp", genTimestamp().toString());
event.put("meetingId", scopeName);
event.put("stream", stream.getPublishedName());
event.put("file", filename);
event.put("duration", new Long(publishDuration).toString());
event.put("eventName", "DeskshareStoppedEvent");
recordingService.record(scopeName, event);
}
Map<String, Object> logData = new HashMap<String, Object>();
logData.put("meetingId", meetingId);
logData.put("streamId", streamId);
logData.put("recorded", recordVideoStream);
Gson gson = new Gson();
String logStr = gson.toJson(logData);
log.info("ScreenShare broadcast stopped: data={}", logStr);
} else {
log.error("Invalid streamid format [{}]", streamId);
}
}
use of org.red5.server.api.stream.IBroadcastStream in project bigbluebutton by bigbluebutton.
the class Red5AppAdapter method recordStream.
/**
* A hook to record a stream. A file is written in webapps/video/streams/
* @param stream
*/
private void recordStream(IBroadcastStream stream) {
IConnection conn = Red5.getConnectionLocal();
long now = System.currentTimeMillis();
// + "-" + now; /** Comment out for now...forgot why I added this - ralam */
String recordingStreamName = stream.getPublishedName();
try {
log.info("Recording stream " + recordingStreamName);
ClientBroadcastStream cstream = (ClientBroadcastStream) this.getBroadcastStream(conn.getScope(), stream.getPublishedName());
cstream.saveAs(recordingStreamName, false);
} catch (Exception e) {
log.error("ERROR while recording stream " + e.getMessage());
e.printStackTrace();
}
}
use of org.red5.server.api.stream.IBroadcastStream in project bigbluebutton by bigbluebutton.
the class Red5AppAdapter method streamBroadcastStart.
@Override
public void streamBroadcastStart(IBroadcastStream stream) {
IConnection conn = Red5.getConnectionLocal();
super.streamBroadcastStart(stream);
log.info("streamBroadcastStart " + stream.getPublishedName() + "]");
String streamId = stream.getPublishedName();
Matcher matcher = STREAM_ID_PATTERN.matcher(stream.getPublishedName());
if (matcher.matches()) {
String meetingId = matcher.group(1).trim();
String url = streamBaseUrl + "/" + meetingId + "/" + streamId;
app.streamStarted(meetingId, streamId, url);
boolean recordVideoStream = app.recordStream(meetingId, streamId);
if (recordVideoStream) {
recordStream(stream);
ScreenshareStreamListener listener = new ScreenshareStreamListener(recordingService, recordingDirectory);
stream.addStreamListener(listener);
streamListeners.put(conn.getScope().getName() + "-" + stream.getPublishedName(), listener);
}
Map<String, Object> logData = new HashMap<String, Object>();
logData.put("meetingId", meetingId);
logData.put("streamId", streamId);
logData.put("url", url);
logData.put("recorded", recordVideoStream);
Gson gson = new Gson();
String logStr = gson.toJson(logData);
log.info("ScreenShare broadcast started: data={}", logStr);
} else {
log.error("Invalid streamid format [{}]", streamId);
}
}
Aggregations