Skip to content

Instantly share code, notes, and snippets.

@joergviola
Created August 3, 2012 07:37
Show Gist options
  • Save joergviola/3245458 to your computer and use it in GitHub Desktop.
Save joergviola/3245458 to your computer and use it in GitHub Desktop.
How to record high quality video in flash over slow connections
private function startRecording():void {
createStream();
createCam();
createVideo();
video.attachNetStream(null);
video.attachCamera(camera);
stream.bufferTime = 60;
stream.attachCamera(camera);
stream.attachAudio(mic);
stream.publish(param.name);
}
private function stop():void {
stream.pause();
stream.attachCamera(null);
stream.attachAudio(null);
bufferTimer = new Timer(1000);
bufferTimer.addEventListener(TimerEvent.TIMER, handleBufferCheck);
bufferTimer.start();
}
private function handleBufferCheck(e:TimerEvent):void {
if (stream.bufferLength==0) {
bufferTimer.reset();
stream.close();
}
}
@Override
public void streamPublishStart(IBroadcastStream stream) {
super.streamPublishStart(stream);
try {
log.info("videorec start saving");
// Das ist ein ClientBroadcastStream
String name = stream.getPublishedName();
stream.saveAs(name, false);
String filename = stream.getSaveFilename();
IConnection conn = Red5.getConnectionLocal();
conn.setAttribute("filename", filename);
} catch (Exception e) {
log.log(Level.SEVERE, "on stream record", e);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment