try {
fo = new FileOutputStream(flvFilename);
fo.write(svf.encodeHeader());
} catch (FileNotFoundException e1) {
log.error(StackTraceUtil.getStackTrace(e1));
RecordErrorEvent event = new RecordErrorEvent(session);
event.setReason("Failed to create recording output.");
listeners.notifyListeners(event);
} catch (IOException e) {
log.error(StackTraceUtil.getStackTrace(e));
RecordErrorEvent event = new RecordErrorEvent(session);
event.setReason("Cannot record to recording output.");
listeners.notifyListeners(event);
}
sendCapturedScreen = true;
log.info("Starting stream");
capturedScreenSender = new Runnable() {
public void run() {
while (sendCapturedScreen) {
try {
IoBuffer frame = screenQueue.take();
recordFrameToFile(frame);
} catch (InterruptedException e) {
log.error("InterruptedExeption while taking event.");
RecordErrorEvent event = new RecordErrorEvent(session);
event.setReason("Cannot record to recording output.");
listeners.notifyListeners(event);
}
}
}
};
exec.execute(capturedScreenSender);
RecordStartedEvent event = new RecordStartedEvent(session);
event.setFile(flvFilename);
listeners.notifyListeners(event);
}