Created
August 3, 2012 07:37
-
-
Save joergviola/3245458 to your computer and use it in GitHub Desktop.
How to record high quality video in flash over slow connections
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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